Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
test(worker-configuration-release): the descendant wait loop accepts ESRCH from /proc/<pid>/stat, the error a task reaped between open and read returns
garrytanac003ba64107
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex bc75dbd13c..d07fec440c 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -16,6 +16,7 @@ identifiers and attribution are available in the pre-removal Git revision- **Flake fix: `test/write-contract-conformance.test.ts` (and its Postgres arm) no longer fails with `ECONNRESET` on a loaded CI shard.** The conformance HTTP clients connected before the stdio arm and reused a pooled keep-alive socket afterwards; when the stdio arm outlived the test server's 10 s idle timeout (`Bun.serve` default in the test-only `startHttpTransport`, swept every 4 s; production `serve --http` is Express and advertises `Keep-Alive: timeout=5`), the first HTTP POST could land in the sweep that closed the socket, and Bun's fetch, which parks pooled sockets for 5 minutes, parses no `Keep-Alive` hint and never retries a POST, surfaced "The socket connection was closed unexpectedly". The clients now send `Connection: close`, so each call uses its own socket. Forced probe (test server `idleTimeout: 1`, a 4.1 s busy loop across one sweep, then a POST): 3/3 ECONNRESET before, 3/3 pass after, both engines. No assertion or timeout changed. Sixteen other tests share the same test server with persistent MCP HTTP clients and carry the same exposure if a case idles a client 10 s before a POST; a Bun-based thin client (`src/commands/protocol.ts`, `src/core/connect-probe.ts`) has the same narrow window against the production server past 5 s idle (follow-up, not changed here).- **Flake fix: `test/entity-card-perf.slow.test.ts` gates its 100 ms p99 on the call's thread CPU time instead of wall time.** PGLite runs every query in-process on the test thread with no I/O, so on an idle machine the two are equal, and on a loaded CI runner wall time was measuring the shard's load, not the card path (p99 100.52 ms on a loaded 8-VM shard against about 30 ms idle). The budget, the getPage ratio guard and every assertion are unchanged; wall p99 is still logged. Forced probe: master's wall gate fails under 8 busy loops, the CPU gate passes, and an injected 96 ms slowdown fails both idle and under contention. Known limit: CPU time cannot catch a regression that blocks on a sleep or I/O, and the card path has neither apart from the 2 s references deadline. `process.threadCpuUsage` ticks in 1 ms steps on the Ubicloud runners (kernel `CONFIG_HZ=1000`, Bun 1.4.0 and 1.4.2) and 4 ms on a `CONFIG_HZ=250` box, rounding up; it is absent on Bun 1.3.14, which CI does not run.+- **Flake fix: `test/e2e/worker-configuration-release.test.ts` cleanup accepts `ESRCH` from `/proc/<pid>/stat`.** The "completion-recording failure never releases an isolated handler with a live descendant" case passed every assertion and then threw in its `finally` wait loop: right after the SIGKILL, Linux reaps the descendant between the loop's `open()` and `read()` of its stat file and returns `ESRCH` instead of `ENOENT` (#6575, job 115084475795). The catch now treats both as "gone"; the `running` must-end-false assertion is unchanged. Forced probe (a `bun test --preload` that makes the test's first stat read throw `ESRCH`): 3/3 fail before, 3/3 pass after; unforced 4/4.- The `[0.60.189.0]` entry names migrations v241 and v242, the numbers it merged with (the merge-slot renumber from v240/v241 updated the stamps, not the entry text).## [0.60.189.0] - 2026-10-12diff --git a/test/e2e/worker-configuration-release.test.ts b/test/e2e/worker-configuration-release.test.tsindex 38bc60c525..8e4b8c29d6 100644--- a/test/e2e/worker-configuration-release.test.ts+++ b/test/e2e/worker-configuration-release.test.ts@@ -187,7 +187,8 @@ describeDb('Postgres worker configuration release', () => {const stat = readFileSync(`/proc/${descendant}/stat`, 'utf8');running = !['Z', 'X'].includes(stat.slice(stat.lastIndexOf(')') + 2).split(' ')[0]);} catch (error) {- if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error;+ // ENOENT: the task is gone. ESRCH: it was reaped between open() and read() of its stat file.+ if (!['ENOENT', 'ESRCH'].includes((error as NodeJS.ErrnoException).code ?? '')) throw error;running = false;}if (running) await new Promise(resolve => setTimeout(resolve, 25));