gpt-5.5 reports 2432-token context window in 0.137.0, causing repeated auto-compaction and usage drain
Summary
After updating to Codex CLI/Desktop 0.137.0 / Codex Desktop app 26.602.40724, gpt-5.5 sessions report model_context_window: 2432. That appears to trigger auto-compaction almost immediately and repeatedly, including in codex exec CLI sessions. Each resumed trivial CLI turn auto-compacted before answering and total logged usage increased by roughly 26k tokens per turn.
This is affecting both Codex Desktop-originated threads and codex exec CLI threads. Since this started, usage/rate-limit drain also seems noticeably faster than expected for a 5x plan.
Expected behavior
gpt-5.5should report/use its real context window, not2432tokens.- Auto-compaction should not trigger immediately for tiny conversations.
- After a compaction, the next tiny resumed turn should not immediately auto-compact again.
- Repeated auto-compactions caused by incorrect context-window accounting should not burn subscription usage/rate limit.
Actual behavior
- A trivial
codex execthread (Reply with OK only) reportedmodel_context_window: 2432. - First turn used/logged ~25k tokens, despite the prompt requiring only a tiny response.
- Each subsequent
codex exec resumeauto-compacted before answering. - Total logged usage rose by roughly 26k tokens per resumed turn:
- after turn 1:
25473 - after turn 2:
51553 - after turn 3:
77826 - Desktop-originated threads show the same
model_context_window: 2432and repeatedcompacted/context_compactedentries.
Environment
OS: CachyOS
Kernel: Linux 7.0.10-2-cachyos x86_64 GNU/Linux
Desktop: Hyprland
Session: Wayland
Codex CLI: codex-cli 0.137.0
Codex Desktop app version: 26.602.40724
Electron version: 42.1.0
Codex Desktop Linux wrapper/build: ilysenko/codex-desktop-linux 0.8.2, commit 44798b3400f68a0080deaad2eb81288140617ae2
Codex Desktop build generatedAt: 2026-06-06T13:05:53.523Z
Model: gpt-5.5
Plan type shown in token_count events: prolite
Desktop build metadata came from:
~/Documents/code/codex-desktop-linux/codex-new-app/resources/codex-linux-build-info.json
CLI repro
Thread:
codex://threads/019e9d19-6d62-7e83-8651-2a48f14d0f78
Commands:
codex exec --json -m gpt-5.5 --skip-git-repo-check "Reply with OK only."
codex exec resume 019e9d19-6d62-7e83-8651-2a48f14d0f78 \
--json --skip-git-repo-check "Reply with OK2 only."
codex exec resume 019e9d19-6d62-7e83-8651-2a48f14d0f78 \
--json --skip-git-repo-check "Reply with OK3 only."
Rollout path:
~/.codex/sessions/2026/06/06/rollout-2026-06-06T14-22-29-019e9d19-6d62-7e83-8651-2a48f14d0f78.jsonl
Observed rollout/token-count sequence:
2026-06-06T13:22:30.651Z task_started model_context_window=2432
2026-06-06T13:22:33.942Z token_count total_tokens=25473 model_context_window=2432
2026-06-06T13:22:59.082Z task_started model_context_window=2432
2026-06-06T13:23:13.537Z type=compacted
2026-06-06T13:23:13.539Z token_count total_tokens=25473 last_token_usage.total_tokens=6022 model_context_window=2432 rate_limits=null
2026-06-06T13:23:13.541Z event_msg type=context_compacted
2026-06-06T13:23:15.784Z token_count total_tokens=51553 last_token_usage.total_tokens=26080 model_context_window=2432
2026-06-06T13:23:57.656Z type=compacted / compaction token_count total_tokens=51553 model_context_window=2432
2026-06-06T13:23:59.985Z token_count total_tokens=77826 model_context_window=2432
Summary for that single CLI thread:
compacted entries: 2
context_compacted events: 2
Desktop examples
Desktop thread 1
codex://threads/019e9d06-8e5e-7822-8524-1124c725fe0a
originator: Codex Desktop
cli_version: 0.137.0
model: gpt-5.5
reasoning_effort: xhigh
tokens_used in state_5.sqlite: 54950
rollout: ~/.codex/sessions/2026/06/06/rollout-2026-06-06T14-01-53-019e9d06-8e5e-7822-8524-1124c725fe0a.jsonl
Observed:
2026-06-06T13:02:05.355Z token_count total_tokens=26965 model_context_window=2432
2026-06-06T13:02:39.458Z type=compacted
2026-06-06T13:02:39.482Z event_msg type=context_compacted
2026-06-06T13:02:43.890Z token_count total_tokens=54950 model_context_window=2432
2026-06-06T13:03:37.195Z type=compacted
2026-06-06T13:03:37.218Z event_msg type=context_compacted
Desktop thread 2
codex://threads/019e9d0e-88ff-7242-a090-351eaaf652d9
originator: Codex Desktop
cli_version: 0.137.0
model: gpt-5.5
reasoning_effort: low
tokens_used in state_5.sqlite: 134426
rollout: ~/.codex/sessions/2026/06/06/rollout-2026-06-06T14-10-36-019e9d0e-88ff-7242-a090-351eaaf652d9.jsonl
Observed in this short session:
compacted rollout entries: 6
context_compacted event messages: 6
Early sequence:
2026-06-06T13:10:58.488Z token_count total_tokens=26236 model_context_window=2432
2026-06-06T13:11:27.363Z type=compacted
2026-06-06T13:11:27.371Z event_msg type=context_compacted
2026-06-06T13:11:36.559Z token_count total_tokens=53348 model_context_window=2432
2026-06-06T13:11:58.157Z type=compacted
2026-06-06T13:11:58.165Z event_msg type=context_compacted
Comparison with earlier thread
An older 0.136.0 Desktop thread with the same model reported a much larger context window:
codex://threads/019e93cd-fbcc-75b0-850f-c61fd4ae48a0
cli_version: 0.136.0
model: gpt-5.5
model_context_window observed in token_count events: 258400
The affected 0.137.0 sessions above report:
model_context_window: 2432
That looks like the likely trigger for the immediate/repeated compaction behavior.
Local inspection commands
codex --version
# codex-cli 0.137.0
sqlite3 ~/.codex/state_5.sqlite \
"select id, datetime(created_at,'unixepoch'), datetime(updated_at,'unixepoch'), tokens_used, model, reasoning_effort, cli_version, source, title, rollout_path from threads order by created_at desc limit 5;"
python3 - <<'PY'
import json, sqlite3
ids = [
'019e9d19-6d62-7e83-8651-2a48f14d0f78',
'019e9d06-8e5e-7822-8524-1124c725fe0a',
'019e9d0e-88ff-7242-a090-351eaaf652d9',
]
con = sqlite3.connect('/home/jay/.codex/state_5.sqlite')
for id in ids:
path = con.execute('select rollout_path from threads where id=?', (id,)).fetchone()[0]
compacted = context = 0
windows = []
totals = []
with open(path) as f:
for line in f:
o = json.loads(line)
if o.get('type') == 'compacted':
compacted += 1
if o.get('type') == 'event_msg':
payload = o.get('payload', {})
if payload.get('type') == 'context_compacted':
context += 1
if payload.get('type') == 'token_count':
info = payload.get('info', {})
windows.append(info.get('model_context_window'))
totals.append(info.get('total_token_usage', {}).get('total_tokens'))
print(id, 'compacted=', compacted, 'context_compacted=', context, 'windows=', sorted(set(windows)), 'totals=', totals)
PY
Impact
This makes Codex difficult to use because short threads can repeatedly auto-compact instead of progressing normally, and usage/rate-limit drain appears to be much faster than expected since the bug started, even on a 5x subscription plan.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗