Skip to content

Auto-Compaction Indicator at start of turn #9773

Closed

Description

@robertmsale

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.

Activity

  1. changed the title [-]Auto-Compaction Indicator[/-] [+]Auto-Compaction Indicator at start of turn[/+] on Jan 23, 2026
  2. vyalamar commented on Feb 1, 2026

    @vyalamar

    @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.

  3. vyalamar commented on Feb 1, 2026

    @vyalamar

    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

  4. etraut-openai commented on Feb 1, 2026

    @etraut-openai
    Contributor

    @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.

  5. robertmsale commented on Feb 1, 2026

    @robertmsale
    Author

    @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 😁

  6. etraut-openai commented on Feb 1, 2026

    @etraut-openai
    Contributor

    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.

    It's unnerving not knowing the status during that time

    Yes, we could do a better job in the UI here. The team is exploring some options here.

  7. robertmsale commented on Feb 5, 2026

    @robertmsale
    Author

    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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions