Test runs whose workers start in their own session are no longer killed as stalled (GST-3213) (#4533)

/ship's test check no longer kills a quiet, working test run as stalled
when the test command starts its workers in their own session, as pnpm
11's `pnpm exec` does for Vitest.

Why: the stall check read CPU time from the command's process group
only, where just the idle launcher was left; it now counts every process
descended from the command.

Nothing to do: a truly hung run is still killed at the same stall
timeout, and every threshold is unchanged.

Co-authored-by: dtoelke <14206719+dtoelke@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-11-19 16:54:44 +00:00
1 parent 104fc72757
commit 50cc282273
8 files changed
+156 -36

No files matched your search

+12 -6
View File
@@ -540,14 +540,18 @@ test-tier command:
a one-file run (each serial file) reports its file from the launch for any
runner. Other runners (node --test, vitest, jest, pytest, playwright test, flutter test, dart test, cargo test) get heartbeats
only. A heartbeat follows each 60 s with no progress line;
- is killed as **stalled** when its log does not grow and its process group
- is killed as **stalled** when its log does not grow and its process tree
stays under a tenth of one CPU for the stall timeout (`--stall-timeout <s>`, else
`stall_timeout_s`, else 300; `0` disables): the check is `incomplete` with
`PREGATE_STALLED` and names the last file started; the next serial file
still runs. The group counts as busy when its CPU time, sampled each second,
still runs. The process tree is the command's process group plus every
descendant reached by parent links, whatever session it moved to, so a
worker a launcher starts in its own session (pnpm 11's `pnpm exec` running
Vitest) counts. The tree counts as busy when its CPU time, sampled each second,
grew by at least a tenth of the wall time, so a quiet suite that is working
(FOUN-63: a parallel `check.sh` silent for 9 minutes) is not killed, while
a hang that waits on nothing is. A hang that keeps burning CPU is left to
a hang that waits on nothing is. A descendant reparented away from the tree
(a double-forked daemon) no longer counts. A hang that keeps burning CPU is left to
the timeout. Linux reads `/proc` (exited children's time included once
reaped); macOS and other BSDs read `ps -S`; a failed read skips that
sample. Windows reads no CPU time here and uses log growth alone. The `--remote` gate is exempt: a
@@ -558,9 +562,11 @@ test-tier command:
serial files that each fit still pass): the check is `incomplete`, its detail
names which of the three set the timeout, and the next serial file still runs.
A kill is SIGTERM to the group, then SIGKILL after 5 s (a group that ignores
SIGTERM still dies). SIGINT or SIGTERM to `gstack-pregate` itself SIGKILLs every
running group, writes no `pregate.json` and exits 130 or 143. Windows has no
A stall or timeout kill is SIGTERM to the process group of every tree member,
then SIGKILL to the same groups after 5 s (a group that ignores SIGTERM still
dies, and a worker in its own session is not left running). After a normal exit
only the command's own group is killed. SIGINT or SIGTERM to `gstack-pregate`
itself SIGKILLs every running tree, writes no `pregate.json` and exits 130 or 143. Windows has no
process groups here: the kill is `taskkill /T /F` on the shell's tree, which
misses a descendant that was reparented or started detached.
+2 -2
View File
@@ -4846,9 +4846,9 @@ missing checks needs a full `gstack-pregate --allow-repo-commands` (neither
<a id="pregate-stalled"></a>
### `PREGATE_STALLED`
**Meaning.** A test command the lanes check (or a guard) launched wrote nothing to its log, and its process group used under a tenth of one CPU (Windows: log growth alone), for the stall timeout (default 300 s,
**Meaning.** A test command the lanes check (or a guard) launched wrote nothing to its log, and its process tree (its process group plus every descendant, whatever session it moved to) used under a tenth of one CPU (Windows: log growth alone), for the stall timeout (default 300 s,
`stall_timeout_s` in the base branch's `.gstack/pregate.json` or the user-owned file, or
`--stall-timeout`). pregate killed its process group and names the last test
`--stall-timeout`). pregate killed its process tree and names the last test
file started. The check is incomplete, never pass.
**Fix.** Open the printed log, find the hang in the named file (a blocked