Auto-Compaction Indicator at start of turn
What feature would you like to see?
When Codex-CLI decides it is time to auto-compact, having an indicator of some kind would be helpful.
Additional information
Sometimes during a session I will have something like 25% context left (so I'm not expecting auto-compaction at that moment), and after submitting a prompt, if Codex determines it is time to auto-compact before --- Working for appears (presumably when the first SSE event happens), it looks like the CLI is frozen. I panic and go "did I break something?" Close the CLI, reopen, resume chat, submit prompt again, and it's frozen again. If I wait long enough, after a few minutes it says "Context Compacted" and then --- Working for appears. Auto-compaction mid-turn is fine because the UI shows activity happening, but when it happens at the beginning of the turn it's not obvious and that's pretty much the enhancement I'm asking for.
6 Comments
@etraut-openai I have noticed it some times randomly compacts without notifying and also at 25% usage only. I don't have a screen-shot, but saw it happen.
I’m happy to investigate why this is triggering early and implement the notification so it's no longer a 'silent' process. Could you please assign this to me? I'd like to submit a PR for it.
@etraut-openai
@vyalamar, you're welcome to investigate the problem. We're not really interested in a PR but are interested in your analysis if you find something. I'm guessing that what you're seeing is a large tool output that quickly fills most of the remaining context window. That would explain why you see 25% usage followed by an auto compaction. But if you think that there's some other explanation, you're welcome to investigate further.
~~I think it's happening on long conversations. I'm guessing the model supports >300k tokens, advertised as 256k tokens, and remote compaction eats away at the "above 256k" limit. As more and more remote compactions occur, it starts auto-compacting at a higher % than whatever the baseline is (maybe 15% as observed in new conversations).~~
~~I'm totally fine, if there's a mechanism compacting at a higher percentage to account for stuff like that (or perhaps it computes a sensible percentage based on inputs between events), totally makes sense. I'm mostly just concerned with at rest, when I send "Good job, proceed with Option # 1" as my input prompt, the TUI looks frozen for several minutes, then suddenly says "Context Compacted". It's unnerving not knowing the status during that time 😅~~
Speculation crossed out. Thanks for looking into it 😁
The model supports 400K tokens total but can output up to 128K tokens. That leaves 272K tokens for input before there's a risk of an overflow. Auto-compaction occurs when 90% of that limit (244.8K) is consumed.
Yes, we could do a better job in the UI here. The team is exploring some options here.
It appears to be fixed! Thank you so much 😊 I don't know which PR did it but I saw an indicator so I'm stoked!