Context compaction repeatedly triggers in Ultra during long-running sessions
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
What version of Codex CLI is running?
codex-cli 0.149.1
What subscription do you have?
ChatGPT Pro
Which model were you using?
gpt-5.6-sol — Ultra/ultracode effort (almost never observed with xhigh)
What platform is your computer?
macOS 14.5 (23F79), x86_64
What terminal emulator and version are you using (if applicable)?
No response
Codex doctor report
What issue are you seeing?
Codex repeatedly performs context compaction during a long-running session. The problem is much more frequent and severe with Ultra/ultracode effort. After one compaction completes and work continues, another compaction occurs again, and this cycle repeats many times. With xhigh effort, I have almost never encountered this behavior. Each Context compacted entry in the screenshot corresponds to another compaction operation, and the repeated compactions interrupt the normal conversation flow.
What steps can reproduce the bug?
- Start Codex CLI 0.149.1 with
gpt-5.6-solusing Ultra/ultracode effort. - Open or resume a long-running interactive session.
- Continue the conversation until automatic context compaction is triggered.
- Continue working after the first compaction completes.
- Observe that context compaction is performed again and continues to recur, producing multiple successive
Context compactedentries.
Actual result: context compaction itself runs repeatedly during the same session. This behavior is much more frequent and severe with Ultra/ultracode. Under comparable usage with xhigh, I have almost never encountered it.
This is easiest to observe in a long-running session; I do not yet have a short deterministic reproducer.
What is the expected behavior?
After automatic compaction reduces the context, the session should continue normally regardless of effort level. Ultra/ultracode should not cause compaction to repeatedly trigger again unless the context later genuinely crosses the compaction threshold. The behavior should be consistent with xhigh, where I have almost never observed this issue.
Additional information
The issue is much more pronounced with Ultra/ultracode effort; I have almost never encountered it with xhigh. The screenshot captures successive context compaction operations in the same long-running Ultra session. remote_compaction_v2 is enabled.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the automatic context-compaction path in Codex CLI and compare Ultra/ultracode with xhigh while remote_compaction_v2 is enabled. Reproduce in a long-running session, capture successive “Context compacted” entries, and determine why compaction triggers again after the first operation. Done means compaction no longer recurs unless the context genuinely crosses the threshold.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- ai, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100