fix: don't leave hooks permanently marked as running when a run fails - #13
Closed
usefulish wants to merge 1 commit into
Closed
fix: don't leave hooks permanently marked as running when a run fails#13usefulish wants to merge 1 commit into
usefulish wants to merge 1 commit into
Conversation
A hook whose command failed to spawn, or whose process could not be handed to the reaper thread, stayed marked as running forever: with allow_concurrent unset the hook never ran again. Unmark it on both failure paths, and make the reaper survive a process status check error instead of exiting, which was the main way the handoff channel could close in the first place. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
desbma
added a commit
that referenced
this pull request
Jul 15, 2026
Owner
|
Thanks for the report, the leak on the failure paths is real, but I reworked the fix differently in ea283e1, so closing this. Two notes on the premise:
The committed fix instead ties the "running" mark to the child process lifetime: the reaper channel carries a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
hook::runinserts the hook id intorunning_hooksbefore spawning, but never removes it if the spawn fails or if handing the child to the reaper fails (reaper gone → closed channel). Either failure leaves the hook permanently marked as running: withallow_concurrentunset it never runs again for the daemon's lifetime.This unmarks the hook on both failure paths, and makes the reaper survive a
try_waiterror instead of exiting its loop (a dead reaper closes the handoff channel, which is what makes the second path reachable; that last part has no unit test sincetry_waitcan't easily be made to fail).Red-green tests:
failed_spawn_unmarks_hookandreaper_handoff_failure_unmarks_hookboth fail on master (the id stays inrunning_hooks), pass with the fix.🤖 Generated with Claude Code