Auto-compaction re-executes the previous command after context compression
What version of the Codex App are you using (From “About Codex” dialog)?
Version 26.611.62324 • Released 2026. 6. 17.
What subscription do you have?
ChatGPT Pro
What platform is your computer?
Windows 11 x64
What issue are you seeing?
Summary
After Codex performs context auto-compaction / context compression, it sometimes re-executes the previous user command instead of continuing from the latest instruction.
The issue is very specific:
After context compression, Codex executes the command I gave immediately before the compression again.
This is dangerous during coding sessions because the previous command may have already modified files, run shell commands, deleted/generated files, or performed a large refactoring step. After compaction, Codex should not replay or re-run the previous instruction.
Expected behavior
After context compression, Codex should preserve the correct conversation state and continue from the latest user instruction.
It should not automatically re-execute the command that was already completed before compaction.
Actual behavior
After context compression, Codex resumes and executes the previous command again.
For example:
- I give Codex an implementation/refactoring command.
- Codex performs the task.
- Context compression happens.
- After compression, Codex executes the same previous command again, even though I did not ask it to repeat it.
Why this is a problem
This can cause duplicated code changes, repeated file edits, repeated shell commands, and unnecessary risk during large coding tasks. It is especially problematic during long-running refactoring sessions.
Reproduction pattern
I do not have a minimal reproduction yet, but I have observed it during long Codex coding sessions where auto-compaction is triggered.
The pattern is:
- Start a long Codex session.
- Give Codex a large coding/refactoring task.
- Let the session reach context auto-compaction.
- After compaction, Codex resumes.
- Codex re-executes the previous user command instead of waiting for or following the latest instruction.
Notes
This appears to be a turn/session resume issue around context compression. The model seems to treat the previous command as if it still needs to be executed after compaction.
What steps can reproduce the bug?
I do not have a minimal reproduction yet, but I have observed it during long Codex coding sessions where auto-compaction is triggered.
The pattern is:
- Start a long Codex session.
- Give Codex a large coding/refactoring task.
- Let the session reach context auto-compaction.
- After compaction, Codex resumes.
- Codex re-executes the previous user command instead of waiting for or following the latest instruction.
What is the expected behavior?
_No response_
Additional information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗