Closed general

Sleep/resume: all Claude Code sessions closed on wake (WSL2 suspended → code-server unhealthy → VS Code iframe hard-reload)

Drew Owens · 1mo ago ·closed by John Lauer

Type: Bug report

Symptom: Put the laptop to sleep with several Claude Code sessions open in HD; on wake, all Claude sessions were gone (VS Code reloaded fresh). HD itself stayed open — this was not a crash or relaunch.

Logs pulled from the host by Claude via adom-desktop:

  • HD: %APPDATA%\hydrogen-desktop\hydrogen-desktop.log (283 KB)
  • AD: %LOCALAPPDATA%\inc.adom.desktop\logs\Adom Desktop.log

Environment: HD v0.1.95, build ec8551c5ed2353c5408435d44ebc6d3b3c85ef01-dirty. WSL2 runtime (distro Adom-Workspace), code-server on localhost:7380.

Timeline

  • Sleep ≈ 2026-07-01 20:28:38 — last pre-sleep line, and notably code-server was already unhealthy:
    20:28:38.747 [workspace] SSE client disconnected (heartbeat)
    20:28:38.748 [wsl] Workspace unhealthy — Adom-Workspace code-server not responding, needs restart
    20:28:38.756 [heartbeat] alive 26150s
    
  • Wake ≈ 2026-07-02 09:43:14 — ~13 h wall-clock later, but the very next heartbeat is:
    09:43:14.886 [heartbeat] alive 26160s
    

HD was suspended, not restarted. The monotonic uptime counter advanced only 10 s (26150 → 26160) across a ~13-hour wall-clock gap — the whole HD process was frozen by the OS during sleep. There is no new === Hydrogen Desktop started === marker, confirming no relaunch.

What tore down the Claude sessions (resume cascade)

09:43:14.870 Update check failed (network not back yet)
09:43:20.483 [ad-supervisor] AD health probe failed - attempting respawn
09:43:22.715 [ad-supervisor] respawned AD pid=29644
09:43:23.687 [workspace] SSE client connected
09:45:01.036 [frame-nav] ALL: http://localhost:7380/?folder=/home/adom/project   <-- full VS Code workbench reload

The Claude Code sessions run in VS Code integrated terminals inside the WSL distro's code-server. On OS sleep, WSL2 is suspended; on wake, code-server comes back unhealthy and HD reloads the VS Code iframe from scratch (the frame-nav to …/?folder=/home/adom/project). A full workbench reload re-initializes the terminal UI, so the running Claude TUI sessions are discarded.

Corroborating: code-server is flaky under sleep/idle

[wsl] Workspace unhealthy — Adom-Workspace code-server not responding, needs restart fires repeatedly even without sleep — 17:43:17, 19:01:32, 20:28:38 on Jul 1. Each unhealthy→reload is an opportunity to lose terminal sessions.

Root-cause hypothesis

No Claude-session persistence across a code-server / VS Code-iframe reload. WSL2 suspension during OS sleep + HD's health-check-driven hard reload on resume = integrated terminals (and their Claude processes) are gone, with nothing to reattach to.

Suggested directions (for John)

  1. Reattachable terminals in the distro — run Claude sessions under tmux/screen (or a persistent PTY broker) so a code-server/iframe reload can reconnect instead of orphaning them.
  2. Resume-aware recovery — detect resume-from-sleep and try to reconnect code-server before hard-reloading the iframe; only reload as a last resort.
  3. Session restore UX — if a reload is unavoidable, persist the open-session list and offer one-click restore, and warn the user rather than silently dropping them.
  4. Investigate why code-server is flagged unhealthy so frequently under idle — reducing spurious reloads would cut session loss independent of sleep.

Full logs available on request (mostly [heartbeat]/[focus]/pushLayoutToProxy noise outside the excerpts above).

1 Reply

John Lauer · 9d ago

Closing after review with John (2026-08-01).

What this issue actually amounts to: on wake, the workbench reloads and running Claude turns stop. The conversations themselves are NOT lost. Claude Code persists every session to disk, the tabs re-instantiate on reload, and each thread picks up when you tell it to continue. John confirmed his tabs come back fine after reloads.

So the "all sessions closed" framing overstates it. A reload pauses in-flight turns; that is inherent to how Claude Code works (a process cannot keep running through the host suspending the VM it lives in), and it is not something HD can or should try to fix.

What remains real from this report is the resume cascade itself (WSL2 unhealthy on wake, code-server restart). That plumbing keeps getting hardened separately (bounded probes, wedge canary, stats decoupled from wsl.exe). If a wake ever produces a workbench that does NOT come back (blank editor, tabs genuinely gone, layout wiped), file that as its own bug with the log window, since that would be a real defect rather than paused turns.

Log in to reply.