[BUG] Context window display shows stale "Messages" count from previous session on new session start — corrects after first message

Resolved 💬 2 comments Opened Jun 1, 2026 by alexkurnosov Closed Jun 5, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When switching from an old session that is at or near the context limit to a new session, the context window indicator in the Desktop app incorrectly shows a large \"Messages\" usage value carried over from the previous session. The display self-corrects as soon as the first message is sent.

Example: New session shows 76.9k / 200.0k (38%) used, with \"Messages\" accounting for 64.7k (32.3%) — before any user interaction.

Steps to Reproduce

  1. Have an existing session open that is at or near its context limit
  2. Start a new session (e.g. via the Sessions list in the sidebar)
  3. Before sending any message, open the context window breakdown
  4. Observe \"Messages\" shows a large inflated value inherited from the previous session
  5. Send any message — the display corrects itself to near-zero

What Should Happen?

A new session should start with \"Messages\" at 0 (or near-zero) in the context window display.

What Happens Instead?

The UI carries over the \"Messages\" token count from the previous (context-full) session. The stale value is shown until the first message is sent, at which point it resets to the correct value.

Claude Code Version

1.9659.2 (macOS Desktop App)

Platform

macOS

Additional Information

The bug is reproducible: switching away from a full session and back to a new one consistently reproduces the inflated count before the first message.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗