Skip to content

Automatic context compaction causes Codex to lose track of the current turn and start trying to re-perform the previous turn instead #10346

Closed as duplicate

Description

@deinspanjer

What version of Codex is running?

This happened twice to me with 0.92.0 and twice now with 0.93.0

What subscription do you have?

Business/Enterprise

Which model were you using?

gpt-5.2-codex

What platform is your computer?

Darwin 25.2.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

iTerm2

What issue are you seeing?

Four times now when Codex has been in the middle of a long chain of tool executions during its turn and it has hit the threshold for automatic compaction, when the compaction is finished, it has suddenly forgotten what it was in the middle of and instead gone back and tried to perform the previous turn again.

Here is an example from the most recent occurrence:

Previous turn:

> derive from person_id

• Ran <skill>

• Edited TODO.md (+0 -1)

  Resolving refinement bullets and updating TODO
• Edited TODO.md (+1 -1)
    4
    5 -Status: In Refinement
    5 +Status: Ready for dev
    6

• I applied changes to the TODO, removed all Agent lines, and marked the status as Ready for dev. No further questions remain; the next step is proceeding with development.

─ Worked for 1m 00s 

Current turn:

>   1. Start implementation of the task.

• Explored
  └ Search pytest
• Explored
  └ Read test_config.py
• Explored
  └ Read pyproject.toml
• Explored
  └ Read <skill> file
• Explored
  └ Search class App|def main in cli.py
    Read cli.py
• Explored
  └ Search def _log_error|def report_error|error_log in cli.py
    Read cli.py
• Explored
  └ Read testing.py
• Edited <app>/tests/test_config.py (+34 -0)
• Added <file>
• Ran <failing TDD test>
• Explored
  └ List bin
• The test fails as expected due to missing GraphQL client; next is to create a minimal client module with gql dependency and SQL header query, but the gql package isn't installed in the environment, risking test errors.
• Added <app>/graphql_client.py (+99 -0)
• I'm verifying that GraphQLClient's header keys match the test expectations despite possible automatic casing changes by urllib; the test currently expects lower-case headers, but actual HTTP libraries may send title-cased headers, which
  might cause test mismatches.

  Planning header key normalization in tests

  I'm deciding to normalize header keys to lowercase in the test by mapping all keys to lowercase before assertions, preventing case-sensitivity issues from affecting test outcomes.

• Edited <app>/tests/test_graphql_client.py (+1 -1)
    64      assert request is not None
    65 -    headers = request["headers"]
    65 +    headers = {key.lower(): value for key, value in request["headers"].items()}
    66      assert headers.get("api-key") == "secret-value"

─ Worked for 6m 16s 

• Context compacted

• I'm ready to examine the TODO.md and references/todo_workflow.md files inside the module by navigating there and using cat or ripgrep, and I'll also confirm no active subagent needs closing before
  proceeding.

  Planning to update TODO with user responses

  I’ll first open TODO.md to check the current status of the "Add minimal GraphQL query/mutation support to TUI" task and read references/todo_workflow.md for guidance before incorporating the user’s recent answers and continuing the
  interactive refinement.

• Explored
  └ Read TODO.md
    Search Add minimal GraphQL in TODO.md
    Read TODO.md

At this point, it continued as if it was back at the previous turn, overwrote some data in the TODO slightly differently than how it had done before, forgot that it had started to implement the gql library support and told me the TODO was not ready for dev because I needed to decide on whether to use gql or not.

What steps can reproduce the bug?

Have a session with several turns and enough data to get the context down below the threshold on the next turn.

If the next turn is interrupted to perform compaction then the turn is not resumed afterward but instead the previous turn is re-played.

What is the expected behavior?

The current turn should resume from where it left off before compaction.

Additional information

No response

Activity

  1. etraut-openai commented on Feb 1, 2026

    @etraut-openai
    Contributor

    Thanks for the bug report. This overlaps several other existing bug reports including #8648. Closing as a duplicate.

    For future bug reports like this, please use the /feedback slash command to upload your logs and session details and include the thread ID in the bug report.

  2. alc1986 commented on Feb 9, 2026

    @alc1986

    Thanks for the bug report. This overlaps several other existing bug reports including #8648. Closing as a duplicate.

    For future bug reports like this, please use the /feedback slash command to upload your logs and session details and include the thread ID in the bug report.

    If there are so many reports of this issue, is there any chance we'll have it fixed? It's even worse now with Codex 5.3.

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 working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions