[BUG] Remote Control reconnect replays full session context causing duplicate usage/token inflation

Resolved 💬 1 comment Opened Jun 8, 2026 by Trishank-K Closed Jul 15, 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 using Claude Code in a remote session, if the session disconnects and later reconnects, the entire previous conversation context appears to be added again to usage/token accounting.

This causes usage to spike unexpectedly after reconnecting, even when no significant new prompts were added. It looks like the reconnect process may be replaying or reattaching the full session context instead of resuming cleanly.

The issue happens consistently after temporary network interruptions or remote session reconnects.

What Should Happen?

Claude Code should resume the existing remote session without duplicating previously loaded context or re-counting old conversation history toward usage.

After reconnecting, usage/token counts should only increase for new prompts and responses generated after the reconnect event.

Error Messages/Logs

Steps to Reproduce

  • Start a new Claude Code (server) remote control session .
  • Have some conversation to fill the context, a good number would be 100k context filled for Opus models from the claude code UI
  • Let the remote session disconnect temporarily either by leaving the session idle, or restarting claude code UI.
  • If the context window metric does not appear, consider it disconnected, like this

<img width="408" height="190" alt="Image" src="https://github.com/user-attachments/assets/21801b4f-3cc0-4bd3-8907-de21815b9d0e" />

  • Still connected would look like this:

<img width="387" height="214" alt="Image" src="https://github.com/user-attachments/assets/be96ed2c-a396-4eb9-95c4-3043813057a5" />

  • Reconnect to the same remote session and just send a simple hello.

Observe that usage/token in the context window which now appears haven't increased significantly immediately after reconnecting, but the usage increases a whole lot.

Claude Model

Not sure / Multiple models

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.162 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗