Repository navigation
Conversation
…eir own session The stall check read CPU time from the test command's process group alone. A launcher such as pnpm exec (pnpm 11) starts Vitest in a new session, so a quiet suite that was busy looked idle and was killed at the stall timeout. The check now sums CPU over the process tree: the command's group plus every descendant by parent links. Stall and timeout kills signal the group of each such descendant as well. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
Thank you, @dtoelke. This is a real problem with good evidence: the before/after run, the throwaway repo and two tests that fail on main make the cause clear, and pnpm 11's What happens next: because this changes how gstack finds and signals processes outside the command's own group, we won't merge the branch as-is. We'll rebuild the change on current main with you credited, and give the signal fan-out a careful safety read first (for example, making sure a reused pid can never get a kill meant for a test worker). We'll link the new PR here and close this one when it lands. Until then, |
|
Thanks @dtoelke. The stall fix from this PR landed in #4533, rewritten on current main, and you're credited as a co-author. /ship's test check now counts CPU from every process descended from the test command, whatever session it starts in. So a quiet Vitest run under pnpm 11's #4533 carries only the stall fix from this PR. |
/ship no longer kills a working test run as stalled when the test command starts its workers in their own session.
Why: the stall check measured CPU in the command's process group only, so under pnpm 11 a busy but quiet Vitest run read as idle and was killed.
Nothing to do: a command whose workers stay in its process group is measured and killed exactly as before.
Why (in your own words)
Our monorepo runs its tests through
pnpm exec vitest run. With pnpm 11,pnpm execstarts Vitest in a new session, so the workers are outside the process group gstack creates for the command. One of our suites prints nothing for longer than the stall timeout while it works./shipendedPREGATE_STALLEDthree times in a row at the same tree, and the same suite was green when run by hand. The stall check was reading CPU time from the process group alone, where only the idlepnpmwrapper was left.This change sums CPU over the command's process tree: its group plus every descendant reached by parent links, whatever session it started. A stall or timeout kill now signals the group of each such descendant too, so the worker is not left running after the command is killed. After a normal exit only the command's own group is cleaned up, as today.
Live evidence
repro.shbuilds a throwaway repo whose test command starts one worker in a new session (a detached spawn, which is whatpnpm execdoes). The worker is busy and silent for 8 seconds, then the command prints its result and exits 0. It runsgstack-pregate --base main --allow-repo-commands --stage tests --only lanes --stall-timeout 3. Temp paths are shortened to<tmp>.Before, on main at dd4266d:
After, on this branch:
The two new tests in
test/pregate-supervise.test.tsfail on main'slib/pregate/supervise.tsand pass here:The reproduction script:
Scope
lib/pregate/supervise.ts(a process table with parent links,processTree,treeCpuMsin place ofgroupCpuMs,killTreefor stall and timeout kills), two tests, the wording "process group" to "process tree" where the stall is described (bin/gstack-pregatehelp and cancel line,lib/result-codes.ts,lib/pregate/config.ts, the guard and stall detail lines,docs/pregate.md,docs/troubleshooting.md), a changelog fragment.ps -Spath);bun run typecheck;test/pregate-supervise.test.ts, where five other tests fail here and fail the same way on main. It has also run in a private pnpm 11 monorepo's/shipsince 2026-11-12./procpath is changed the same way but I ran it only on macOS); Windows (no CPU reading there, unchanged); a worker reparented away from the tree by a double fork, which is still not measured; the full free suite (bun run test).Liveness proof (required for external contributors)
Checklist
GSTACK PRtyped live into a real surface) or PR author is @garrytan (owner exemption)