Files
worktrunk/tests/common
Worktrunk Botandworktrunk-bot db1ff5b2a8 test: report wt's signal receipt and live job processes when a SignalJob test hangs (#4749)
When a `SignalJob` test times out, it now reports enough to tell which
process hung. Previously it panicked with only `wt did not finish`, and
the test's tempdir, which held wt's `-vv` trace, was deleted with it.
The panic now lists the job group's live processes (`pid ppid pgid stat
comm`) and wt's `Foreground …` trace instants. On the next occurrence of
#4748's macOS hang, that output shows whether wt recorded `Foreground
signal received:2` and whether wt or its hook shell is still running.

This PR doesn't fix the hang. I couldn't reproduce it on Linux, so a fix
would be a guess. Runs of the test and of its hook script alone, under
each shell that might be `/bin/sh`, all passed:

| What ran | Shell | Hangs |
|---|---|---|
| Hook script alone, SIGINT sent to its process group at a random point
| dash, bash 5.2, bash 3.2.57 (macOS's `/bin/sh` version, built from
source and run as `sh`) | 0 of 2,900 |
| The full test | dash | 0 of 60 |
| The full test, with four CPU-bound loops running | bash 3.2.57 as `sh`
| 0 of 150 |

To check the new output, I temporarily changed the hook's trap to `trap
':' INT` so the hook can't exit. The test then failed with:

```
wt did not finish
wt pid 69624; job processes (pid ppid pgid stat comm):
  69623   69611   69623 Z    sleep
  69624   69611   69623 Sl   wt
  69667   69624   69623 S    sh
  69877   69667   69623 S    sleep
foreground trace:
Foreground admitted:69667
Foreground signal received:2
```

The five integration modules that use `SignalJob` (`remove`,
`user_hooks`, `for_each`, `step_alias`, `step_prune`) pass locally: 571
tests.

Refs #4748 — automated triage

Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
2026-11-09 00:08:59 -08:00
..