Codex Desktop auto-compaction completes but leaves long-running thread ~80% full, causing repeat compaction and usage waste

Open 💬 14 comments Opened Jul 23, 2026 by grtninja
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

Summary

In a long-running, tool-heavy Codex Desktop agent thread, automatic context compaction reports success (Context automatically compacted) but the context meter immediately remains at roughly 80% full. This leaves only about 20% usable runway before another compaction cycle.

The result is a repeat loop:

compact -> resume nearly full -> run a few tool operations -> compact again

This is not merely a cosmetic meter problem. The affected thread repeatedly reprocesses state, loses working coherence, spends substantial paid usage, and becomes unreliable for production repository work.

Environment

  • Product: Codex Desktop
  • Platform: Windows 11
  • Subscription: ChatGPT Pro
  • Workload: long-running agentic repository coordination with many tool calls, GitHub operations, command outputs, and image evidence
  • Observed: July 23, 2026
  • A public elevated-error-rate incident was active at the time. This is included for correlation only; causality is not established.

Steps to reproduce

  1. Use a Codex Desktop thread for a long-running repository task with repeated tool calls and large tool outputs.
  2. Continue until automatic context compaction occurs.
  3. Observe the visible Context automatically compacted event.
  4. Immediately inspect the thread's context-usage indicator.
  5. The thread remains approximately 80% full directly after compaction.
  6. Continue for a small number of operations; compaction triggers again.

Observed behavior

  • Successful compaction reclaims only about 20% of the context window.
  • Multiple compaction events occur close together.
  • The active thread retains or rehydrates too much prior tool/output history.
  • The agent repeats plans, loses acceptance criteria, and contradicts earlier state.
  • Paid usage is consumed during repeated compaction/reprocessing without proportional task progress.
  • The user can reach the usage limit while the production task remains incomplete.

Expected behavior

  • A successful compaction should produce substantial working headroom, not resume near the next compaction threshold.
  • Replacement history should be bounded, deduplicated, and exclude raw historical tool output that is no longer needed in the active prompt.
  • If compaction cannot reclaim enough space, Codex should explicitly report compaction failure or recommend a bounded handoff to a new thread rather than silently continuing near capacity.
  • Context telemetry should distinguish original history, compacted summary, retained tool state, and reserved output space so this can be diagnosed.

Impact

This blocks reliable long-running agent work and creates direct usage waste. A production coordination thread became trapped in repeated compaction while repository progress stalled.

The reporter has screenshots showing the compaction events and the thread remaining about 80% full immediately afterward. Private repository names and paths are intentionally omitted from this public report.

Related reports

  • #24948 — repeated compaction history and raw tool output cause huge session logs
  • #34971 — massive cached context is repeatedly reprocessed, causing latency and excessive credit use
  • #19585 — unusually fast usage depletion worsened by unstable context compaction
  • #21134 — long active Codex Desktop threads remain unusable despite transcript pruning
  • #29967 — auto-compaction occurs at the threshold and needs stronger pre-turn handling

This issue is narrower: the visible auto-compaction completes but immediately leaves the active thread around 80% full.

View original on GitHub ↗

14 Comments

github-actions[bot] contributor · 1 month ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #34322
  • #34095
  • #34971

Powered by Codex Action

grtninja · 1 month ago

Additional evidence and triage request:

The duplicate detector linked #34322, #34095, and #34971, confirming that repeat compaction, execution-frontier loss, cached-context reprocessing, and excessive usage are an existing failure class. This report adds a narrower, directly measurable symptom: Codex Desktop visibly reports successful auto-compaction, but the context meter immediately remains about 80% full, leaving only roughly 20% working headroom before the next compaction.

In the affected production thread, that resulted in repeated Context automatically compacted events, repeated planning/tool work, degraded acceptance-state retention, and exhaustion of included usage before the repository task completed.

Requested maintainer triage:

  • preserve #35032 as the post-compaction reclamation/telemetry case rather than closing it solely as a generic duplicate;
  • assign an owner or state whether this is already tracked internally;
  • capture pre-compaction tokens, compacted-summary tokens, retained tool-state tokens, reserved-output tokens, and immediate post-compaction occupancy;
  • add a circuit breaker: if compaction cannot reclaim meaningful headroom, stop the run and produce a bounded handoff instead of continuing near capacity;
  • provide the appropriate route for reviewing usage consumed by repeated compaction/reprocessing during an affected session.

No private repository names, paths, or account identifiers are included here.

TeachDian · 1 month ago

Noticed this too, a 10-minute fix is getting 3 to 5 times longer it should have been

<img width="1307" height="1175" alt="Image" src="https://github.com/user-attachments/assets/311a1d58-f153-4ba4-b392-aa4ebf4f5486" />

grtninja · 1 month ago

Related but separate follow-up filed as #35037: Codex Desktop did not surface an active official OpenAI incident or offer a pause/bounded-handoff path while the affected long-running session continued consuming usage. #35032 remains the measurable post-compaction occupancy defect; #35037 covers incident observability and user protection.

grtninja · 1 month ago

Follow-on decomposition from the same production incident, consolidated to canonical issues so each defect has one maintainer discussion:

  • #35037 — active OpenAI/Codex incidents are not surfaced inside the running Desktop session and there is no incident-linked pause/usage-review path. Duplicate #35038 was closed after its additional correlation details were moved there.
  • #35041 — Codex can assert foreground-visible app/tool success after backend-only configuration changes, before live acceptance; the discussion also now includes transactional rollback requirements. Duplicate #35039 was closed after consolidation.
  • #35044 — the Usage panel lacks authoritative, account-specific quota reset and entitlement-change notices/history. Duplicate drafts #35040 and #35042 were closed after their event-ledger fields were consolidated there.
  • #34898 — existing report for scope-expanding governance loops, false completion states, and usage exhaustion without task convergence; this incident has been added as corroboration.
  • #34971 — existing report for massive cached-context reprocessing, latency, state growth, and excessive usage; the ~80% post-compaction reproduction has been added there.
  • #29103 — existing curated-plugin persistence report; the Windows codex-security disappearance-after-update case has been added.

Please keep #35032 focused on the measurable compaction invariant: a reported-success compaction immediately leaves the active thread near the next compaction threshold.

grtninja · 1 month ago

Thank you for the independent corroboration, @TeachDian. The 3–5× slowdown is the same user-impact class this report is trying to isolate. If convenient, the most useful additional diagnostics would be: Codex Desktop/app-server version, approximate context percentage immediately before and after the visible compaction event, number of compactions in the run, and whether the agent repeated the same plan/tool work afterward. Please keep repository names, account identifiers, and private transcript content redacted.

grtninja · 1 month ago

@TeachDian Thank you — your screenshot and the 3–5× duration increase are useful independent corroboration. If you can safely add them without exposing private work, the most diagnostic fields would be:

  • Codex Desktop/app-server version;
  • approximate context percentage immediately before and immediately after the visible compaction;
  • number and spacing of repeated Context automatically compacted / Optimized the conversation events;
  • whether the agent reopened completed work or repeated the same tool/plan after each event;
  • whether usage depletion accelerated during the loop.

That would help maintainers distinguish the narrower post-compaction-occupancy failure in this issue from generic latency or the broader execution-frontier reports. Please keep repository names, paths, account IDs, and private task content redacted.

grtninja · 1 month ago

Thanks @TeachDian — that independent reproduction is useful, especially the same pattern of a small task stretching to several times its expected duration.

If you still have the affected session, the most useful extra telemetry would be:

  • Codex Desktop/app-server version;
  • context percentage immediately before and immediately after each compaction;
  • number and spacing of repeated compactions;
  • whether the first post-compaction actions repeat earlier reads/plans;
  • approximate usage consumed versus useful repository progress.

Please redact account, repository, path, and credential details. The narrow invariant this issue is trying to preserve is measurable: a successful compaction should reclaim substantial working headroom rather than resume near the next threshold.

grtninja · 1 month ago

Redacted visual evidence is now available in a public evidence branch:

!Redacted Codex repeated-compaction chronology

The crop preserves the visible chronology of command activity followed by repeated Context automatically compacted events and the usage-exhaustion banner. Private repository names, paths, task narration, integration labels, and thread details are removed.

Claim boundary: this image proves the visible event sequence and resulting exhausted-usage state. It does not by itself establish the internal token accounting or root cause; those remain the telemetry requests in this issue.

grtninja · 1 month ago

Evidence-link correction: the repository's release-hygiene check correctly rejected the branch-local SVG as a release-impacting asset. The redacted screenshot is now referenced through the immutable commit that created it, while the live branch keeps only the evidence manifest and incident SOP.

The earlier branch-local visual link is superseded by the immutable link above. The redaction and claim boundaries are unchanged.

grtninja · 1 month ago

@TeachDian Thanks for corroborating this. I’ve published a public-safe visual exhibit that strips private task, repository, integration, account, and session details while preserving the repeated Context automatically compacted → tool-operation sequence:

https://github.com/grtninja/skill-arbiter/pull/8

The exhibit is deliberately narrow: it proves the repeated event pattern, not the server-side root cause. The most useful additional correlation from other affected users would be the Codex Desktop build, model/reasoning setting, visible context occupancy immediately before and after compaction, and whether the first post-compaction actions repeat already-completed work.

Maintainers: the report now has independent corroboration plus redacted visual evidence. Please expose pre/post compaction token accounting and add a circuit breaker when a successful compaction does not reclaim substantial working headroom.

grtninja · 1 month ago

Durable evidence/SOP update: the incident-reporting pull request has passed all protected checks and merged into grtninja/skill-arbiter main.

Merged policy commit: af43f33de34b60216bbc0c4a4771d32e837425f6.

grtninja · 1 month ago

Canonical-link correction for the incident-observability follow-up: #35037 was later closed as a duplicate of reopened #35038. The active incident-visibility/run-protection discussion is therefore #35038. The distinction remains unchanged: #35032 is the measurable post-compaction headroom defect; #35038 is the product incident-awareness, pause/handoff, and session-linked usage-review request.

adamgwinn · 1 month ago

I reproduced the same failure mode on Codex Desktop for Windows.

Environment:

  • Codex Desktop package: 26.721.3996.0
  • ChatGPT.exe file/product version: 150.0.7871.128
  • Windows: 10.0.26200.0
  • Model: 5.6 Sol High
  • Context window shown by the UI: 258k
  • PATH CLI (for reference only): codex-cli 0.145.0

Observed context sequence in the affected long-running task:

  • 246k / 258k (95%)
  • automatic compaction completed
  • 197k / 258k (76%)
  • one bounded tool call / short update
  • 217k / 258k (84%)
  • 249k / 258k (96%)
  • another automatic compaction
  • later returned to 246k / 258k (95%)

One 17m57s turn displayed three completed Context automatically compacted events and immediately entered a fourth. The task could not finish ordinary bounded research or orchestrate a subtask.

A separate side conversation inheriting the same long history independently reproduced immediate re-compaction after very small operations:

  • codex --version
  • a bounded local search
  • gh auth status (about 2.3s and 7 lines)
  • a bounded GitHub issue search
  • a bounded comparison of three issue summaries

No large tool output was emitted during these reproductions. This looks like insufficient durable headroom or retained-context accounting after compaction, not only a cosmetic context-meter issue.

I have sanitized screenshots and precise timestamps if maintainers need them, but they contain internal work context and should not be posted publicly without further redaction. Related report: #35226.