Skip to content

fix(hooks): detach daemon from spawning session so terminal SIGHUP can't kill it mid-run#87

Open
titothedeveloper wants to merge 1 commit into
mainfrom
fix/detach-daemon-from-session
Open

fix(hooks): detach daemon from spawning session so terminal SIGHUP can't kill it mid-run#87
titothedeveloper wants to merge 1 commit into
mainfrom
fix/detach-daemon-from-session

Conversation

@titothedeveloper

Copy link
Copy Markdown
Contributor

Split out of #86 per review (@rgao-coreweave noted the hook-handler change is a separate concern from the daemon-side cross-session fix).

Problem

The Weave daemon is started lazily by whichever Claude Code session's hook fires first. If that terminal closes mid-run (engineer closes the tab), the resulting SIGHUP kills the daemon and wipes its in-memory cross-session team map — breaking agent-teams nesting for every still-running specialist.

Fix

nohup makes the daemon ignore SIGHUP; disown detaches it from the shell's job table. macOS has no setsid, so nohup+disown is the portable detach. The daemon still self-reaps via its inactivity timeout, so it won't linger.

Observed live: repeated daemon restarts during a multi-session /triage (a closing coordinator terminal was one cause) orphaned specialist spans. Pairs with the inactivity-guard in #86 — together they keep the daemon alive across an agent-teams run's quiet windows and terminal churn.

🤖 Generated with Claude Code

The daemon is started lazily by whichever Claude Code session's hook fires first.
If that terminal closes mid-run (engineer closes the tab), the resulting SIGHUP
kills the daemon and wipes its in-memory cross-session team map — breaking
agent-teams nesting for every still-running specialist. nohup makes the daemon
ignore SIGHUP; disown detaches it from the shell's job table. macOS has no setsid,
so nohup+disown is the portable detach. The daemon still self-reaps via its
inactivity timeout, so it won't linger.

Split out of #86 per review (separate concern from the daemon-side fix).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@titothedeveloper titothedeveloper requested a review from a team as a code owner June 11, 2026 21:02
@github-actions

Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@rgao-coreweave rgao-coreweave left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting find, thanks!

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.

2 participants