fix(host-service): attempt daemon auto-update even when live sessions are present

Merged
KI
4mo ago
+7-55

Summary

Background daemon auto-update deferred whenever the org had any alive PTY session (live_sessions_present) and never retried until the next host-service restart. For a busy org this means auto-update effectively never runs and the user has to click Update daemon manually (which is how the v1.16.0-era 0.2.5 daemons stayed behind after canary moved to 0.2.6).

The gate protected nothing: update() is the non-destructive fd-handoff (live sessions move to the successor, original shell PIDs survive), and on failure the predecessor keeps running with updatePending still set and the failure surfaced in Settings.

  • runAutoUpdate now goes straight to startUpdate(); removed the listSessions prelude and the live_sessions_present / session_list_unavailable defer paths
  • Deleted the now-dead deferAutoUpdate, countAliveSessions, and AUTO_UPDATE_SESSION_LIST_TIMEOUT_MS
  • Existing updateInFlight coalescing still prevents an auto-update racing a manual click

Test Plan

  • Replaced the defer test with "attempts the handoff even when live sessions are present" (still seeds a live session; fails if a session gate is reintroduced, verified by mutating the impl)
  • bun test src/daemon/DaemonSupervisor.test.ts 51/51 pass
  • host-service typecheck and bun run lint clean

Summary by cubic

Auto-update now runs even when live PTY sessions are active, so busy orgs no longer get stuck on old daemons. The handoff is still non-destructive; if it fails, the predecessor keeps running.

  • Bug Fixes
    • runAutoUpdate calls startUpdate() directly; removed session list gating and defer paths.
    • Deleted dead code: deferAutoUpdate, countAliveSessions, AUTO_UPDATE_SESSION_LIST_TIMEOUT_MS.
    • Existing updateInFlight coalescing still prevents races with manual updates.