[BUG] Session resumption restores context after /clear — bypasses context isolation
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?
While remote controlling a claude code session, I used /clear to wipe context between tasks. After starting the next conversation, the session was then "Resumed". When resumed, the old context was restored (details of the previous task reappeared in Claude code's thout process logs). This defeats the privacy/isolation purpose of /clear. In the second screenshot, you can see the instant claude gets confused about the perceived shift in topics. In the third screenshot, you can see claude has no knowledge of the message immediately preceding my question about Astro. Finally, the last screenshot shows claude's analysis of what occurred, after I provided a screenshot of our session and the moment a "resumed session" annotation appeared.
<img width="864" height="1939" alt="Image" src="https://github.com/user-attachments/assets/36eb2121-f716-4f4b-8993-aae2aa4073ac" />
<img width="864" height="1939" alt="Image" src="https://github.com/user-attachments/assets/4a40767f-a1c6-41d0-b0f8-0df6ea4c1eb8" />
<img width="864" height="1939" alt="Image" src="https://github.com/user-attachments/assets/34c20ec8-f8c7-4a84-8cc6-69487d8c8307" />
<img width="864" height="1939" alt="Image" src="https://github.com/user-attachments/assets/f4f40c22-8179-4c32-ae93-d5728f59fc29" />
What Should Happen?
Previous sessions should not auto-resume after being cleared.
Error Messages/Logs
Steps to Reproduce
I'm unsure how the "resumed session" was triggered, nor do I expect these steps to reliably repro this issue every time. My experience was as follows:
- Remote control a Claude code session.
- Engage in a conversation.
- Do nothing for several hours.
- Return to the conversation and immediately send
/clear. See the expected (no context) response, and the chat window has erased the prior conversation. - Begin a new conversation.
- While Claude is taking a turn, queue a message.
- Claude yields and the message is read.
- "Resumed session" appears.
- Claude's next turn appears correct - the previous context has not yet reappeared.
- Send another message.
- The context is now compromised.
Claude Model
Other
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.218
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗