Skip to content

fix(process): retain command identity and native failure causes - #4352

Merged
max-sixty merged 12 commits into
mainfrom
codex/process-hook-diagnostics
Oct 11, 2026
Merged

max-sixty merged 12 commits into
mainfrom
codex/process-hook-diagnostics

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

Hook failures could lose the command’s source and native OS cause, and a failed concurrent spawn could cancel runnable siblings. Spawn and exit failures now retain names such as pre-merge project:check, carry the typed OS error through foreground diagnostics, background logs and traces, and preserve each concurrent member’s result so runnable siblings finish.

Child failures retain physical exit/signal status separately from observed cancellation. One shared status formatter and hook wrapper produce the diagnostics; unnamed background failures retain their configured command for identification.

Validation: full project pre-merge gate passed (5,245 tests passed, 1 skipped; Clippy, formatting, docs and doctests passed); Rust 1.98 all-target/all-feature check with warnings denied; actual Claude design and closure reviews. Focused LLVM coverage exercises concurrent preparation-failure cleanup.

This was written by Codex on behalf of max-sixty

@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.

SpawnError puts its I/O error in Display and also returns it from source(), so a renderer that walks the chain prints the OS error twice. The new alias_spawn_failure_has_one_source_detail snapshot shows it: Failed to execute sh @ _REPO_: No such file or directory (os error 2) and then a separate No such file or directory (os error 2) line. The test only counts Failed to execute, so the duplicate passes. A Rust error type should either show its cause or expose it as source(), not both. Hook messages print only the top-level {error}, so they need the text inline. That points to keeping the Display and dropping the source() impl. The outer io::Error still keeps the ErrorKind. Dropping it means the unit test that checks raw_os_error() == Some(2) through source() has to change.

codecov/patch is failing at 98.38%, with 5 missed lines. One is the dead Warn branch flagged inline. The others are the (None, None) arm of process_exit_description and the spawn_error calls on the timeout-run path in shell_exec.rs and in the spawn paths of concurrent.rs and run_pipeline.rs. Under AGENTS.md (Coverage), merging with a failing patch check needs explicit approval.

Comment thread src/commands/command_executor.rs Resolved
worktrunk-bot
worktrunk-bot previously approved these changes Oct 3, 2026
Comment thread src/output/concurrent.rs Resolved
@worktrunk-bot
worktrunk-bot dismissed their stale review October 3, 2026 03:45

codecov/patch failed on 7658abf (98.32% vs 98.39% target); AGENTS.md requires explicit approval to merge past it. The queued review covers the new head.

@max-sixty max-sixty changed the title Unify process failures and hook announcements fix(process): retain command identity and native failure causes Oct 10, 2026
@max-sixty

Copy link
Copy Markdown
Owner Author

@worktrunk-bot Please review current head 412083c8696e6e1a72e82771aed09723ec65aa19 and post an explicit verdict against that commit. The prior run reviewed 1b33cb6e6 but withheld a fresh verdict because patch coverage still failed.

The follow-up adds one regression through the real serialized background pipeline: a later template error cleans up an admitted concurrent child and resolves its trace. Focused LLVM coverage confirms each previously missed cleanup line in src/commands/run_pipeline.rs:265–269 has one hit. The full pre-merge gate passed: 5,213 tests passed, 1 skipped; Clippy, formatting, docs and doctests passed. The delta is test-only, independently reviewed, and the remote checks are running for this head.

This was written by Codex on behalf of max-sixty

@max-sixty

Copy link
Copy Markdown
Owner Author

@worktrunk-bot Please review current head 7c53b600a77eb1b26139972cba377ccae754fb55 and post an explicit verdict against that commit. The completed review run retained the approval on 412083c8696e6e1a72e82771aed09723ec65aa19; our readiness check requires a verdict on the current commit.

Since that approval, the cleanup test synchronizes on the stable command failure identity, and two clean merges include main through 7ac07ecf6. Independent Claude reviews found no issues in those deltas. The full project gate passed 5,245 tests (1 skipped), with Clippy, formatting, docs and doctests; the later docs/help-only merge passed 66 targeted help/docs-sync tests. No production repair was added after the prior approval.

This was written by Codex on behalf of max-sixty

@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.

Approving at 7c53b600a77eb1b26139972cba377ccae754fb55.

Since the approval on 412083c, the branch has one test change and two merges from main. The test change, 655d796, makes the cleanup test wait for Failed to expand user:broken: rather than also matching the undefined-value detail. That prefix still names the failing command, so the test still waits for that preparation failure before it checks the admitted child was reaped. Both merges are clean: git show --remerge-diff is empty for eb154ee and 7c53b60.

At this head, codecov/patch and test (linux)/(windows) pass. test (macos) is still running.

@max-sixty
max-sixty merged commit 0874f5f into main Oct 11, 2026
38 checks passed
@max-sixty
max-sixty deleted the codex/process-hook-diagnostics branch October 11, 2026 00:57
max-sixty pushed a commit that referenced this pull request Oct 11, 2026
…e changes (#4425)

Corrects internal comments and notes that recent changes left describing
old behavior. No code behavior changes; the one test edit is a rename.

- `src/commands/for_each.rs` — the module's design note listed `step` as
holding only `commit`, `squash`, `rebase`, `push` and `for-each`. It now
also has `diff`, `copy-ignored`, `eval`, `promote`, `prune`, `relocate`
and `tether`, so the note describes the grouping without an inventory
that goes stale again.
- `src/diagnostic.rs` — the module doc's report outline named a "Verbose
log" section; the template's section is "Trace log", and the outline
omitted the "Raw subprocess output" section. `write_diagnostic_file`'s
doc named `write_if_verbose()` as its caller; the direct caller is
`write_diagnostic()`.
- `src/commands/merge.rs` — after #4360 (`wt merge --branch`),
`post-switch` is only planned when the source is the current worktree,
but the comment said it always lands the user in the destination.
- `src/commands/run_pipeline.rs` —
`signal_exit_reports_named_signal_and_shell_exit_code` asserts `killed
by signal 15`; the signal is no longer named since #4352, so the test is
renamed to `signal_exit_reports_signal_and_shell_exit_code`.
- `.config/clawpatch/features/feat_custom_switch_resolve.json` — the
summary called PR/MR fetch "the one place" `gh`/`glab` is shelled out
to. `wt list` CI status (`src/commands/list/ci_status/`) and the
picker's PR rows also use them, and a review tool reading this summary
could flag those as violations.
- `.gitignore` — finishes a sentence in the clawpatch comment that ended
"derived/transient and not."

Comment-only changes have no regression test; the renamed test passes
locally.

Co-authored-by: worktrunk-bot <[email protected]>
max-sixty pushed a commit that referenced this pull request Oct 11, 2026
…lighting (#4427)

The nightly `feature-powerset` job ([run
38115848986](https://github.com/max-sixty/worktrunk/actions/runs/38115848986))
fails in `cargo test --no-default-features` on
`git::error::tests::snapshot_worktrunk_error_display`. #4352 added a
case to that test where an unnamed hook failure renders its template
(`echo test`) through `format_bash_with_gutter`. That output is only
highlighted when the `syntax-highlighting` feature is on, so without
default features the snapshot gets plain `echo test` and doesn't match.

This change moves that case into its own test,
`snapshot_unnamed_hook_failure_shows_template`, gated on `#[cfg(feature
= "syntax-highlighting")]`. `snapshot_worktree_creation_failed` in the
same module is already gated this way for the same reason. The other
assertions in `snapshot_worktrunk_error_display` still run in every
feature configuration. This only changes tests.

Verification: `cargo test --lib --no-default-features
snapshot_worktrunk_error_display` failed before the change and passes
after it. With default features, both tests pass. `cargo fmt --check`
and `cargo clippy --lib --tests --no-default-features -D warnings` are
clean.

Co-authored-by: worktrunk-bot <[email protected]>
max-sixty added a commit that referenced this pull request Oct 20, 2026
…ERM (#4523)

Since v0.80.0, an alias whose child dies by a signal other than
SIGINT/SIGTERM (for example `crash = "kill -KILL $$"`, or a segfaulting
program) exits 128+N with no output. v0.80.0 printed `✗ Killed by signal
N`. #4352 and #4400 limited interrupt classification to SIGINT/SIGTERM,
so these deaths now reach `alias_error_wrapper`, which turns every child
exit code into a silent `AlreadyDisplayed`. wt exits normally rather
than dying by the signal, so the shell reports nothing either.

`alias_error_wrapper` now maps a child exit with a physical signal to
`WorktrunkError::Interrupted`, the variant custom subcommands (`wt-foo`)
already use for the same case. It renders `Killed by signal N` and exits
128+N. SIGINT and SIGTERM still short-circuit earlier and are re-raised
for the shell to report, as AGENTS.md "Signal Handling" specifies, so
`kill -TERM $$` stays silent from wt. Hooks and `wt step for-each`
already report the signal in their own failure lines and are unchanged.

Verified with the release-review repros: SEGV and KILL aliases print `✗
Killed by signal 11` / `9` and exit 139 / 137, matching v0.80.0, for
single, multi-step and concurrent aliases; `exit 2` stays silent. The
new unix-only `test_step_alias_killed_by_signal` snapshot fails without
the fix.

> _This was written by Claude Code on behalf of max-sixty_

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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