Home/ Incident database/codex-auto-compaction-loop-2026-07
Financial loss API cost spike verified

Codex context auto-compaction loop rereads files, loses progress, and burns paid credits

edisonjoao1 (OpenAI Codex user) · Jul 24, 2026 · Coding agent

What happened

A long-running Codex project chat on GPT-5.6 Sol entered a context auto-compaction loop. After each 'Context automatically compacted' event, Codex retained the broad project objective but appeared to lose execution progress. It repeatedly reread the same files, reloaded the same skills or memory files, restated that it had found the exact defect, promised the next update would contain the completed change, then compacted again before completing the edit. The requested implementation was never completed, and the loop consumed roughly 10%-15% of the user's available paid Codex usage. Context was 93% full at 240,000 / 258,000 tokens when captured.

$0
Loss / impact
Jul 24
2026
API
Failure mode
Coding
Agent type

Causal vector

Context auto-compaction loop: after each compaction event the agent reread the same files, restated the same plan, promised completion, then compacted again without editing

Source

Reported by GitHub issue, openai/codex #35226. Verified against the primary report.

Read the original report ↗

How a spend firewall would have helped

A policy layer that detects repeated file reads and no working-tree progress — and cuts spend when a session is burning credits without advancing — would have stopped this loop before it consumed a tenth of the paid allowance.

The six rule types that contain this class of failure

Per-transaction cap

Any single spend above your ceiling is BLOCKED before it moves.

Daily total

Cumulative spend across all agent calls, bounded per day.

Velocity limit

Stops runaway retry loops — the #1 cause of overnight losses.

Merchant allowlist

Only approved destinations can ever receive funds.

Category rules

Flag high-risk classes (crypto, infra, refunds) for review.

Approval threshold

Above a value, the action waits for a human.

Related incidents

Don't be the next entry

Every incident in this database is the result of trusting a prompt, a provider cap, or a human review cycle. sipi.bot replaces all three with one deterministic call. 80 documented failures, one control.