Skip to content

[Context] Repeated auto-compaction degrades execution frontier and prevents convergence in long tasks #34095

Open

Description

@Leviann

Description

In a long-running Codex Desktop task, automatic context compaction repeatedly preserved the broad objective but degraded the execution frontier: what was already complete, what remained, and the exact next action.

This was not a literal hard-amnesia reset. After compaction, the agent still referenced specific prior findings and files. The failure was loss of convergence: after many compactions it repeatedly announced variations of "finish the last items, run staged verification, then commit", reopened or rediscovered additional work, and did not reach the promised terminal state.

The original version of this report attributed the behavior directly to Ultra reasoning and claimed that only the base user prompt survived. The local rollout evidence does not support those stronger claims, so this report has been corrected to describe the observed behavior.

Environment

  • Product: Codex Desktop
  • Windows app version: 26.715.31925
  • Bundled Codex/app-server version recorded in the rollout: 0.144.5
  • Client/host topology: Windows client connected to a remote Ubuntu workspace
  • Model: gpt-5.6-sol
  • Reasoning effort:
    • high through 2026-07-18T19:59:57Z
    • switched to ultra at 2026-07-18T20:02:30Z
  • Thread/session ID: 019f74ea-cacf-7c91-81b7-2d1502414f94
  • Reported model context window: 258,400 tokens
  • No persisted /goal was active for this thread.

Observed compaction timeline (UTC)

The rollout contains 24 compacted events between 2026-07-18T11:28:57Z and 2026-07-19T01:30:02Z.

The nearest preceding token-count samples were approximately 196,548–218,387 input tokens against the reported 258,400-token context window.

# Timestamp (UTC) Reasoning effort Nearest preceding input tokens
1 2026-07-18T11:28:57.728Z high 218,387
2 2026-07-18T13:47:52.139Z high 204,127
3 2026-07-18T14:20:15.106Z high 208,481
4 2026-07-18T14:52:24.390Z high 216,276
5 2026-07-18T15:59:35.164Z high 208,546
6 2026-07-18T17:05:31.396Z high 214,973
7 2026-07-18T17:40:13.392Z high 208,926
8 2026-07-18T18:15:05.095Z high 209,486
9 2026-07-18T18:35:05.715Z high 213,696
10 2026-07-18T19:05:01.808Z high 209,219
11 2026-07-18T19:24:30.682Z high 210,305
12 2026-07-18T19:59:57.049Z high 202,861
13 2026-07-18T20:17:51.571Z ultra 208,630
14 2026-07-18T20:58:19.400Z ultra 196,548
15 2026-07-18T21:25:02.192Z ultra 203,493
16 2026-07-18T21:50:59.897Z ultra 207,961
17 2026-07-18T22:22:22.813Z ultra 200,071
18 2026-07-18T22:52:35.568Z ultra 198,649
19 2026-07-18T23:11:28.513Z ultra 206,130
20 2026-07-18T23:46:11.890Z ultra 202,179
21 2026-07-19T00:15:34.308Z ultra 200,672
22 2026-07-19T00:38:20.535Z ultra 200,405
23 2026-07-19T01:01:11.126Z ultra 200,087
24 2026-07-19T01:30:02.695Z ultra 203,966

There were 12 compactions before Ultra and 12 after switching to Ultra. The 12 Ultra events span about 5 hours 12 minutes, with most adjacent events roughly 19–40 minutes apart. This makes Ultra an important affected configuration, but the trace does not establish that Ultra alone causes the bug.

Concrete convergence failure

During the Ultra phase, the post-compaction status repeatedly returned to the same high-level frontier:

  1. finish the remaining small set of issues;
  2. build an exact staged snapshot;
  3. run hostile/targeted verification;
  4. create a local commit.

This pattern recurred after compactions 13–24 while new "last" issues kept being rediscovered and the terminal state was not reached.

At 2026-07-19T01:10:00Z, the user explicitly asked whether the agent had become stuck due to compaction cycles. After compaction #24 at 2026-07-19T01:30:02.695Z, the agent again denied looping and restated essentially the same remaining frontier: two final items, staged verification, then a local commit.

The retained replacement history was not empty: it contained multiple user/developer messages plus an encrypted compaction item. That is why this issue is framed as frontier degradation / failure to converge, not complete loss of all context.

Expected behavior

After compaction, Codex should preserve a compact but explicit execution checkpoint:

  • active objective and constraints;
  • completed actions and evidence;
  • unresolved items;
  • exact next action;
  • terminal condition;
  • explicit "do not repeat" boundaries.

The next model turn should reconcile against that checkpoint and continue from the first unfinished item without re-announcing or reopening completed work.

Actual behavior

The broad objective survives, but the post-compaction model repeatedly reconstructs the work at too high a level. It remembers facts while losing enough completion state to reopen the audit and postpone its terminal step across many consecutive compactions.

Impact

  • Multi-hour non-converging runs.
  • Rapid consumption of included Codex allowance and/or purchased credits.
  • Duplicate investigation, verification, and potentially mutations.
  • Reduced trust in long autonomous tasks even when individual post-compaction messages appear locally coherent.

Reproduction

  1. Start a long multi-stage Codex Desktop task with explicit completion criteria.
  2. Let it run until several automatic context_compacted events occur.
  3. Record the last pre-compaction plan/checkpoint.
  4. Compare it with the first post-compaction status and actions.
  5. Repeat across several compactions.
  6. Observe whether Codex repeatedly returns to a previously announced "last steps" frontier instead of reaching the terminal condition.

Relationship to #32922

#32922 reports persisted goal context being discarded by compaction. This reproducer did not have an active persisted /goal, and the overall objective remained available. The observed failure is narrower/different: completed-vs-pending execution state degraded enough to prevent convergence while many detailed facts still survived.

The issues may share a compaction-retention boundary, but this is not proven to be the same root cause.

In-product feedback correlation

This incident was also submitted through Codex in-product /feedback from the affected ChatGPT account, with logs attached.

  • Feedback reference / affected thread ID: 019f74ea-cacf-7c91-81b7-2d1502414f94
  • GitHub reporter: @Leviann

The in-product submission should provide OpenAI with the private account and diagnostic metadata needed to correlate this public report without publishing the account email here.

Activity

  1. added
    bugSomething isn't working
    contextIssues related to context management (including compaction)
    rate-limitsIssues related to rate limits, quotas, and token usage reporting
    model-behaviorIssues related to behaviors exhibited by the model
    on Jul 19, 2026
  2. github-actions commented on Jul 19, 2026

    @github-actions
    Contributor

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

    Powered by Codex Action

  3. changed the title [-][Rate Limits] Infinite compaction loop on gpt-5.6-sol (ultra reasoning) causes rapid quota exhaustion[/-] [+][Context] Repeated auto-compaction degrades execution frontier and prevents convergence in long tasks[/+] on Jul 19, 2026
  4. Akshmit commented on Jul 21, 2026

    @Akshmit

    Ran into this non-convergence pattern as well, after repeated context compactions, long sessions would hit ~2GB memory usage and loop indefinitely while re-stating the same "final verification/commit" frontier. To handle this during multi-hour tasks, I'm building a lightweight watchdog utility that monitors compaction loops, rotates session logs, auto-terminates non-converging runs, and verifies genuine terminal state completion. I plan to open-source it tomorrow, let me know if you'd like me to share a link or tag you here once it's pushed!

  5. planetzalex commented on Jul 23, 2026

    @planetzalex

    Why does this behavior exist even after they halved the context window? Bad things happening at OpenAI.

    To partially mitigate this absolute fucking bullshit-ass problem that still exists today, I added a compaction counter to every task and force a new task with a fresh context after three compactions. This is a stupid fix for a problem that should NEVER have existed.

  6. grtninja commented on Jul 23, 2026

    @grtninja

    Additional Windows Codex Desktop evidence is in #35032. In the affected production thread, compaction visibly completed but left the session at roughly 80% context occupancy, after which plans and acceptance criteria began repeating while paid usage continued to fall. This supports the execution-frontier degradation reported here and adds a concrete post-compaction headroom measurement. A useful mitigation would be a circuit breaker that creates a bounded handoff when compaction cannot reclaim safe working space.

  7. grtninja commented on Jul 23, 2026

    @grtninja

    Independent corroboration and narrower telemetry case: #35032 reproduces the same execution-frontier/convergence failure in Codex Desktop on Windows, with the visible Context automatically compacted event followed immediately by roughly 80% context occupancy. The affected thread then compacted again after only a small amount of work, repeated plans/tool activity, and exhausted included usage before the repository task completed. Another user independently replied on #35032 that a ten-minute fix was taking three-to-five times longer. This supports the report here and adds a measurable post-compaction reclamation symptom.

  8. GG95-lab commented on Sep 25, 2026

    @GG95-lab

    I've been running into a very similar problem in long Codex Desktop sessions, especially after repeated compactions.
    I ended up building a small Windows tool that tracks compaction/session health signals and creates a structured handoff into a fresh Codex session.

    I'm running a public beta here if anyone dealing with the same problem wants to try it:
    https://github.com/GG95-lab/FreshThread-BETA-version

  9. oskaritooo commented on Sep 26, 2026

    @oskaritooo

    Independent Windows Codex Desktop reproduction from 2026-09-26 that appears related to this issue. I am not claiming that compaction is proven to be the cause; I am adding this because the same non-convergence occurred in a run containing three automatic compactions, with a directly inspectable local JSONL.

    Environment

    • Codex Desktop / Windows
    • bundled CLI recorded in rollout: 0.155.0-alpha.9.2
    • model: gpt-6-luna
    • reasoning: xhigh
    • reported context window: 258400
    • session/thread ID: 01a0dcd4-d052-7a42-a396-01a02627051e
    • workspace: local engineering project controlling real IoT devices

    The affected root turn started at 2026-09-26T08:29:17Z and ended with a user interruption at 2026-09-26T10:19:20.868Z.

    The rollout records:

    turn_aborted
    reason: interrupted
    duration_ms: 6603042
    

    So the single turn ran for approximately 1 h 50 min 03 s before I stopped it manually.

    Compactions in the affected turn

    The local rollout contains three compacted events:

    • 2026-09-26T08:55:03.436Z
    • 2026-09-26T09:29:22.593Z
    • 2026-09-26T10:10:54.250Z

    Concrete non-convergence behavior

    The task was narrowly scoped: diagnose and fix physical ON/OFF control latency, with explicit instructions to verify the actual runtime and physical device rather than declaring success from unit tests.

    Early runtime traces already narrowed the cause space substantially. One representative early trace showed approximately:

    • click -> scheduler submit: ~1678 ms
    • scheduler queue wait: ~1 ms
    • worker lock wait: ~0.003 ms
    • P0 start -> physical WRITE: ~1731 ms
    • WRITE I/O: ~202 ms
    • P1 readback: ~161 ms

    A later P1 path showed ~2842 ms associated with uncertain-command-observation.

    In other words, the evidence already indicated that ordinary queue wait / worker-lock contention was not the main explanation for the observed end-to-end delay.

    Despite this, the run continued through additional instrumentation, more tests, runtime restarts, code changes (including commit 6f26da9), observer-load testing, and further trace inspection without reaching a stable diagnosis/terminal condition. I eventually aborted the turn.

    At the end of the turn, the local token counter recorded 22,250,946 total tokens including cached input. I am not treating that local counter as billed usage; it is included only to show the execution scale.

    Why I think this may be useful here

    This run is much shorter than the 24-compaction reproducer in the original report, but it shows a similar failure shape: the broad objective remained known, significant evidence was gathered, yet the execution did not efficiently converge and continued reopening/expanding diagnostic work across several compactions.

    I cannot establish from the client log alone whether the compactions caused the behavior. The session ID above should allow OpenAI to correlate this with server-side telemetry if useful.

    Report preparation disclosure

    I verified the session ID, CLI version, model/reasoning, compaction timestamps, turn duration, and termination directly from the local Codex JSONL. AI assistance was used to search/organize the records and draft this comment; AI is not the telemetry source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcontextIssues related to context management (including compaction)model-behaviorIssues related to behaviors exhibited by the modelrate-limitsIssues related to rate limits, quotas, and token usage reporting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions