Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

MUL-6836: fix(codex): allow explicit standard speed (#7756)

mrlonely108407088ce1
diff --git a/packages/core/api/schemas.test.ts b/packages/core/api/schemas.test.ts
index fcf92453e7..419f243617 100644
--- a/packages/core/api/schemas.test.ts
+++ b/packages/core/api/schemas.test.ts
@@ -1537,6 +1537,7 @@ describe("RuntimeModelListRequestSchema", () => {
default_level: "low",
},
service_tiers: [{ id: "fast", name: "Fast" }],
+ supports_explicit_standard_service_tier: true,
},
],
};
@@ -1555,6 +1556,9 @@ describe("RuntimeModelListRequestSchema", () => {
{ value: "high", label: "High" },
]);
expect(parsed.models?.[0]?.service_tiers).toEqual([{ id: "fast", name: "Fast" }]);
+ expect(
+ parsed.models?.[0]?.supports_explicit_standard_service_tier,
+ ).toBe(true);
expect(parsed.cached).toBeUndefined();
});
@@ -1584,6 +1588,24 @@ describe("RuntimeModelListRequestSchema", () => {
expect(parsed.cached).toBeUndefined();
});
+ it("treats an older daemon that omits explicit-standard support as unsupported", () => {
+ const model = completed.models[0]!;
+ const {
+ supports_explicit_standard_service_tier: _omitted,
+ ...oldDaemonModel
+ } = model;
+ const parsed = parseWithFallback(
+ { ...completed, models: [oldDaemonModel] },
+ RuntimeModelListRequestSchema,
+ MALFORMED_RUNTIME_MODEL_LIST_REQUEST,
+ { endpoint: "test" },
+ );
+
+ expect(
+ parsed.models?.[0]?.supports_explicit_standard_service_tier,
+ ).toBeUndefined();
+ });
+
it("passes an unknown status through instead of failing the whole response", () => {
const parsed = parseWithFallback(
{ ...completed, status: "superseded" },
@@ -1608,6 +1630,15 @@ describe("RuntimeModelListRequestSchema", () => {
{ ...completed, supported: "yes" },
{ ...completed, models: "nope" },
{ ...completed, models: [{ label: "no id" }] },
+ {
+ ...completed,
+ models: [
+ {
+ ...completed.models[0],
+ supports_explicit_standard_service_tier: "yes",
+ },
+ ],
+ },
]) {
const parsed = parseWithFallback(
malformed,
diff --git a/packages/core/api/schemas.ts b/packages/core/api/schemas.ts
index d8eb94485d..a984734867 100644
--- a/packages/core/api/schemas.ts
+++ b/packages/core/api/schemas.ts
@@ -2942,6 +2942,7 @@ const RuntimeModelSchema = z.object({
thinking: RuntimeModelThinkingSchema.nullable().optional()
.transform((v) => v ?? undefined),
service_tiers: z.array(RuntimeModelServiceTierSchema).optional(),
+ supports_explicit_standard_service_tier: z.boolean().optional(),
}).loose();
export const RuntimeModelListRequestSchema = z.object({
diff --git a/packages/core/types/agent.ts b/packages/core/types/agent.ts
index 0bbc8422d6..5aabb70c9e 100644
--- a/packages/core/types/agent.ts
+++ b/packages/core/types/agent.ts
@@ -1103,6 +1103,12 @@ export interface RuntimeModel {
thinking?: RuntimeModelThinking;
/** Runtime-native execution tiers advertised for this exact model. */
service_tiers?: RuntimeModelServiceTier[];
+ /**
+ * Whether this runtime's installed Codex CLI accepts the request-only
+ * `default` sentinel for explicit standard routing. Missing means false so
+ * a new client stays safe when connected to an older daemon.
+ */
+ supports_explicit_standard_service_tier?: boolean;
}
export interface RuntimeModelServiceTier {
diff --git a/packages/views/agents/components/inspector/model-change-cleanup.test.ts b/packages/views/agents/components/inspector/model-change-cleanup.test.ts
index 688203c0fd..e6de0f2fb9 100644
--- a/packages/views/agents/components/inspector/model-change-cleanup.test.ts
+++ b/packages/views/agents/components/inspector/model-change-cleanup.test.ts
@@ -6,6 +6,7 @@ import { buildModelChangeUpdate } from "./model-change-cleanup";
const FAST_HIGH: RuntimeModel = {
id: "gpt-5.6-sol",
label: "GPT-5.6 Sol",
+ supports_explicit_standard_service_tier: true,
thinking: {
supported_levels: [
{ value: "medium", label: "Medium" },
@@ -18,11 +19,13 @@ const FAST_HIGH: RuntimeModel = {
const PLAIN: RuntimeModel = {
id: "gpt-5.4-mini",
label: "GPT-5.4 mini",
+ supports_explicit_standard_service_tier: true,
};
const MEDIUM_ONLY: RuntimeModel = {
id: "gpt-5.5",
label: "GPT-5.5",
+ supports_explicit_standard_service_tier: true,
thinking: { supported_levels: [{ value: "medium", label: "Medium" }] },
service_tiers: [{ id: "priority", name: "Fast" }],
};
@@ -64,6 +67,30 @@ describe("buildModelChangeUpdate (MUL-5390)", () => {
).toEqual({ model: "gpt-5.6-sol" });
});
+ it("keeps Codex explicit standard across model changes", () => {
+ expect(
+ buildModelChangeUpdate({
+ provider: "codex",
+ model: "gpt-5.4-mini",
+ thinkingLevel: "",
+ serviceTier: "default",
+ catalog: CATALOG,
+ }),
+ ).toEqual({ model: "gpt-5.4-mini" });
+ });
+
+ it("clears explicit standard when an older daemon does not advertise support", () => {
+ expect(
+ buildModelChangeUpdate({
+ provider: "codex",
+ model: "gpt-5.4-mini",
+ thinkingLevel: "",
+ serviceTier: "default",
+ catalog: [{ id: "gpt-5.4-mini", label: "GPT-5.4 mini" }],
+ }),
+ ).toEqual({ model: "gpt-5.4-mini", service_tier: "" });
+ });
+
it("clears only the unsupported half", () => {
expect(
buildModelChangeUpdate({
diff --git a/packages/views/agents/components/inspector/model-change-cleanup.ts b/packages/views/agents/components/inspector/model-change-cleanup.ts
index df94a5418a..9adf519982 100644
--- a/packages/views/agents/components/inspector/model-change-cleanup.ts
+++ b/packages/views/agents/components/inspector/model-change-cleanup.ts
@@ -19,13 +19,14 @@ export type ModelChangeUpdate = {
/**
* Builds the single PATCH body for a model change on the settings page.
*
- * `thinking_level` / `service_tier` are per-model capabilities: keeping a value
- * the new model never advertised leaves an orphan override that the daemon
- * silently drops at execution time, so the settings page would claim a tier
- * that never ran (MUL-5390). Clearing unconditionally is worse though — moving
- * between two models that both support Fast would throw the user's choice away,
- * and clearing while the catalog is unknown would delete a value the daemon
- * would have honoured.
+ * `thinking_level` and catalog service tiers are per-model capabilities:
+ * keeping a value the new model never advertised leaves an orphan override
+ * that the daemon silently drops at execution time, so the settings page would
+ * claim a tier that never ran (MUL-5390). Explicit Standard is the exception:
+ * its advertised capability belongs to the installed Codex CLI. Clearing
+ * unconditionally is worse though — moving between two models that both
+ * support Fast would throw the user's choice away, and clearing while the
+ * catalog is unknown would delete a value the daemon would have honoured.
*
* So: clear only what the authoritative catalog says the new model does not
* support. Unknown catalog, unknown model, or an empty model ("follow the
@@ -60,9 +61,13 @@ export function buildModelChangeUpdate(input: {
);
if (input.thinkingLevel && !supportsThinking) update.thinking_level = "";
- const supportsTier = (entry.service_tiers ?? []).some(
- (tier) => tier.id === input.serviceTier,
- );
+ const supportsTier =
+ (entry.service_tiers ?? []).some((tier) => tier.id === input.serviceTier) ||
+ (input.serviceTier === "default" &&
+ input.catalog.some(
+ (candidate) =>
+ candidate.supports_explicit_standard_service_tier === true,
+ ));
if (input.serviceTier && !supportsTier) update.service_tier = "";
return update;
diff --git a/packages/views/agents/components/inspector/service-tier-setting-field.test.tsx b/packages/views/agents/components/inspector/service-tier-setting-field.test.tsx
index f6bfc1eefa..ac08670c84 100644
--- a/packages/views/agents/components/inspector/service-tier-setting-field.test.tsx
+++ b/packages/views/agents/components/inspector/service-tier-setting-field.test.tsx
@@ -35,6 +35,7 @@ import { ServiceTierSettingField } from "./service-tier-setting-field";
const FAST_MODEL: RuntimeModel = {
id: "gpt-5.6-sol",
label: "GPT-5.6 Sol",
+ supports_explicit_standard_service_tier: true,
service_tiers: [
{
id: "priority",
@@ -108,6 +109,60 @@ describe("ServiceTierSettingField", () => {
expect(onChange).toHaveBeenCalledWith("priority");
});
+ it("offers explicit standard speed separately from the runtime default", async () => {
+ const { onChange } = renderField();
+
+ await screen.findByText("Speed");
+ fireEvent.click(screen.getByRole("button"));
+ expect(
+ await screen.findByText("Standard speed and standard usage"),
+ ).toBeInTheDocument();
+ fireEvent.click(screen.getByText("Standard"));
+
+ expect(onChange).toHaveBeenCalledWith("default");
+ });
+
+ it("does not offer explicit standard when an older daemon omits the capability", async () => {
+ const {
+ supports_explicit_standard_service_tier: _omitted,
+ ...oldDaemonModel
+ } = FAST_MODEL;
+ mockInitiateListModels.mockResolvedValue(listResult([oldDaemonModel]));
+ mockGetListModelsResult.mockResolvedValue(listResult([oldDaemonModel]));
+ renderField();
+
+ await screen.findByText("Speed");
+ fireEvent.click(screen.getByRole("button"));
+ expect(await screen.findByText("Fast")).toBeInTheDocument();
+ expect(screen.queryByText("Standard")).toBeNull();
+ });
+
+ it("offers explicit standard even when no alternative tier is advertised", async () => {
+ const standardOnly: RuntimeModel = {
+ id: "gpt-5.4-mini",
+ label: "GPT-5.4 mini",
+ supports_explicit_standard_service_tier: true,
+ };
+ mockInitiateListModels.mockResolvedValue(listResult([standardOnly]));
+ mockGetListModelsResult.mockResolvedValue(listResult([standardOnly]));
+ renderField({ model: standardOnly.id });
+
+ await screen.findByText("Speed");
+ fireEvent.click(screen.getByRole("button"));
+ expect(await screen.findByText("Standard")).toBeInTheDocument();
+ });
+
+ it("offers CLI-level explicit standard without a pinned model", async () => {
+ mockInitiateListModels.mockResolvedValue(listResult([FAST_MODEL]));
+ mockGetListModelsResult.mockResolvedValue(listResult([FAST_MODEL]));
+ renderField({ model: "" });
+
+ await screen.findByText("Speed");
+ fireEvent.click(screen.getByRole("button"));
+ expect(await screen.findByText("Standard")).toBeInTheDocument();
+ expect(screen.queryByText("Fast")).toBeNull();
+ });
+
it("hides when the model has no tiers and no value is persisted", async () => {
mockInitiateListModels.mockResolvedValue(
listResult([{ id: "gpt-5.4-mini", label: "GPT-5.4 mini" }]),
diff --git a/packages/views/agents/components/inspector/service-tier-setting-field.tsx b/packages/views/agents/components/inspector/service-tier-setting-field.tsx
index d4a4fa9ef3..56e0844788 100644
--- a/packages/views/agents/components/inspector/service-tier-setting-field.tsx
+++ b/packages/views/agents/components/inspector/service-tier-setting-field.tsx
@@ -41,20 +41,22 @@ export function ServiceTierSettingField({
const modelsQuery = useQuery(
runtimeModelsOptions(runtimeOnline ? runtimeId : null),
);
- const entry = findModelCapabilityEntry(
- modelsQuery.data?.models ?? [],
- model,
- provider,
- );
+ const models = modelsQuery.data?.models ?? [];
+ const entry = findModelCapabilityEntry(models, model, provider);
const tiers = entry?.service_tiers ?? [];
+ const supportsExplicitStandard = models.some(
+ (candidate) =>
+ candidate.supports_explicit_standard_service_tier === true,
+ );
- if (tiers.length === 0 && !value) return null;
+ if (tiers.length === 0 && !supportsExplicitStandard && !value) return null;
return (
<SettingsRow label={label} size="select-wide">
<ServiceTierPicker
value={value}
tiers={tiers}
+ supportsExplicitStandard={supportsExplicitStandard}
canEdit={canEdit}
onChange={onChange}
/>
@@ -65,17 +67,33 @@ export function ServiceTierSettingField({
function ServiceTierPicker({
value,
tiers,
+ supportsExplicitStandard,
canEdit,
onChange,
}: {
value: string;
tiers: RuntimeModelServiceTier[];
+ supportsExplicitStandard: boolean;
canEdit: boolean;
onChange: (next: string) => Promise<void> | void;
}) {
const { t } = useT("agents");
const [open, setOpen] = useState(false);
- const selected = value ? tiers.find((tier) => tier.id === value) : undefined;
+ const availableTiers = supportsExplicitStandard
+ ? [
+ {
+ id: "default",
+ name: t(($) => $.pickers.service_tier_standard),
+ description: t(
+ ($) => $.pickers.service_tier_standard_description,
+ ),
+ },
+ ...tiers.filter((tier) => tier.id !== "default"),
+ ]
+ : tiers;
+ const selected = value
+ ? availableTiers.find((tier) => tier.id === value)
+ : undefined;
const triggerLabel =
selected?.name || value || t(($) => $.pickers.service_tier_default);
const triggerTitle = t(($) => $.pickers.service_tier_tooltip, {
@@ -125,7 +143,7 @@ function ServiceTierPicker({
</>
}
>
- {tiers.map((tier) => (
+ {availableTiers.map((tier) => (
<PickerItem
key={tier.id}
selected={tier.id === value}
diff --git a/packages/views/locales/en/agents.json b/packages/views/locales/en/agents.json
index 4d1c90df87..7872f933c1 100644
--- a/packages/views/locales/en/agents.json
+++ b/packages/views/locales/en/agents.json
@@ -245,6 +245,8 @@
"thinking_clear": "Follow CLI config",
"thinking_clear_title": "Clear the override and let the local CLI config (claude/codex) decide the reasoning level",
"service_tier_default": "Runtime default",
+ "service_tier_standard": "Standard",
+ "service_tier_standard_description": "Standard speed and standard usage",
"service_tier_tooltip": "Speed · {{value}}",
"service_tier_clear": "Runtime default",
"service_tier_clear_title": "Clear the speed override and let the local Codex configuration decide"
diff --git a/packages/views/locales/ja/agents.json b/packages/views/locales/ja/agents.json
index 2a6e20c3c7..64d1abcf3d 100644
--- a/packages/views/locales/ja/agents.json
+++ b/packages/views/locales/ja/agents.json
@@ -227,6 +227,8 @@
"thinking_clear": "CLI 設定に従う",
"thinking_clear_title": "上書きをクリアし、推論レベルをローカルの CLI 設定(claude/codex)に任せます",
"service_tier_default": "ランタイムのデフォルト",
+ "service_tier_standard": "標準",
+ "service_tier_standard_description": "通常速度と標準使用量",
"service_tier_tooltip": "速度 · {{value}}",
"service_tier_clear": "ランタイムのデフォルト",
"service_tier_clear_title": "速度の上書きをクリアし、ローカルの Codex 設定に任せます"
diff --git a/packages/views/locales/ko/agents.json b/packages/views/locales/ko/agents.json
index 80f07523fd..85ee26185a 100644
--- a/packages/views/locales/ko/agents.json
+++ b/packages/views/locales/ko/agents.json
@@ -235,6 +235,8 @@
"thinking_clear": "CLI 설정 따르기",
"thinking_clear_title": "재정의를 지우고 추론 수준을 로컬 CLI 설정(claude/codex)에 맡깁니다",
"service_tier_default": "런타임 기본값",
+ "service_tier_standard": "표준",
+ "service_tier_standard_description": "기본 속도 및 표준 사용량",
"service_tier_tooltip": "속도 · {{value}}",
"service_tier_clear": "런타임 기본값",
"service_tier_clear_title": "속도 재정의를 지우고 로컬 Codex 설정에 맡깁니다"
diff --git a/packages/views/locales/zh-Hans/agents.json b/packages/views/locales/zh-Hans/agents.json
index b53ff153f5..c589034626 100644
--- a/packages/views/locales/zh-Hans/agents.json
+++ b/packages/views/locales/zh-Hans/agents.json
@@ -235,6 +235,8 @@
"thinking_clear": "跟随 CLI 配置",
"thinking_clear_title": "清除覆盖,让本地 CLI(claude/codex)的配置决定推理级别",
"service_tier_default": "运行时默认",
+ "service_tier_standard": "标准速度",
+ "service_tier_standard_description": "明确使用标准速度和标准用量",
"service_tier_tooltip": "速度 · {{value}}",
"service_tier_clear": "运行时默认",
"service_tier_clear_title": "清除速度覆盖,交由本地 Codex 配置决定"
diff --git a/server/cmd/multica/cmd_agent.go b/server/cmd/multica/cmd_agent.go
index ca31ae6d8f..0e75ad9462 100644
--- a/server/cmd/multica/cmd_agent.go
+++ b/server/cmd/multica/cmd_agent.go
@@ -164,7 +164,7 @@ func init() {
agentCreateCmd.Flags().String("runtime-config", "", "Runtime config as JSON string")
agentCreateCmd.Flags().String("model", "", "Model identifier (e.g. claude-sonnet-4-6, openai/gpt-4o). Prefer this over passing --model in --custom-args.")
agentCreateCmd.Flags().String("thinking-level", "", "Reasoning/effort level for the agent's runtime (e.g. Claude: low|medium|high|xhigh|max; Codex values come from the runtime model catalog). The set is runtime/model-specific; malformed values are rejected server-side and the daemon validates the exact model/level pair. Some runtimes (e.g. hermes) expose no reasoning control and reject every value. Empty = runtime default.")
- agentCreateCmd.Flags().String("service-tier", "", "Codex execution service tier from the selected model's runtime catalog (e.g. priority, displayed as Fast). Empty = inherit local Codex configuration.")
+ agentCreateCmd.Flags().String("service-tier", "", "Codex execution speed: empty = inherit local Codex configuration; default = explicit Standard when supported by the daemon's installed Codex CLI; a catalog tier such as priority = explicit Fast.")
agentCreateCmd.Flags().String("custom-args", "", "Custom CLI arguments as JSON array. For model selection prefer --model; some providers (codex app-server, openclaw) reject --model in custom_args.")
agentCreateCmd.Flags().String("custom-env", "", "Custom environment variables as JSON object, e.g. '{\"KEY\":\"value\"}'. Treated as secret material — never logged by the CLI, but values passed on the command line are visible to shell history and 'ps'; prefer --custom-env-stdin or --custom-env-file for real secrets. Pass '{}' to set an empty map.")
agentCreateCmd.Flags().Bool("custom-env-stdin", false, "Read the --custom-env JSON object from stdin. Keeps secrets out of shell history and 'ps'. Mutually exclusive with --custom-env and --custom-env-file.")
@@ -187,7 +187,7 @@ func init() {
agentUpdateCmd.Flags().String("runtime-config", "", "New runtime config as JSON string")
agentUpdateCmd.Flags().String("model", "", "New model identifier. Pass an empty string to clear and fall back to the runtime default.")
agentUpdateCmd.Flags().String("thinking-level", "", "New reasoning/effort level for the agent's runtime (e.g. Claude: low|medium|high|xhigh|max; Codex values come from the runtime model catalog). The set is runtime/model-specific; malformed values are rejected server-side and the daemon validates the exact model/level pair. Some runtimes (e.g. hermes) expose no reasoning control and reject every value. Pass an empty string to clear and fall back to the runtime default.")
- agentUpdateCmd.Flags().String("service-tier", "", "New Codex execution service tier from the selected model's runtime catalog. Pass an empty string to clear and inherit local Codex configuration.")
+ agentUpdateCmd.Flags().String("service-tier", "", "New Codex execution speed: default = explicit Standard when supported by the daemon's installed Codex CLI; a catalog tier such as priority = explicit Fast. Pass an empty string to clear and inherit local Codex configuration.")
agentUpdateCmd.Flags().String("custom-args", "", "New custom CLI arguments as JSON array. For model selection prefer --model; some providers (codex app-server, openclaw) reject --model in custom_args.")
// custom_env is intentionally NOT part of `agent update`. Use
// `multica agent env set <id>` — that path admits the agent owner or a
diff --git a/server/cmd/multica/cmd_agent_test.go b/server/cmd/multica/cmd_agent_test.go
index f77284a35f..46cd6e12b5 100644
--- a/server/cmd/multica/cmd_agent_test.go
+++ b/server/cmd/multica/cmd_agent_test.go
@@ -1966,6 +1966,16 @@ func TestAgentServiceTierFlagsAndBodies(t *testing.T) {
if agentUpdateCmd.Flag("service-tier") == nil {
t.Error("agent update must expose --service-tier")
}
+ for name, usage := range map[string]string{
+ "create": agentCreateCmd.Flag("service-tier").Usage,
+ "update": agentUpdateCmd.Flag("service-tier").Usage,
+ } {
+ for _, contract := range []string{"empty", "default", "Standard", "priority", "Fast"} {
+ if !strings.Contains(usage, contract) {
+ t.Errorf("agent %s --service-tier help = %q, want three-state contract to mention %q", name, usage, contract)
+ }
+ }
+ }
t.Run("create sends catalog id", func(t *testing.T) {
var gotBody map[string]any
diff --git a/server/internal/daemon/daemon.go b/server/internal/daemon/daemon.go
index 2d9143fe4c..86ebea8f2c 100644
--- a/server/internal/daemon/daemon.go
+++ b/server/internal/daemon/daemon.go
@@ -4185,20 +4185,22 @@ func (d *Daemon) handleModelList(ctx context.Context, rt Runtime, requestID stri
Description string `json:"description,omitempty"`
}
type modelWire struct {
- ID string `json:"id"`
- Label string `json:"label"`
- Provider string `json:"provider,omitempty"`
- Default bool `json:"default,omitempty"`
- Thinking *modelThinkingWire `json:"thinking,omitempty"`
- ServiceTiers []modelServiceTierWire `json:"service_tiers,omitempty"`
+ ID string `json:"id"`
+ Label string `json:"label"`
+ Provider string `json:"provider,omitempty"`
+ Default bool `json:"default,omitempty"`
+ Thinking *modelThinkingWire `json:"thinking,omitempty"`
+ ServiceTiers []modelServiceTierWire `json:"service_tiers,omitempty"`
+ SupportsExplicitStandardServiceTier bool `json:"supports_explicit_standard_service_tier,omitempty"`
}
wire := make([]modelWire, 0, len(models))
for _, m := range models {
entry := modelWire{
- ID: m.ID,
- Label: m.Label,
- Provider: m.Provider,
- Default: m.Default,
+ ID: m.ID,
+ Label: m.Label,
+ Provider: m.Provider,
+ Default: m.Default,
+ SupportsExplicitStandardServiceTier: m.SupportsExplicitStandardServiceTier,
}
if m.Thinking != nil {
levels := make([]thinkingLevelWire, 0, len(m.Thinking.SupportedLevels))
diff --git a/server/internal/daemon/model_list_binary_test.go b/server/internal/daemon/model_list_binary_test.go
index 71646ba24a..80ef724e54 100644
--- a/server/internal/daemon/model_list_binary_test.go
+++ b/server/internal/daemon/model_list_binary_test.go
@@ -58,7 +58,11 @@ func newModelListFixture(t *testing.T) *modelListFixture {
fx.listedPrefix = append([]string(nil), runtimeCmd.Prefix...)
fx.listCalls++
fx.mu.Unlock()
- return agent.Catalog{Models: []agent.Model{{ID: "m-1", Label: "M 1"}}}, nil
+ return agent.Catalog{Models: []agent.Model{{
+ ID: "m-1",
+ Label: "M 1",
+ SupportsExplicitStandardServiceTier: true,
+ }}}, nil
}
t.Cleanup(func() { listModels = orig })
@@ -174,6 +178,30 @@ func TestHandleModelList_BuiltinRuntimeUnaffected(t *testing.T) {
}
}
+func TestHandleModelListReportsExplicitStandardCapability(t *testing.T) {
+ fx := newModelListFixture(t)
+ d := fx.daemon
+
+ builtinPath := fakeExecutable(t, "codex")
+ d.cfg.Agents = map[string]AgentEntry{"codex": {Path: builtinPath}}
+ d.runtimeIndex["rt-builtin"] = Runtime{ID: "rt-builtin", Provider: "codex"}
+
+ d.handleModelList(context.Background(), d.runtimeIndex["rt-builtin"], "req-1")
+
+ _, _, _, report := fx.snapshot()
+ models, ok := report["models"].([]any)
+ if !ok || len(models) != 1 {
+ t.Fatalf("report models = %T %v, want one model", report["models"], report["models"])
+ }
+ model, ok := models[0].(map[string]any)
+ if !ok {
+ t.Fatalf("reported model = %T %v, want object", models[0], models[0])
+ }
+ if got := model["supports_explicit_standard_service_tier"]; got != true {
+ t.Fatalf("reported capability = %v, want true (model: %v)", got, model)
+ }
+}
+
// TestHandleModelList_NoProfileAndNoBuiltinStillFails pins that the failure
// message survives for the case it was actually written for: a built-in runtime
// whose provider has no agent entry on this host.
diff --git a/server/internal/handler/runtime_models.go b/server/internal/handler/runtime_models.go
index 2de306cea6..840c84cee9 100644
--- a/server/internal/handler/runtime_models.go
+++ b/server/internal/handler/runtime_models.go
@@ -89,12 +89,13 @@ type ModelListRequest struct {
// field, which is fine: the UI hides the selector and the agent runs
// with the runtime default.
type ModelEntry struct {
- ID string `json:"id"`
- Label string `json:"label"`
- Provider string `json:"provider,omitempty"`
- Default bool `json:"default,omitempty"`
- Thinking *ModelThinking `json:"thinking,omitempty"`
- ServiceTiers []ModelServiceTier `json:"service_tiers,omitempty"`
+ ID string `json:"id"`
+ Label string `json:"label"`
+ Provider string `json:"provider,omitempty"`
+ Default bool `json:"default,omitempty"`
+ Thinking *ModelThinking `json:"thinking,omitempty"`
+ ServiceTiers []ModelServiceTier `json:"service_tiers,omitempty"`
+ SupportsExplicitStandardServiceTier bool `json:"supports_explicit_standard_service_tier,omitempty"`
}
type ModelServiceTier struct {
diff --git a/server/internal/handler/runtime_models_test.go b/server/internal/handler/runtime_models_test.go
index 61598ce881..b9e5b33b08 100644
--- a/server/internal/handler/runtime_models_test.go
+++ b/server/internal/handler/runtime_models_test.go
@@ -75,7 +75,7 @@ func TestReportModelListResult_PreservesDefault(t *testing.T) {
"status": "completed",
"supported": true,
"models": []map[string]any{
- {"id": "foo-default", "label": "Foo", "provider": "p", "default": true},
+ {"id": "foo-default", "label": "Foo", "provider": "p", "default": true, "supports_explicit_standard_service_tier": true},
{"id": "bar", "label": "Bar", "provider": "p"},
},
}
@@ -108,6 +108,9 @@ func TestReportModelListResult_PreservesDefault(t *testing.T) {
if !got.Models[0].Default {
t.Errorf("first model should carry Default=true, got %+v", got.Models[0])
}
+ if !got.Models[0].SupportsExplicitStandardServiceTier {
+ t.Errorf("first model should carry explicit-standard capability, got %+v", got.Models[0])
+ }
if got.Models[1].Default {
t.Errorf("second model should carry Default=false, got %+v", got.Models[1])
}
@@ -118,6 +121,9 @@ func TestReportModelListResult_PreservesDefault(t *testing.T) {
if !bytes.Contains(out, []byte(`"default":true`)) {
t.Errorf(`expected "default":true in JSON response, got: %s`, out)
}
+ if !bytes.Contains(out, []byte(`"supports_explicit_standard_service_tier":true`)) {
+ t.Errorf("expected explicit-standard capability in JSON response, got: %s", out)
+ }
}
// TestReportModelListResult_DecodesJSONBodyDefault verifies the
@@ -126,7 +132,7 @@ func TestReportModelListResult_PreservesDefault(t *testing.T) {
func TestReportModelListResult_DecodesJSONBodyDefault(t *testing.T) {
// Simulate the shape the daemon POSTs: status + models + supported
// with `default` on one entry.
- payload := `{"status":"completed","supported":true,"models":[{"id":"a","label":"A","default":true},{"id":"b","label":"B"}]}`
+ payload := `{"status":"completed","supported":true,"models":[{"id":"a","label":"A","default":true,"supports_explicit_standard_service_tier":true},{"id":"b","label":"B"}]}`
r := httptest.NewRequest(http.MethodPost, "/api/daemon/runtimes/rt/models/req/result", bytes.NewBufferString(payload))
var body struct {
@@ -143,6 +149,9 @@ func TestReportModelListResult_DecodesJSONBodyDefault(t *testing.T) {
if !body.Models[0].Default {
t.Errorf("default flag lost on model[0]: %+v", body.Models[0])
}
+ if !body.Models[0].SupportsExplicitStandardServiceTier {
+ t.Errorf("explicit-standard capability lost on model[0]: %+v", body.Models[0])
+ }
}
// TestInMemoryModelListStore_HasPending pins the cheap probe used by the
diff --git a/server/internal/service/builtin_skills/multica-creating-agents/SKILL.md b/server/internal/service/builtin_skills/multica-creating-agents/SKILL.md
index 080993cdb4..e73c77fdca 100644
--- a/server/internal/service/builtin_skills/multica-creating-agents/SKILL.md
+++ b/server/internal/service/builtin_skills/multica-creating-agents/SKILL.md
@@ -128,7 +128,7 @@ multica agent copy <source-agent-id> --runtime-id <target> --model <model> # cr
| `runtime_id` | `agent.runtime_id` (nullable) | required at create (400) + must resolve to a runtime in this workspace | selects runtime/provider; `NULL` means unbound — see below |
| `model` | `agent.model` (nullable) | none beyond runtime support | daemon reads; empty = runtime default |
| `thinking_level` | `agent.thinking_level` (nullable) | provider-level enum/safe-token gate; unknown literal → 400. Pi accepts only `off|minimal|low|medium|high|xhigh|max`, then the daemon checks the selected model's RPC-discovered subset. ACP runtimes that advertise an effort selector in `session/new` (currently `reasonix` and `hermes`) take the safe-token path and are checked against the discovered catalog by the daemon; that catalog covers only the model the discovery session was on, so other models show no picker until per-model probing exists. `hermes` covers two binaries — jcode advertises and applies an effort, Hermes Agent advertises none and gets no picker — so the answer there comes from the runtime's discovered catalog, not the provider name. Because that catalog is only written once a client requests a model list, a `hermes` runtime that has never been discovered is refused with a distinct "has not reported a model catalog yet" 400 rather than being assumed capable; `reasonix`, whose provider name does determine the binary, is allowed in that state. A runtime with no reasoning control at all (e.g. `copilot`, which executes outside ACP) rejects EVERY non-empty value and says so — that 400 is a capability answer, not a bad token | daemon; empty = runtime default |
-| `service_tier` | `agent.service_tier` (nullable) | Codex-only safe token; other providers reject; exact model/tier pair checked by daemon | daemon → Codex app-server; empty = local Codex config |
+| `service_tier` | `agent.service_tier` (nullable) | Codex-only safe token; other providers reject; daemon checks either the explicit-standard capability or the exact model/catalog-tier pair | daemon → Codex app-server; empty = local Codex config, `default` = explicit Standard, catalog tier such as `priority` = explicit Fast |
| `custom_args` | `agent.custom_args` (JSON array) | JSON shape checked CLI-side; server stores as-is | daemon (extra CLI switches); defaults to `[]` |
| `runtime_config` | `agent.runtime_config` (JSON) | JSON shape checked CLI-side; server stores as-is | runtime-specific config; defaults to `{}` |
| `custom_env` | `agent.custom_env` (JSON object) | — | daemon (process env); see Env & secrets |
@@ -170,13 +170,24 @@ provider's fixed-enum or safe-token gate, and the daemon performs the exact
model/level check. A runtime whose provider has no thinking concept rejects any
non-empty value with a 400.
-`service_tier` is the matching first-class Codex speed control. Set it with
-`--service-tier <catalog-id>` on create/update; use `--service-tier ""` on
-update to clear it. The runtime model catalog owns both availability and
-display copy (currently `priority`, shown as Fast). The server accepts safe
-future Codex catalog IDs, while the daemon verifies the exact model/tier pair
-before execution and omits a stale incompatible override. Agents without an
-explicit model fail closed because the effective config.toml model is unknown.
+`service_tier` is the matching first-class Codex speed control. It has three
+distinct states:
+
+- empty means inherit the local Codex configuration;
+- `default` means explicitly use Standard routing;
+- a runtime catalog tier such as `priority` means explicitly use Fast.
+
+Set it with `--service-tier <value>` on create/update; use
+`--service-tier ""` on update to clear it. The picker offers `default` only
+when the daemon reports that its installed Codex CLI supports the request-only
+explicit-standard sentinel (Codex 0.133.0+). A missing capability from an older
+daemon is treated as unsupported. The runtime model catalog owns availability
+and display copy for alternative tiers. The server accepts safe future Codex
+values, while the daemon verifies the explicit-standard capability or exact
+model/catalog-tier pair before execution and omits a stale incompatible
+override. An alternative catalog tier on an agent without an explicit model
+still fails closed because the effective config.toml model is unknown;
+`default` is model-independent once the runtime capability is known.
### conversation_starters
diff --git a/server/internal/service/builtin_skills/multica-creating-agents/references/creating-agents-source-map.md b/server/internal/service/builtin_skills/multica-creating-agents/references/creating-agents-source-map.md
index 591d49062d..95ac29c16c 100644
--- a/server/internal/service/builtin_skills/multica-creating-agents/references/creating-agents-source-map.md
+++ b/server/internal/service/builtin_skills/multica-creating-agents/references/creating-agents-source-map.md
@@ -18,11 +18,11 @@ go test ./internal/service -run TestBuiltinSkillsConformToTemplate
| Contract | Line | Behavior | Safe check |
|---|---|---|---|
| Create flags: `name`, `description`, `instructions`, `runtime-id` | 160–163 | Registered create flags; `name`/`runtime-id` enforced in `runAgentCreate` | `multica agent create --help` |
-| `runtime-config`, `model`, `thinking-level`, `service-tier`, `custom-args` flags | 164–168 | `model` help: "Prefer this over passing --model in --custom-args"; thinking and Codex service-tier values are thin catalog-owned pass-throughs, with exact model compatibility checked by the daemon; empty = runtime default | `multica agent create --help` |
+| `runtime-config`, `model`, `thinking-level`, `service-tier`, `custom-args` flags | 164–168 | `model` help: "Prefer this over passing --model in --custom-args"; Codex speed documents three states: empty = inherit local config, `default` = explicit Standard when the installed CLI capability is reported, catalog tier such as `priority` = explicit Fast | `multica agent create --help` |
| Secret-safe env input: `custom-env`, `custom-env-stdin`, `custom-env-file` | 169–171 | `--custom-env` warns about shell history / `ps`; stdin and file modes keep secrets off the command line; mutually exclusive | `multica agent create --help` |
| Secret-safe MCP input: `mcp-config`, `mcp-config-stdin`, `mcp-config-file` (create) | 172–174 | Same three-channel pattern as `custom-env`; `--mcp-config` warns about shell history / `ps`; value must be a JSON object or `null` | `multica agent create --help` |
| MCP flags on `agent update` | 200–202 | Same three channels on update; `--mcp-config null` clears. Unlike `custom_env`, `mcp_config` IS settable via update | `multica agent update --help` |
-| `thinking-level` / `service-tier` flags on `agent update` | 189–190 | Thin pass-throughs; an explicit empty string clears the saved override and restores the runtime/local Codex default | `multica agent update --help` |
+| `thinking-level` / `service-tier` flags on `agent update` | 189–190 | Thin pass-throughs; `service-tier` repeats the empty / `default` / catalog-tier contract, and an explicit empty string clears the saved override and restores the runtime/local Codex default | `multica agent update --help` |
| `max-concurrent-tasks` flags + validation | `cmd_agent.go` 179, 208; `cmd_agent_validation.go` 5–20 | Shared CLI helper enforces 1–50; create/update call it before their HTTP mutation and omitted create flags stay absent | `multica agent create --help`; `multica agent update --help` |
| `runAgentCreate` builds body + `POST /api/agents` | 533–628 | Only sets a body key when the flag `Changed`; validates `max_concurrent_tasks` at 605–611, then posts to `/api/agents` (617) | read 533–628 |
| Body assembly: description/instructions/runtime-config/custom-args/custom-env/mcp-config/model/thinking-level/service-tier | 548–611 | `model`, `thinking_level`, and `service_tier` are `Changed`-gated pass-throughs; omitted flags are not sent | read the `runAgentCreate` body assembly |
@@ -60,7 +60,7 @@ go test ./internal/service -run TestBuiltinSkillsConformToTemplate
| `runtime_id` must resolve in workspace | 642–658 | parsed + `GetAgentRuntimeForWorkspace`; unknown → 400 "invalid runtime_id" |
| `thinking_level` provider-level validation | `agent.go` create/update paths | `!agent.IsKnownThinkingValue(runtime.Provider, req.ThinkingLevel)` → 400; fixed-vocabulary providers use an enum (Pi: `off|minimal|low|medium|high|xhigh|max`), Codex/OpenCode use safe-token syntax, and per-model gaps are deferred to daemon (MUL-2339) |
| `thinking_level` rejection copy | `agent.go` `thinkingLevelRejection` / `existingThinkingLevelRejection` | Splits "runtime has no reasoning control" from "unrecognised token" so a runtime-capability 400 does not read as a typo; both carry-over branches point at `thinking_level=""` (MUL-5770) |
-| `service_tier` provider-level validation | `agent.go` create/update paths | Non-empty values are Codex-only safe tokens; exact per-model support is daemon-owned |
+| `service_tier` provider-level validation | `agent.go` create/update paths | Non-empty values are Codex-only safe tokens; daemon owns the explicit-standard capability check and exact per-model catalog-tier validation |
| Defaults: `{}` config/env, `[]` args | 688–701 | `RuntimeConfig`→`{}`, `CustomEnv`→`{}`, `CustomArgs`→`[]` when nil, before insert |
| `visibility` default | 635–636 | `if req.Visibility == "" { req.Visibility = "private" }` — access-control field, not the runtime prompt |
| `max_concurrent_tasks` create/default validation | `agent.go`; `agent_validation.go`; `internal/agentconfig/concurrency.go` | Shared 1–50 validator; a missing or explicit `null` field defaults to 6, while an explicitly supplied numeric 0/out-of-range value returns 400 |
@@ -84,7 +84,7 @@ go test ./internal/service -run TestBuiltinSkillsConformToTemplate
| Codex model-list entry point | `models.go` 94–103 | `ListModels("codex")` uses cached daemon-local discovery instead of returning the fallback catalog unconditionally |
| Codex fallback catalog | `models.go` 301–354 | Used for Codex <0.122.0 and failed/malformed discovery; includes current verified visible models plus legacy `gpt-5.3-codex`, with a separate `Thinking` catalog on every model |
| Codex discovery version gate | `thinking.go` 280, 306–337 | `codex debug models --bundled` is used only for parseable versions ≥0.122.0; unsupported versions and command/parse/empty failures return the static model + thinking fallback |
-| Codex catalog projection | `thinking.go` `parseCodexModelCatalog` | Hidden models are excluded; visible model, reasoning, and `service_tiers` metadata are preserved |
+| Codex catalog projection | `thinking.go` `parseCodexModelCatalog` / `annotateCodexExplicitStandardServiceTier` | Hidden models are excluded; visible model, reasoning, and `service_tiers` metadata are preserved. Codex 0.133.0+ entries also carry `supports_explicit_standard_service_tier=true`; older daemon responses omit the additive field, which the UI treats as false |
| Pi RPC model/thinking discovery | `models.go` `discoverPiModelsRPC` / `piThinkingFromRPCModel` | Starts an ephemeral `pi --mode rpc --no-session` process, requests `get_state` + `get_available_models`, preserves extension-registered providers, marks the current model as Default, and mirrors Pi's exact per-model `reasoning` / `thinkingLevelMap` rules. Older/forked Pi falls back to `--list-models` with no guessed thinking catalog. |
| Pi invocation effort | `pi.go` `buildPiArgs` / `piBlockedArgs` | A non-empty persisted value becomes `--thinking <level>`; custom `--thinking` flags are filtered so the first-class field is the sole owner. |
| Per-model thinking validation | `thinking.go` `ValidateThinkingLevel` | Accepts only values in the explicit model's `Thinking.SupportedLevels`; Pi empty-model validation resolves to the RPC current-model Default, while an empty Codex model fails closed because its effective `config.toml` model is unknown. |
@@ -95,7 +95,7 @@ go test ./internal/service -run TestBuiltinSkillsConformToTemplate
| ACP effort application | `acp_effort.go` `applyACPEffortOption` | Sends `session/set_config_option` with the id the session advertised, then re-reads `currentValue`. The read-back proves only that the session reports the new value — not that the runtime threaded it into its provider request; it catches Kimi ≤0.28.1 confirming `on` after being set to `max`. Failures warn and let the prompt through rather than failing the task. `stateIsCurrent=false` after a model switch skips the local vocabulary check, because the advertised list then describes the previous model |
| ACP capability is per runtime, not per provider | `agent.go` `acpThinkingDecision` / `ambiguousACPEffortProviders` | Three-state, consulted on create and both update branches. Catalog advertises an effort → allow; catalog advertises none → capability 400; **no catalog yet** → 400 for ambiguous providers only (`hermes`), because the cache is written solely by `ReportModelListResult`, so a CLI-only caller stays undiscovered indefinitely and "unknown" must not be read as "supported". `reasonix` is unambiguous and stays allowed while undiscovered |
| ACP effort opt-in | `thinking.go` `acpCatalogThinkingProviders` | A runtime joins only when its `Execute` calls `applyACPEffortOption` AND someone has confirmed from source or a real run that it acts on the setting — currently `reasonix` and `hermes` (GitHub #6720). This list, not the read-back, is where that verification is recorded. `hermes` is the case that shows why the catalog rather than a version gate decides: jcode advertises `reasoning_effort` and threads it into the provider request (verified v0.71.1/v0.73.0), Hermes Agent advertises no configOptions at all (re-verified v0.20.0, 2026-08-11), and both run under the same provider type. Speaking ACP is not sufficient: Copilot discovers over ACP but executes through its own CLI, so a catalog there would render a picker with nothing behind it |
-| Per-model service-tier validation | `thinking.go` `ValidateServiceTier` | Accepts only a tier advertised for the explicit Codex model; empty model fails closed because config.toml is unknown |
+| Service-tier validation | `thinking.go` `ValidateServiceTier` | Empty inherits local config. `default` requires the daemon-discovered explicit-standard capability and is model-independent; alternative tiers require the explicit Codex model to advertise the exact id, so an empty model fails closed because config.toml is unknown |
| Daemon invalid-combination handling | `internal/daemon/daemon.go` 3860–3892 | Before execution, invalid `(provider, model, thinking_level)` combinations log a warning and omit the override rather than failing the task |
## Env endpoint — `server/internal/handler/agent_env.go`
diff --git a/server/pkg/agent/agent.go b/server/pkg/agent/agent.go
index 6f1f2a093e..3ddb16a5e1 100644
--- a/server/pkg/agent/agent.go
+++ b/server/pkg/agent/agent.go
@@ -105,7 +105,8 @@ type ExecOptions struct {
// incrementally without breaking unrelated agents).
ThinkingLevel string
// ServiceTier is a runtime-native Codex execution tier (for example
- // "priority", displayed as Fast). Empty means inherit local Codex config.
+ // "priority", displayed as Fast). "default" explicitly selects standard
+ // routing; empty means inherit local Codex config.
// Other providers ignore this field.
ServiceTier string
// OpenclawMode chooses between local (embedded) and gateway routing for
diff --git a/server/pkg/agent/codex.go b/server/pkg/agent/codex.go
index 325ea71927..81d63881ee 100644
--- a/server/pkg/agent/codex.go
+++ b/server/pkg/agent/codex.go
@@ -34,8 +34,9 @@ var codexBlockedArgs = map[string]blockedArgMode{
}
const (
- codexFastServiceTier = "priority"
- codexFastModeFeature = "fast_mode"
+ codexFastServiceTier = "priority"
+ codexStandardServiceTier = "default"
+ codexFastModeFeature = "fast_mode"
)
// codexStderrTailBytes bounds the stderr tail captured for inclusion in
diff --git a/server/pkg/agent/models.go b/server/pkg/agent/models.go
index a2a76eda71..ee84d25595 100644
--- a/server/pkg/agent/models.go
+++ b/server/pkg/agent/models.go
@@ -31,11 +31,12 @@ import (
// default, which is always closer to what the user's account /
// environment actually supports than a static guess here.
type Model struct {
- ID string `json:"id"`
- Label string `json:"label"`
- Provider string `json:"provider,omitempty"`
- Default bool `json:"default,omitempty"`
- ServiceTiers []ModelServiceTier `json:"service_tiers,omitempty"`
+ ID string `json:"id"`
+ Label string `json:"label"`
+ Provider string `json:"provider,omitempty"`
+ Default bool `json:"default,omitempty"`
+ ServiceTiers []ModelServiceTier `json:"service_tiers,omitempty"`
+ SupportsExplicitStandardServiceTier bool `json:"supports_explicit_standard_service_tier,omitempty"`
// Thinking advertises the runtime's reasoning/effort catalog for this
// model. nil means the runtime/model has no thinking-level control
// (or the daemon couldn't discover one); the UI hides its picker. The
diff --git a/server/pkg/agent/thinking.go b/server/pkg/agent/thinking.go
index c313325b80..b9a85f3a4c 100644
--- a/server/pkg/agent/thinking.go
+++ b/server/pkg/agent/thinking.go
@@ -282,7 +282,12 @@ var codexEffortLabel = map[string]string{
"ultra": "Ultra",
}
-const minCodexDebugModelsVersion = "0.122.0"
+const (
+ minCodexDebugModelsVersion = "0.122.0"
+ // Codex 0.133.0 is the first stable release containing the request-only
+ // `default` sentinel added by openai/codex#23537.
+ minCodexExplicitStandardServiceTierVersion = "0.133.0"
+)
// codexDebugModelsResponse mirrors the JSON shape emitted by
// `codex debug models --bundled` (Codex 0.122.0+). Only the fields we
@@ -320,33 +325,55 @@ func discoverCodexModels(ctx context.Context, cmd Command) []Model {
cmd.Path = "codex"
}
version, err := DetectVersion(ctx, cmd)
- if err != nil || !codexSupportsDebugModels(version) {
+ if err != nil {
return codexStaticModels()
}
+ supportsExplicitStandard := codexSupportsExplicitStandardServiceTier(version)
+ if !codexSupportsDebugModels(version) {
+ return annotateCodexExplicitStandardServiceTier(codexStaticModels(), supportsExplicitStandard)
+ }
raw, err := runCodexDebugModels(ctx, cmd)
if err != nil {
- return codexStaticModels()
+ return annotateCodexExplicitStandardServiceTier(codexStaticModels(), supportsExplicitStandard)
}
models, err := parseCodexModelCatalog(raw)
if err != nil || len(models) == 0 {
- return codexStaticModels()
+ return annotateCodexExplicitStandardServiceTier(codexStaticModels(), supportsExplicitStandard)
}
- return models
+ return annotateCodexExplicitStandardServiceTier(models, supportsExplicitStandard)
}
func codexSupportsDebugModels(version string) bool {
+ return codexVersionAtLeast(version, minCodexDebugModelsVersion)
+}
+
+func codexSupportsExplicitStandardServiceTier(version string) bool {
+ return codexVersionAtLeast(version, minCodexExplicitStandardServiceTierVersion)
+}
+
+func codexVersionAtLeast(version, minimumVersion string) bool {
parsed, err := parseSemver(version)
if err != nil {
return false
}
- minimum, err := parseSemver(minCodexDebugModelsVersion)
+ minimum, err := parseSemver(minimumVersion)
if err != nil {
return false
}
return !parsed.lessThan(minimum)
}
+func annotateCodexExplicitStandardServiceTier(models []Model, supported bool) []Model {
+ if !supported {
+ return models
+ }
+ for i := range models {
+ models[i].SupportsExplicitStandardServiceTier = true
+ }
+ return models
+}
+
// codexDebugModelsArgs is the argv we pass to discover the local Codex
// catalog. Kept as a package-level var (not a literal at the call site)
// so tests can assert the exact form a real `codex` invocation receives,
@@ -694,8 +721,10 @@ func ValidateThinkingLevelWith(loadCatalog func() (Catalog, error), providerType
// ValidateServiceTier reports whether value is advertised by the current
// Codex catalog for the explicit model. An empty value is always valid and
-// means "inherit runtime configuration". An empty Codex model fails closed:
-// its effective model comes from config.toml and may not support the tier.
+// means "inherit runtime configuration". Codex's "default" sentinel is valid
+// only when the daemon's installed CLI reports support for explicit standard
+// routing. An empty Codex model otherwise fails closed because its effective
+// model comes from config.toml and may not support the requested tier.
func ValidateServiceTier(ctx context.Context, providerType string, cmd Command, model, value string) (bool, error) {
return ValidateServiceTierWith(catalogLoader(ctx, providerType, cmd), providerType, model, value)
}
@@ -706,13 +735,24 @@ func ValidateServiceTierWith(loadCatalog func() (Catalog, error), providerType,
if value == "" {
return true, nil
}
- if providerType != "codex" || model == "" {
+ if providerType != "codex" {
+ return false, nil
+ }
+ if value != codexStandardServiceTier && model == "" {
return false, nil
}
catalog, err := loadCatalog()
if err != nil {
return false, err
}
+ if value == codexStandardServiceTier {
+ for _, candidate := range catalog.Models {
+ if candidate.SupportsExplicitStandardServiceTier {
+ return true, nil
+ }
+ }
+ return false, nil
+ }
for _, m := range catalog.Models {
if m.ID != model {
continue
diff --git a/server/pkg/agent/thinking_test.go b/server/pkg/agent/thinking_test.go
index 2738818568..2b1b7ffb71 100644
--- a/server/pkg/agent/thinking_test.go
+++ b/server/pkg/agent/thinking_test.go
@@ -231,6 +231,23 @@ func TestCodexSupportsDebugModels(t *testing.T) {
}
}
+func TestCodexSupportsExplicitStandardServiceTier(t *testing.T) {
+ t.Parallel()
+ for _, tc := range []struct {
+ version string
+ want bool
+ }{
+ {"codex-cli 0.132.0", false},
+ {"codex-cli 0.133.0", true},
+ {"codex-cli 0.144.1", true},
+ {"invalid", false},
+ } {
+ if got := codexSupportsExplicitStandardServiceTier(tc.version); got != tc.want {
+ t.Errorf("codexSupportsExplicitStandardServiceTier(%q) = %v, want %v", tc.version, got, tc.want)
+ }
+ }
+}
+
func TestParseCodexModelCatalog(t *testing.T) {
t.Parallel()
raw := []byte(`{
@@ -349,6 +366,9 @@ echo '{"models":[{"slug":"runtime-model","display_name":"Runtime Model","visibil
if len(got) != 1 || got[0].ID != "runtime-model" || got[0].Thinking == nil || !hasThinkingLevel(got[0].Thinking, "high") {
t.Fatalf("expected runtime catalog, got %+v", got)
}
+ if got[0].SupportsExplicitStandardServiceTier {
+ t.Fatalf("Codex 0.122.0 must not advertise explicit-standard support: %+v", got[0])
+ }
})
t.Run("old version uses static fallback", func(t *testing.T) {
@@ -363,6 +383,9 @@ echo '{"models":[{"slug":"runtime-model","display_name":"Runtime Model","visibil
if len(got) == 0 || got[0].ID != "gpt-5.6-sol" {
t.Fatalf("expected static fallback, got %+v", got)
}
+ if got[0].SupportsExplicitStandardServiceTier {
+ t.Fatalf("old Codex must not advertise explicit-standard support: %+v", got[0])
+ }
})
t.Run("debug command failure uses static fallback", func(t *testing.T) {
@@ -377,6 +400,9 @@ echo '{"models":[{"slug":"runtime-model","display_name":"Runtime Model","visibil
if len(got) == 0 || got[0].ID != "gpt-5.6-sol" || got[0].Thinking == nil {
t.Fatalf("expected model + thinking fallback, got %+v", got)
}
+ if !got[0].SupportsExplicitStandardServiceTier {
+ t.Fatalf("supported Codex version must retain explicit-standard capability through catalog fallback: %+v", got[0])
+ }
})
}
@@ -957,6 +983,10 @@ func writeFakeClaudePreEffortHelpBinary(t *testing.T) string {
// string for any other invocation (DetectVersion's probe). Used to exercise
// ValidateThinkingLevel against a real per-model catalog without a codex install.
func writeFakeCodexModelsBinary(t *testing.T) string {
+ return writeFakeCodexModelsBinaryVersion(t, "0.144.1")
+}
+
+func writeFakeCodexModelsBinaryVersion(t *testing.T, version string) string {
t.Helper()
dir := t.TempDir()
path := filepath.Join(dir, "codex")
@@ -971,11 +1001,29 @@ func writeFakeCodexModelsBinary(t *testing.T) string {
"EOF\n" +
"exit 0\n" +
"fi\n" +
- "echo 'codex-cli 0.144.1'\n"
+ "echo 'codex-cli " + version + "'\n"
writeTestExecutable(t, path, []byte(script))
return path
}
+func TestValidateServiceTierRejectsExplicitStandardForOldCodex(t *testing.T) {
+ if runtime.GOOS == "windows" {
+ t.Skip("shell-script fake binary requires a POSIX shell")
+ }
+ t.Parallel()
+ fake := writeFakeCodexModelsBinaryVersion(t, "0.132.0")
+
+ for _, model := range []string{"gpt-5.6-sol", ""} {
+ got, err := ValidateServiceTier(context.Background(), "codex", Command{Path: fake}, model, "default")
+ if err != nil {
+ t.Fatalf("ValidateServiceTier with old Codex: %v", err)
+ }
+ if got {
+ t.Errorf("old Codex accepted explicit standard for model %q", model)
+ }
+ }
+}
+
func TestValidateServiceTierCodexPerModelCatalog(t *testing.T) {
t.Parallel()
fake := writeFakeCodexModelsBinary(t)
@@ -986,6 +1034,8 @@ func TestValidateServiceTierCodexPerModelCatalog(t *testing.T) {
want bool
}{
{provider: "codex", model: "gpt-5.6-sol", tier: "priority", want: true},
+ {provider: "codex", model: "gpt-5.6-sol", tier: "default", want: true},
+ {provider: "codex", model: "", tier: "default", want: true},
{provider: "codex", model: "gpt-5.6-luna", tier: "priority", want: false},
{provider: "codex", model: "", tier: "priority", want: false},
{provider: "claude", model: "gpt-5.6-sol", tier: "priority", want: false},
@@ -1215,7 +1265,7 @@ func TestApplyCodexReasoningEffort_PreservesPreExistingConfig(t *testing.T) {
func TestApplyCodexServiceTier_ThreePoints(t *testing.T) {
t.Parallel()
- for _, tier := range []string{"", "priority", "future-fast"} {
+ for _, tier := range []string{"", "default", "priority", "future-fast"} {
t.Run(tier, func(t *testing.T) {
for _, params := range []map[string]any{
{"model": "gpt-5.6-sol", "cwd": "/work"},