Session terminates with 'Sock-hopping' on long-running bash commands (~4+ min) in WSL2

Resolved 💬 2 comments Opened May 24, 2026 by gkvas Closed May 28, 2026

Summary

Claude Code terminates mid-session when a bash tool call takes approximately 4 or more minutes to complete. The session ends with a Sock-hopping… message and a resume ID. This is a regression — the same workflow ran without issue on earlier versions.

Environment

  • Claude Code version: 2.1.150
  • Platform: WSL2 (Ubuntu, version 2) on Windows
  • Shell: bash
  • Model: Claude Sonnet 4.6

Steps to reproduce

  1. Start a Claude Code session inside WSL2
  2. Trigger (or instruct Claude to run) a bash command that takes 4+ minutes (e.g. a large test suite: python -m pytest)
  3. Wait without interacting with the UI

Observed behavior

After ~4 minutes of waiting for the bash command to complete, the session prints:

* Sock-hopping… (4m 25s · ↓ 1.9k tokens)

followed immediately by:

Resume this session with:
claude --resume <session-id>

and the process exits. The bash command output is never returned and the tool call never completes.

Expected behavior

Claude Code should hold the streaming connection open (or transparently reconnect) while a bash tool call is running, and complete the tool call regardless of duration. A 4-minute test run should not terminate the session.

Notes

  • The ctrl+b background option is not a viable workaround for unattended/automated workflows
  • Session checkpointing appears to work correctly (resume ID is printed)
  • This did not occur on earlier versions of Claude Code — it appears to be a regression introduced at or before 2.1.150
  • Hypothesis: the streaming connection to the Anthropic API is being dropped due to inactivity while the CLI waits for the subprocess to finish, and the reconnect ("sock-hopping") fails rather than recovering transparently

View original on GitHub ↗

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