netube's Codex Plus account showed a 922K context window on Routing.
922000 is models.dev's input limit for gpt-5.5, which is OpenAI's API's
window. Codex holds a ChatGPT plan's conversation to the context_window
its own list gives (272000).
There were two causes:
- codex_backend.go's end() took catalog.ContextOf(model) (models.dev) as
the window for a turn Codex sent natively. It now takes
provider.CodexWindow(user, slug), and falls back to models.dev's window
only when no list says. CodexWindow checks, in order: the window the
user set on the codex provider; the account's own live list; magpie's
Codex subscription's list; Codex CLI's models_cache.json.
- catalog.parseCodex dropped context_window, so until the live list was
fetched, a Codex subscription's models (catalog.Codex) fell back to
models.dev's 922K. That reached the Providers page and Routing
(WindowOf), the Entry.Context agents are told, and siwcWithCodex. It
now keeps Context.
Only Codex is affected. A provider on OpenAI's API that serves the same
id keeps models.dev's 922K, and both tests check that.
Tests:
- TestCodexNativeTurnTakesCodexWindow (gateway): a native turn's
Prompt.Window is 272000 from models_cache.json, 258000 from the
subscription's live list, and 400000 when the user sets it. An "oai"
provider's gpt-5.5 stays at 922000.
- TestCodexModelsTakeCodexWindow (provider): checks WindowOf, CodexWindow
(and 0 for an unlisted slug), and the catalog entry's Context, with an
OpenAI API provider kept at 922000.
Broken by hand:
- codex_backend reverted to ContextOf: the gateway test went red, with
922000 in all three cases.
- parseCodex's Context removed: the gateway test went red on its first
case, and the provider test went red on WindowOf 922000, CodexWindow 0
and the catalog entry 922000.
- Restored: both green.
Run:
- gofmt -l: clean.
- go vet: darwin, GOOS=linux -tags nogui, GOOS=windows -tags nogui.
- go test -tags nogui -timeout 45m ./... at 7660399a1+this: 64 packages
ok. internal/agent and internal/gateway hit the 45m timeout under a
load average of ~270. The running tests were 1s and 6s old
(TestReseatOff, TestClaudeCodeSeenOnAnyRoute), so this was slowness,
not a hang.
- Rerun at the rebased head with -timeout 90m: EXIT=0, 66 packages ok, none failed (agent 3761s, gateway 3105s), on cb05dc2d1+this.
- Rebased then onto 252bc61ce (84cd686af and 252bc61ce, internal/agent
only, none of these files): go build ./..., go vet of gateway, provider,
catalog and agent, and both new tests green there.