[BUG] [BUG] Remote session stuck "Reconnecting" ~95% of the time despite healthy network/server
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?
Remote-control client session shows "Reconnecting to ubuntu@[IP]..." roughly 95-97% of the time during active use. Occasionally hard-fails with "Lost connection... SSH transport dropped, auto-reconnect didn't succeed."
Started right after migrating the backing EC2 instance to new hardware (same Elastic IP, new instance ID, root EBS volume carried over from the old instance).
Extensive diagnosis ruled out all infrastructure causes:
- Server CPU/memory/disk confirmed idle at time of drops
- Network interface: 0 errors, 0 drops
- AWS CloudWatch (CPU/network/disk) nominal for affected windows
- AWS instance/system/EBS status checks: all passed, no alarms
- Security group correctly scoped to client's actual IP
- Raw TCP connectivity to port 22 tested 100% successful (38/38 attempts) during an active "Reconnecting" episode
- SSH host key on client confirmed to exactly match server's current key
- sshd keepalive config confirmed non-aggressive
Reconnects correlate with long-running, silent server-side tool executions (observed: a background job running 60+ minutes with no output). Suspect the client's application-level session-liveness/heartbeat check times out independently of actual SSH transport health, misidentifying a healthy-but-quiet session as dead.
Note: The affected session is Claude Desktop's remote-connection feature (not a CLI/terminal session). Diagnostic commands referenced above were run in a separate local PowerShell window purely to test network connectivity, not inside the affected session itself.
What Should Happen?
Remote session should maintain a stable connection during normal use, including while a long-running background command is executing with no output. It should not show "Reconnecting" when the underlying SSH connection is healthy, and reconnects that do occur should succeed reliably rather than requiring a manual retry.
Error Messages/Logs
Client UI error banner:
"Lost connection to ubuntu@[your-IP]. The SSH connection dropped and auto-reconnect didn't succeed. Your session is preserved on the remote host — resend your message to reconnect and pick up where you left off. If it keeps failing, check that the host is reachable (VPN, network) and your SSH agent is unlocked."
Details shown: "SSH transport dropped"
Server-side sshd log during one observed drop (6 new connections in 33 seconds, several opening/closing within the same second):
Jul 06 13:16:53 sshd-session: Accepted publickey ... session opened
Jul 06 13:17:20 sshd-session: Accepted publickey (x5 in same second) ... session opened / session closed
Jul 06 13:17:26 sshd-session: Accepted publickey ... session opened
(stabilized to one persistent connection after this burst)
Steps to Reproduce
- Connect to a remote server via Claude Code's remote-control feature (SSH-based session to an AWS EC2 instance)
- Run a command that produces no output for an extended period (observed trigger: a background job running 60+ minutes silently)
- While that command is running, leave the client idle or let it sit without new interaction
- Client UI intermittently shows "Reconnecting to ubuntu@[IP]..." — occurs roughly 95-97% of the time in this environment
- Occasionally results in a hard failure: "Lost connection... SSH transport dropped, auto-reconnect didn't succeed"
Note: Not a clean deterministic repro — appears environment/timing-dependent. Started immediately after migrating the backing EC2 instance to new hardware (same Elastic IP, new instance ID). Full diagnostic evidence ruling out network/server/AWS/host-key causes is in the bug description above — happy to provide the raw logs/session IDs if useful for debugging.
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.90 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Other
Additional Information
Note: The affected session is Claude Desktop's remote-connection feature (not a CLI/terminal session). Diagnostic commands referenced above were run in a separate local PowerShell window purely to test network connectivity, not inside the affected session itself.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗