agent-orchestrator icon indicating copy to clipboard operation
agent-orchestrator copied to clipboard

bug(codex): project-pinned model missing from picker; off-catalog model + effort blocks spawn

Open ApexYash11 opened this issue 2 months ago • 3 comments

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):

  1. Account catalog lists only gpt-5.1; project pins gpt-5.4-mini.
  2. Call discoverCodexCatalog with that provider list.
  3. 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):

  1. Catalog contains only gpt-5.1; spawn requests Model: gpt-5.4-mini, Effort: high on HarnessCodex.
  2. resolveChatAgentConfig returns 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-server model/list results. There is no local-config merge (no equivalent of Claude's applyClaudeConfiguredDefault), and IsDefault comes from the account's Default flag only. A project-level Model pin outside the account list can never appear. (Identical on main and on PR #5208's ao/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 with ErrModelCapabilitiesUnavailable. Model alone passes through to codex --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), so CatalogFingerprint is binary-only — project model edits don't invalidate the cached catalog; and the service stale-on-error branch (service/agent/service.go, !isClaude arm) serves any cached list unconditionally on discovery failure.

Fix

  1. In discoverCodexCatalog, merge the request-scoped configured model into the normalized provider list (append if absent, mark IsDefault) — symmetric to the proposed Claude gateway fix in #5549.
  2. In resolveChatAgentConfig, treat an off-catalog Codex model as "capabilities unknown": proceed (clear effort with a warning, or pass through) instead of ErrModelCapabilitiesUnavailable, matching the CLI's own permissiveness. Product call either way — decide fail-open vs fail-closed explicitly.
  3. 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 --model passthrough).
  • 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)

ApexYash11 avatar Sep 20 '26 05:09 ApexYash11

@nikhilachale ^^ think similar to what you worked on

ronishrohan avatar Sep 27 '26 19:09 ronishrohan

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). resolveAgentConfigOnce no longer fails when the saved catalog doesn't list the model. It refreshes in the background and passes the model and effort to codex, 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's model/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.

nikhilachale avatar Nov 18 '26 04:11 nikhilachale

#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.

nikhilachale avatar Nov 19 '26 20:11 nikhilachale