Repository navigation
Description
What happened
2026-09-22, on feat/codex-login (PR #1336, head 03c17d67e on dev@17ae56d34). A conversation moved onto codex/gpt-5.5 after the Codex row in /connect connected. The status line kept the window of the model the conversation started on:
─ codex/gpt-5.5:auto · ◇ YOLO ───────── $0.00 · ⟲ 33% cached 9.6k/1.3M · 1% idle
The Codex model listing (GET /models?client_version=0.144.1 on the ChatGPT backend) says "context_window": 272000 for every model it lists. codeaf never reads that field, so a Codex model has no context length anywhere, and compaction keeps firing at a fraction of whatever window the previous model had — 1.3M here, 128k on a fresh session. On a long conversation that is a backend refusal for an over-long request instead of a compaction.
Replication
Deterministic (no model). codexauth.List against an httptest server whose /models answers one row with "slug": "gpt-5.5" and "context_window": 272000 (the shape internal/codexauth/models_test.go already fakes): the returned Model has no context length, and after config.ConnectCodex the remembered catalog row for gpt-5.5 has ContextLength == 0. Today codexauth.Model has no field to carry it.
Field (real models). A ChatGPT plan. codeaf connect codex, then codeaf chat in a workspace, /model codex/gpt-5.5, then /status: the context line shows the previous model's window (or 128k on a fresh session), never 272k. No money.
Where
List in internal/codexauth/models.go builds Model{ID: row.Slug} and drops context_window; FallbackModels in the same file carries ids only; ConnectCodex in internal/config/sources.go remembers the ids through catalog.Remember; windowFor and switchModel in internal/tui3/palette.go answer 0 for a model with no listed length and leave the session's window as it was.
The fix
A Codex model carries the listing's context_window as its context length, the fallback rows carry 272000 for the five known ids, and a switch onto a Codex model tells the session that window the way a switch onto any listed model does. The status line then reads …/272k on codex/gpt-5.5, and compaction fires from that figure.
Acceptance
- e2e: the fixture drive of the real binary (fake issuer + fake backend answering
context_window: 272000): after/connect→ Codex → sign-in, the status line oncodex/gpt-5.5shows272k, not the boot model's window. - e2e: the control — a switch onto an OpenRouter model with a listed length still shows that model's own window.
- Unit:
codexauth.Listkeepscontext_windowon each returned model;config.ConnectCodexremembers it;FallbackModelsrows carry272000. - The manual's model-and-cost page says what window a Codex model reports, and the change entry's
invalidatesnames the previous behaviour.
Found while verifying PR #1336's default-road /connect fix; not part of that PR.
Activity
chat: a Codex model carries its 272k window, and a Codex call row nam…