Repository navigation
Serialize signal receipt with foreground child admission - #4596
Merged
Merged
Conversation
worktrunk-bot
previously approved these changes
Oct 26, 2026
worktrunk-bot
dismissed
their stale review
October 26, 2026 06:39
Codecov patch check failed: 17 uncovered added lines; AGENTS.md requires this merge gate to pass or explicit approval.
Collaborator
|
The |
worktrunk-bot
approved these changes
Oct 26, 2026
1 task
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.
Ctrl-C during concurrent hook startup could leave
wtwaiting forever after an existing child finished cleanup. If the kernel assigned SIGINT to another thread and delayed its handler, the spawning thread could admit children that missed both the terminal signal and the cancellation checks.Initialize one Unix thread that owns signal receipt and process creation. Other threads inherit blocked SIGINT/SIGTERM; the owner and its children retain the inherited mask. Run foreground admission checks on that owner, preserving cleanup for previously admitted children. Child execution and waits remain concurrent. Library callers that omit early startup initialization retain their existing direct-spawn behavior.
Reproduced the failure on both the reported revision and current main by pausing native SIGINT delivery with Linux ptrace: late shell children survived after
CLEANUP_FINISHED, andwttimed out waiting for them. Under the repair, the same pause admitted no additional children and the command exited with 130 after cleanup. This reproduces the reported failure mode; the original CI log alone cannot establish its precise scheduling history.Validation:
--initso orphaned children were reaped.wt listtiming: baseline median 21.36 ms, repair 21.28 ms over 20 alternating samples each (nine worktrees, four dirty).Closes #4511.