Skip to content

fix(remove): continue after per-target execution failures - #4357

Merged
max-sixty merged 8 commits into
mainfrom
codex/remove-continue
Oct 3, 2026
Merged

max-sixty merged 8 commits into
mainfrom
codex/remove-continue

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 3, 2026 •

Copy link
Copy Markdown
Owner

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.

This was written by Codex on behalf of max-sixty

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 worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

@max-sixty
max-sixty merged commit fc044f9 into main Oct 3, 2026
37 checks passed
@max-sixty
max-sixty deleted the codex/remove-continue branch October 3, 2026 18:11
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