Skip to content

fix: 60s grace period on crash detection for spawned sessions#69

Merged
dcetlin merged 1 commit into
mainfrom
fix/spawn-crash-grace
Jul 1, 2026
Merged

fix: 60s grace period on crash detection for spawned sessions#69
dcetlin merged 1 commit into
mainfrom
fix/spawn-crash-grace

Conversation

@dcetlin

@dcetlin dcetlin commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Consolidates four bugs in the crash detection category into one fix:

  1. Remove duplicate death checkbridge-server.ts socket.on('end') had both checkSessionDeath() AND an inline copy, producing double 💀 notices on genuine crashes
  2. OR → AND in health poll — only flag as crashed when BOTH tmux dead AND bridge disconnected. Bridge-only disconnects are handled by the bridge-server disconnect handler (3s delay). The OR condition false-positived on temporary bridge drops and newly spawned sessions
  3. Health poll sets deadAt — now consistent with checkSessionDeath(). Previously only added to crashAlerted without marking the session dead, leaving the door open for a second death notice from other paths
  4. 60s spawn grace period — skip crash detection for sessions younger than SPAWN_GRACE_MS

Net -9 lines. 2 files changed.

Config change (not in PR)

Added DEFAULT_SESSION_CHANNEL=D0B86C5250C to ~/.claude/channels/slack/.env — fixes Home tab spawn routing Discord channel ID on Slack.

Test plan

  • All 874 tests pass
  • Spawn a session — no false death notice during bridge connect window
  • Kill a session's tmux — death notice fires after 3s (bridge-server path)
  • Health poll catches a genuinely dead session (tmux + bridge both gone)
  • Bridge disconnect with tmux alive — no false death notice from health poll

🤖 Generated with Claude Code

@dcetlin dcetlin force-pushed the fix/spawn-crash-grace branch from c9bae34 to f124a88 Compare July 1, 2026 21:47
…adAt

Four fixes to the crash detection category:

1. Remove duplicate inline death check in bridge-server.ts socket.on('end')
   — checkSessionDeath() already covers this case via setTimeout. The inline
   copy fired in parallel, producing double death notices.

2. Health poll (daemon.ts) changed from OR to AND — only flag as crashed
   when BOTH tmux is dead AND bridge is disconnected. Bridge-only
   disconnects are handled by the bridge-server disconnect handler (3s
   delay + tmux check). The OR condition false-positived on temporary
   bridge drops and newly spawned sessions.

3. Health poll now sets info.deadAt + calls registry.persist() +
   threadRegistry update + refreshSessionVisual(), fully consistent
   with checkSessionDeath().

4. 60s spawn grace period — skip crash detection for sessions younger
   than SPAWN_GRACE_MS (bridge needs time to connect after spawn).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dcetlin dcetlin force-pushed the fix/spawn-crash-grace branch from f124a88 to 4a89826 Compare July 1, 2026 21:51
@dcetlin dcetlin merged commit 0522a14 into main Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant