anthropics / anthropics/claude-code
[BUG] Connection drops and recent messages lost after re-logging in
- Dominant language
- Python
- Stars
- 145k
- Forks
- 23.1k
- PR merge metrics
- PR metrics pending
Description
### Preflight Checklist
- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) 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 reconnecting to a Claude Code session (remote/mobile access) after a disconnect ("Cannot connect to computer"), several of the most recent messages/turns from right before the disconnect are lost. Severity varies — sometimes only ~5 recent messages, other times close to a full day's worth of conversation/work.
This is NOT caused by:
- Host PC sleep/standby (confirmed sleep timeout is set to "Never" on the host machine)
- Concurrent/duplicate logins (reproduces even with sequential single-session logins only)
- A specific machine (reproduces across different physical computers)
Since there's no indicator of what was or wasn't saved before the drop, in-progress project work becomes impossible to reliably continue after any disconnect.
### What Should Happen?
On reconnect, the session should restore up to the actual last durably-saved turn, and any message that failed to persist before a disconnect should be clearly flagged to the user (e.g. "not saved") instead of silently disappearing — so in-progress work is never lost without warning
### Error Messages/Logs
```shell
No stack trace/console error available. The only message shown to the user is the in-app disconnect notice:
"컴퓨터에 연결할 수 없습니다
절전 모드이거나 오프라인 상태일 수 있습니다. 다시 연결되면 이 세션이 재연결됩니다."
(Translation: "Cannot connect to computer. It may be in sleep mode or offline. This session will reconnect once reconnected.")
No error is shown when the reconnect happens and recent messages turn out to be missing — the loss is silent.
```
### Steps to Reproduce
1. Start a Claude Code session via remote/mobile access to a host machine.
2. Continue working normally until a disconnect occurs ("컴퓨터에 연결할 수 없습니다" / "Cannot connect to computer, may be asleep or offline").
3. Reconnect once the host is available again.
4. Observe that the most recent messages before the disconnect are missing, and work cannot be resumed from where it left off.
### Claude Model
Sonnet (default)
### Is this a regression?
No, this never worked
### Last Working Version
Not working
### Claude Code Version
2.1.252
### Platform
Anthropic API
### Operating System
Windows
### Terminal/Shell
PowerShell
### Additional Information
OS: Windows 11
Note: reproduced on multiple different machines, not tied to one device's power settings.
Contributor guide
No contributing guide indexed for this repository
Research direction
No repository files, tests, or code entry points are identified in the report. Start by reproducing the remote/mobile disconnect and reconnect sequence on Windows 11 with PowerShell, then trace how session turns are persisted and restored. Done means reconnecting restores the last durably saved turn and clearly flags any unsaved message instead of silently dropping it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell, python
- Domain
- backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100