Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: keep a completed pregate run's receipt when a late signal arrives (#12641)

[._.]/ Adam Eivy80326f34043f
diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md
index 4e722778fe..85c8a0e66b 100644
--- a/docs/CONTRIBUTING.md
+++ b/docs/CONTRIBUTING.md
@@ -121,12 +121,13 @@ commit of that state yields the same `HEAD^{tree}`. A green summary never
claims a suite it skipped; required CI checks still apply.
Interrupting pregate (Ctrl-C or SIGTERM) does not leave tests running behind
-it: the running stage — including the test runner's npm and Vitest processes,
-which share that stage's process group — gets the signal and a 5-second grace,
-then the group is killed until no member remains. Only then does pregate write
-an incomplete receipt (`passed: false`) and exit by the same signal. After every stage, on
-POSIX, pregate also kills anything still left in that stage's group, with a
-warning, so no stage's processes run into the next one or past pregate.
+it: the running stage — including the test runner's npm and Vitest
+processes, which share that stage's process group — gets the signal and a
+5-second grace, then the group is killed until no member remains. Only then
+does pregate write an incomplete receipt (`passed: false`) and exit by the
+same signal. After every stage, on POSIX, pregate also kills anything still
+left in that stage's group, with a warning, so no stage's processes run into
+the next one or past pregate.
After the push (and, when you open the pull request yourself, before
`gh pr create`), `node scripts/pregate-attest.js` posts that receipt as a
diff --git a/scripts/pregate.js b/scripts/pregate.js
index 1fe49b38ea..dbfb0db415 100644
--- a/scripts/pregate.js
+++ b/scripts/pregate.js
@@ -739,7 +739,9 @@ async function main() {
}
}
- if (owner.signal && !failure) {
+ // A signal after the last stage ran (e.g. during its group sweep) leaves the
+ // completed run's receipt; it is reported below and still ends the process.
+ if (owner.signal && !failure && results.some((stage) => stage.status === 'not-run')) {
writeSync(2, `❌ Pregate incomplete: owner_pid=${process.pid} received_signal=${owner.signal} between stages.\n`);
failure = `❌ Pregate incomplete: cancelled by ${owner.signal} before every stage ran.`;
exitCode = 128 + constants.signals[owner.signal];