You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary
Caps GPT-5.5's effective context window at 272K tokens when requests are
routed through Codex OAuth, while preserving the public 1.05M API-key
context window.
Background
GPT-5.5's API metadata advertises a 1.05M context window, but the
ChatGPT/Codex OAuth route has a lower practical routing-layer limit. Mux
was using the API metadata everywhere, so OAuth-routed users could see
token meters and compaction thresholds that allowed prompts far beyond
the OAuth backend's cap.
Implementation
- Adds a Codex OAuth context-window override for `gpt-5.5`.
- Applies the override from shared effective context-limit logic only
when provider config indicates Codex OAuth is the active route.
- Keeps API-key-selected GPT-5.5 requests on the 1.05M public API limit.
- Routes token meter calculations through the same effective limit
helper used by compaction.
- Uses the safe provider config view for backend compaction checks so
env/file API-key source and OAuth presence metadata are visible.
Validation
- `bun test src/common/utils/compaction/contextLimit.test.ts
src/common/utils/tokens/tokenMeterUtils.test.ts`
- `bunx eslint src/common/constants/codexOAuth.ts
src/common/utils/compaction/contextLimit.ts
src/common/utils/compaction/contextLimit.test.ts
src/common/utils/tokens/models-extra.ts
src/common/utils/tokens/tokenMeterUtils.ts
src/common/utils/tokens/tokenMeterUtils.test.ts
src/node/services/agentSession.ts`
- `bunx prettier --check src/common/constants/codexOAuth.ts
src/common/utils/compaction/contextLimit.ts
src/common/utils/compaction/contextLimit.test.ts
src/common/utils/tokens/models-extra.ts
src/common/utils/tokens/tokenMeterUtils.ts
src/common/utils/tokens/tokenMeterUtils.test.ts
src/node/services/agentSession.ts`
- `git diff --check`
- `nix fmt -- flake.nix`
- `make static-check NIX=`
Risks
Low-to-medium risk, limited to context-limit display and compaction
decisions. The main behavioral risk is misclassifying OpenAI auth route
from provider config; tests cover OAuth-only, OAuth-default, explicit
API-key, and env API-key cases.
Pains
Local `make static-check` required environment repair: `node-pty`,
`shfmt`, and `hadolint` were missing from the workspace. The repo's
`fmt-nix-check` target also fails locally when its temporary copied
flake is outside a git repo, so I separately ran `nix fmt -- flake.nix`
and then ran `make static-check NIX=`.
---
_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` •
Cost: `$0.00`_
<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=0.00 -->
Co-authored-by: Mux <noreply@coder.com>
0 commit comments