Open general

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

Drew Owens · 19d ago

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).

0 Replies

Log in to reply.