Repository navigation
fix(remove): continue after per-target execution failures - #4357
Merged
Merged
Conversation
Ordinary hook and removal failures now report their diagnostics and allow the remaining validated targets to run. Preserve immediate cancellation for interrupted children and return a failing batch status after partial success. Build JSON entries from each successful target so failures cannot shift branch identities. Cover foreground and background hook failures, execution-time dirty refusals, current-last ordering, and SIGINT/SIGTERM cancellation.
worktrunk-bot
left a comment
Collaborator
There was a problem hiding this comment.
This changes what wt remove a b c deletes after a failure. Before, a pre-remove hook failure or a Git failure on a stopped the batch, so b and c (and the current worktree, which runs last) were kept. Now those later targets are removed. Each target still has its own validation, pre-remove hook, and Git dirty check, and the user named every target, so this looks intended. But it widens when worktrunk deletes, so under the repo's data-loss hold (.claude/skills/running-tend/references/review-pr.md) the merge decision stays with @max-sixty and this review doesn't approve it.
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.
A pre-remove hook or synchronous Git failure in one target currently stops a multi-target removal before later targets are attempted. Continue with the remaining valid targets, report each ordinary failure, and return exit status 1 if any target failed. JSON includes successful targets in execution order, including branch-only removal and the current worktree executed last.
SIGINT and SIGTERM cancel the batch immediately with exit status 130 or 143. Preserve the underlying error in foreground removal diagnostics so a captured Git interruption reaches the batch cancellation check.
Validation: 5,068 tests passed (one skipped), doctests and documentation build passed, and all final pre-commit checks passed. Integration coverage exercises hook and execution-time removal failures in foreground/background modes, correct JSON attribution, and hook/Git interruptions, including a detached checkout. Four Git-interruption regressions fail against the original executable and pass with this change; independent review found no remaining issues. Help and generated documentation checks passed after updating from main.