Skip to content

Context percentage shows zero after compaction #9417

Closed

Description

@ozan-s

What version of Codex is running?

codex-cli 0.87.0

What subscription do you have?

Pro

Which model were you using?

gpt-5.2

What platform is your computer?

Darwin 24.6.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

Ghostty

What issue are you seeing?

After compacting conversation, the context percentage indicator shows zero.

• Context compacted

› Summarize recent commits

What steps can reproduce the bug?

Uploaded thread: 019bc711-8999-7be0-ad56-74632c16a11b

What is the expected behavior?

No response

Additional information

No response

Activity

  1. changed the title [-]Context percentage shows zero after compaction #9416[/-] [+]Context percentage shows zero after compaction[/+] on Jan 17, 2026
  2. github-actions commented on Jan 17, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  3. added
    contextIssues related to context management (including compaction)
    on Jan 17, 2026
  4. etraut-openai commented on Jan 24, 2026

    @etraut-openai
    Contributor

    Did the context percentage indicator show 0% context remaining or 0% consumed? It should show 0% consumed (or something close to 0%) after a compaction.

  5. ozan-s commented on Jan 25, 2026

    @ozan-s
    Author

    It showed 0% remaining.
    I had remote compaction on, send the /compact command. While compaction was ongoing, I wanted to queue the next message, but instead of tab, I pressed enter so the message went as a steer. Then when compaction was done, status bar showed "0% context left" and I wasn't able to send a new message.
    Hope this helps.

  6. swordfish444 commented on Jan 26, 2026

    @swordfish444
    Contributor

    @etraut-openai The repro detail from @ozan-s (pressed Enter during remote compaction so the queued message got sent as a steer) really sounds like a race between the in-flight compaction and user input that leaves the client/session in a bad local state (context remaining = 0% and can’t send).

    Potentially-related “context remaining jumps to 0%” reports: #9601 (rollback/backtrack) and #9257 (edit/backtrack). Might be worth consolidating under a single umbrella if the root cause is the same (token usage recompute / context manager state after history mutation).

    Possible UX/guardrail: while compaction is in-flight, block sending turns (or buffer locally until the compact completes) so we never send a steer / turn mutation against a moving target. On completion, it may also help to refresh token usage from server-provided counts (or clear to unknown) rather than leaving a 0% sentinel.

  7. etraut-openai commented on Jan 30, 2026

    @etraut-openai
    Contributor

    We're not able to repro the problem as reported. Are you still seeing this with the latest version of the CLI? If so, please provide more details.

    We recently changed our contribution guidelines to indicate that we're no longer accepting unsolicited PRs, so I'm going to close your PR. Let's use this thread to continue the discussion to further analyze the problem if it still exists.

  8. etraut-openai commented on Jun 29, 2026

    @etraut-openai
    Contributor

    Thanks for reporting this problem. Until recently, Codex used a separate endpoint and server-side logic for compaction. We recently switched to a more robust approach where the compaction logic is moved locally using the same endpoint as normal turns. This eliminates "remote compaction" errors and increases the stability and reliability of compaction operations. If you see further problems with compaction, please use /feedback and open a new bug report.

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

    bugSomething isn't workingcontextIssues related to context management (including compaction)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions