Codex Desktop Windows: repeated context compaction causes pre-write loop; agent rereads same files for hours and never implements requested change

Resolved 💬 2 comments Opened Jun 21, 2026 by SocialK Closed Jun 27, 2026

What version of the Codex App are you using (From “About Codex” dialog)?

Version 26.616.51431 • Released Jun 21, 2026

What subscription do you have?

ChatGPT Pro / 200

What platform is your computer?

OS: Windows NT 10.0.26200.0 x64 (Windows 11 x64) Laptop: Intel Core Ultra 9 185H, 32 GB RAM

What issue are you seeing?

Codex Desktop enters a repeated pre-write context compaction loop on a bounded local maintenance task.

The task was supposed to:

  1. Use an existing JSON schema: schemas/calibration_readiness_snapshot.schema.json
  2. Add a builder: validators/build_calibration_readiness.py
  3. Connect the builder to validators/validate_repo.py
  4. Generate indexes/calibration_readiness_snapshot.json
  5. Add a short workflow document

Instead, Codex repeatedly:

  • reads the same small set of files;
  • says it understands the missing builder;
  • enters “Context automatically compacted”;
  • resumes by rereading the same files;
  • repeats the same plan;
  • never reaches the actual implementation phase.

After 6+ hours the run remained effectively at Step 1 / 6. Only one file had changed (+173 lines), while the requested builder, repo validation integration, generated snapshot, and workflow doc were still missing.

What steps can reproduce the bug?

  1. Open a local Windows Codex project with around 30 case folders and a small set of validators/schemas/docs.
  1. Start a maintenance task with a bounded objective:
  • do not use Git;
  • do not browse web;
  • do not change the core files;
  • implement a calibration readiness builder using an existing schema;
  • connect it to repo validation;
  • generate one readiness snapshot;
  • add a short workflow document.
  1. The task has these relevant existing files:
  • schemas/calibration_readiness_snapshot.schema.json
  • validators/validate_repo.py
  • validators/common.py
  • validators/build_case_index.py
  • docs/VERSIONING.md
  • docs/CASE_WORKFLOW.md
  • cases/*/case.json
  1. Let the task run.
  1. Observe that Codex repeatedly enters:

“Context automatically compacted”

  1. After each compaction, Codex rereads the same files, for example:
  • validators/validate_repo.py
  • validators/common.py
  • schemas/calibration_readiness_snapshot.schema.json
  • docs/VERSIONING.md
  • docs/CASE_WORKFLOW.md
  • sample cases/*/case.json
  1. Codex repeatedly reaches the same conclusion:

“the schema already exists; the builder and repo hook are missing.”

  1. It then says it will implement the builder, but after compaction it starts the same preflight again.
  1. The run may show reconnects such as:

“Reconnecting /5”

  1. After several hours, requested implementation files are still not created.

What is the expected behavior?

After context compaction, Codex should resume from the last durable phase, or stop with a clear no-progress report.

Expected behavior:

  • Do not reread the same unchanged files repeatedly.
  • Do not restart preflight after every context compaction.
  • If the same conclusion is reached multiple times, proceed to implementation or stop.
  • Create the requested builder file.
  • Connect it to repo validation.
  • Generate the readiness snapshot.
  • Add documentation.
  • If unable to continue, write a STOP_REPORT explaining the blocker.

Compaction should preserve phase progress, not reset the agent back to the same discovery loop.

Additional information

_No response_

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗