Codex Desktop Windows: repeated context compaction causes pre-write loop; agent rereads same files for hours and never implements requested change
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:
- Use an existing JSON schema: schemas/calibration_readiness_snapshot.schema.json
- Add a builder: validators/build_calibration_readiness.py
- Connect the builder to validators/validate_repo.py
- Generate indexes/calibration_readiness_snapshot.json
- 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?
- Open a local Windows Codex project with around 30 case folders and a small set of validators/schemas/docs.
- 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.
- 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
- Let the task run.
- Observe that Codex repeatedly enters:
“Context automatically compacted”
- 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
- Codex repeatedly reaches the same conclusion:
“the schema already exists; the builder and repo hook are missing.”
- It then says it will implement the builder, but after compaction it starts the same preflight again.
- The run may show reconnects such as:
“Reconnecting /5”
- 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_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗