bug(codex): project-pinned model missing from picker; off-catalog model + effort blocks spawn
Bug
Codex picker drops a project-pinned model that is absent from the account catalog, and requesting effort with such a model hard-blocks spawn — even though codex --model <id> would accept it.
Source: chat triage | Reported by: triage from #5549 follow-up | Analyzed against: acaf5747d (pull skipped: working tree holds unrelated uncommitted project changes)
Confidence: High (both gaps reproduced with failing unit tests locally, Go 1.26.5, Windows)
Reproduction
Gap 1 — picker omission (temporary test, since removed):
- Account catalog lists only
gpt-5.1; project pinsgpt-5.4-mini. - Call
discoverCodexCatalogwith that provider list. - Actual: picker contains only
[{ID:gpt-5.1 ... IsDefault:true}]— the pinned model is absent and nothing marks it default.
Failure output:
--- FAIL: TestReproCodexPinnedModelMissingFromPicker
BUG REPRODUCED: project-pinned gpt-5.4-mini missing from picker: [{ID:gpt-5.1 Label:GPT 5.1 Provider: IsDefault:true Efforts:[] DefaultEffort:}]
Gap 2 — spawn blocked (temporary test, since removed):
- Catalog contains only
gpt-5.1; spawn requestsModel: gpt-5.4-mini, Effort: highonHarnessCodex. resolveChatAgentConfigreturns an error; no session starts.
Failure output:
--- FAIL: TestReproCodexOffCatalogModelWithEffortBlocked
BUG REPRODUCED: off-catalog pinned model + effort blocked: model capabilities unavailable for model "gpt-5.4-mini"
Live picker repro was not attempted (needs a running daemon plus the Electron new-task picker); the defect is fully determined by the two unit-level paths above, which use no credentials or network.
Root Cause
backend/internal/adapters/agent/modelcatalog/catalog.go:267-302(discoverCodexCatalog): the catalog is built exclusively from the app-servermodel/listresults. There is no local-config merge (no equivalent of Claude'sapplyClaudeConfiguredDefault), andIsDefaultcomes from the account'sDefaultflag only. A project-levelModelpin outside the account list can never appear. (Identical onmainand on PR #5208'sao/credential-validation— that PR does not touch this function.)backend/internal/session_manager/manager.go:1175-1176(resolveChatAgentConfig, Codex-only branch): when the resolved model has no catalog entry (selected == nil) and effort is set, spawn aborts withErrModelCapabilitiesUnavailable. Model alone passes through tocodex --model(backend/internal/adapters/agent/codex/codex.go:136,177), so only the model+effort combination fails.- Contributing: Codex is absent from
hasConfigDiscoverySource(modelcatalog/config.go:24-31), soCatalogFingerprintis binary-only — project model edits don't invalidate the cached catalog; and the service stale-on-error branch (service/agent/service.go,!isClaudearm) serves any cached list unconditionally on discovery failure.
Fix
- In
discoverCodexCatalog, merge the request-scoped configured model into the normalized provider list (append if absent, markIsDefault) — symmetric to the proposed Claude gateway fix in #5549. - In
resolveChatAgentConfig, treat an off-catalog Codex model as "capabilities unknown": proceed (clear effort with a warning, or pass through) instead ofErrModelCapabilitiesUnavailable, matching the CLI's own permissiveness. Product call either way — decide fail-open vs fail-closed explicitly. - Regression tests: off-catalog pin appears in picker and is marked default; off-catalog pin + effort spawns instead of erroring; signed-out discovery still serves stale rather than emptying the picker.
Impact
- Picker hides the user's configured Codex model whenever it falls outside the account list (cosmetic on its own — spawn without effort still works via
--modelpassthrough). - Spawn-blocking when that pinned model is combined with any effort level.
- Workaround exists (drop the effort selection, or pick an account-listed model), so not critical.
Related
- #5549 — Claude Code GLM proxy models missing from the picker (same bug class, provider-queried catalog ignoring local pins)
- PR #5208 — credential validation / provider-sourced picker work this was triaged against
- #5003 — Codex models missing when CLI lags (same subsystem, different cause)
- #4518 — Codex worker model mismatch failures (same subsystem, different cause)
@nikhilachale ^^ think similar to what you worked on
Status on main (1fc31db844, 2026-11-18): half fixed.
- Gap 2 (an off-catalog model plus effort blocks spawning) is fixed by #8119 (merged 2026-11-11).
resolveAgentConfigOnceno longer fails when the saved catalog doesn't list the model. It refreshes in the background and passes the model and effort tocodex, which makes the call. - Gap 1 (the picker drops a project-pinned model) is still open.
discoverCodexCatalog(backend/internal/adapters/agent/modelcatalog/catalog.go) still builds the list only from the account'smodel/list, so a pinned model outside that list never shows up or gets marked as the default.
I'm keeping this open for Gap 1 only.
#8725 fixes Gap 1. A model the project pins that the account's catalog doesn't list now appears in the new-task picker and in Project settings → Agents as a normal, selectable row, noted "Set for this project · Codex doesn't list it for this account". It's deliberately not marked unavailable: session_manager refuses to spawn a model with UnavailableReason, which would bring Gap 2 back, and Codex may still accept the model for some accounts.