Repository navigation
Description
The daemon Unit test signalExecProcesses > scans that run at once share one read of a stuck process (services/sandbox-runtime/daemon/src/process-reaper.test.ts:376) sometimes fails in CI. It expects pendingProcReads() to be 1 and gets well over a hundred. The PRs it failed on don't touch the daemon. Agents can't re-run jobs (the token gets HTTP 403 on POST …/jobs/{id}/rerun), so each failure costs the PR a new push and another full CI cycle while CI is saturated.
Occurrences
Each row is read from the job log.
| Run / job | PR at head | Result |
|---|---|---|
| 37163264839 / 111321565146 | #4191 at 0f498dc92 |
Expected: 1, Received: 182 at 00:13:30Z (347 ms) |
| 37164487001 / 111325069441 | #4195 at 2ae1bf7c1 |
Expected: 1, Received: 169 at 00:29:44Z (125 ms) |
The same test passed in the same window on #4190 (111321948276, 00:20Z) and #4193 (111325809401, 00:50Z). Both failures ran on ubuntu-24.04 hosted runners.
What the test and code do
- The test builds a fake process table with two pids:
42, tagged, and41, whoseenvironis a FIFO that never answers. It starts twotaggedPidsscans and onegroupMembersscan, waits 100 ms and expects one read in flight, since the scans share the stuck read. pendingProcReads()returns the module-globalreadsInFlight(process-reaper.ts:139). It counts every tracked read in the process: the listing, eachstatand eachenviron, for anyprocRoot.- With two fake pids, this test alone can't put 169 or 182 reads in flight. Those counts are close to the number of processes on a hosted runner.
Likely cause (unverified)
Another scan of the real /proc was in flight when the assertion ran. bun test runs the daemon's files in one process, and in run 37163264839 exec-manager.test.ts ran before process-reaper.test.ts. A reaping round that an earlier file started or scheduled with the default procRoot would add one read per real process. Those reads can queue behind the stuck FIFO read in libuv's small pool, so on a slow runner they're still out at the 100 ms mark. Locally they finish first and the test passes.
Acceptance
- Confirm or refute the cause above, with a deterministic local reproduction if feasible. For example, start a real-
/procscan, or an earlier file's delayed round, just before the assertion. - The test proves the sharing property using only its own reads: a per-root count, a delta, or isolated state. It must not weaken the "one read per stuck process" assertion or add a blanket retry.
- If earlier tests leave scans or timers running into later files, they end them in their own teardown.
- No change to production reaping behaviour unless the investigation finds a production defect. If it does, describe it separately.
- An independent review by a distinct agent.
Coordination
PR #4167 (TALE-500, the #4125 follow-ups) also edits process-reaper.ts and this test file, and is open. Agree on ordering with that PR so the two don't conflict.
Related: #4097 (introduced the test), #4125 (MEDIUM 3: a stuck read can exhaust the pool).
Activity
yannickmonney commentedon Oct 4, 2026
Third occurrence: #4165 at
e8a371dc4444e9f2b4f7731588825d3e3d25b7d7, run 37164130485 / job 111325050575, completed 00:34:12Z. Same test and line,Expected: 1, received 33. That run had 321 passes, 2 skips and 1 failure. #4165 doesn't touch the daemon either.The count varies from run to run (33, 169, 182), which fits reads from another scan that happen to be in flight at the assertion rather than a fixed leak.
yannickmonney commentedon Oct 4, 2026
TALE-527 — #4209 / #4170 reconciliation receipt
Run:
0d1ec9c2-5fa2-4309-a7c4-2bd59dca81d5; readback and local execution 2026-10-04 02:33–02:39 UTC. Read-only evidence slice; no code PR.Verdict
#4170 addresses the observed cross-suite global-counter contamination, with real uncached execution evidence. A concrete readiness/coverage gap remains; do not treat #4209 as fully pressure-proven or close it from this receipt.
The original 33/169/182 outstanding-read failures cannot arise from the fixture's two synthetic PIDs alone.
pendingProcReads()counts listing/stat/environment reads across all roots in one process; the environment-sharing map uses${root}/${pid}@${startTime}. #4170'sisolatedReadTestmoves each FIFO/global-counter fixture into its own Bun child, selects one exact escaped full test name, checks exit status, and requires a completion file written only after the selected body finishes. Thus unrelated scans in the parent suite cannot contribute to the child's counter. The production shutdown counter and exact one-read assertions are unchanged. The helper and fixture are inservices/sandbox-runtime/daemon/src/process-reaper.test.ts(helper line 40, fixture line 416, assertions lines 430 and 436); tracking/sharing is inprocess-reaper.ts(lines 133–151 and 241 onward).The delayed SIGKILL round in
exec-manager.ts:1101is untracked by that method's returned promise, consistent with the audit hypothesis. This slice did not causally reproduce which earlier test/timer supplied each historical count; do not promote that hypothesis to a proven attribution.Actual CI execution
78c50c349a5d6b68c987b20bca30c146a664371f.7809200ada80782878d39576159cfc9ee61e61f7, merging that final head intob5d1aa2d641e349def83168e468cc8ca0c50bbdd, not a standalone head checkout. GitHub Contents API returns the identical fixture blob0fc88e22f0db9347d0ba84a28190911ac033a5b1for this merge ref, final head and current main9b7463b707c5e44349f0a8c51e764a39e3e5c4fb.Relevant job lines (full log lines 6178–6181, 6473, 6617–6621):
This is an executed daemon task, despite other tasks in the same Unit job being cache hits. The sharing fixture's wrapper passes only after its child completes and writes the expected marker; a no-match child cannot silently pass this wrapper. Nested child's successful stdout/stderr is captured, so the visible CI result is the outer fixture line, not a separate inner result line.
Current-main Checks run https://github.com/tale-project/tale/actions/runs/37170810886 still had its source job queued at the snapshot. No fresh main CI execution is claimed. One fresh final-PR candidate run is evidence of execution, not a statistical proof that all scheduling/load failures are eliminated.
Bounded local execution at unchanged main
Command:
bun test services/sandbox-runtime/daemon/src/process-reaper.test.ts, sequentially 20 invocations, Bun1.4.2 (744846f84), Linux, 4 online CPUs,UV_THREADPOOL_SIZEunset. No install: the file imports only Bun/node builtins and its local production module, so existing Bun sufficed despite no repositorynode_modules.a process whose read did not come back is skipped until the read returns or the pid is someone else’s, currentprocess-reaper.test.ts:474: Expected 2, Received 3. The child diagnostic also reports PID 42 outstanding after the final 300 ms cutoff. This is consistent with its pool-size-sensitive total-read assertion; it is not a recurrence of the one-read test(sandbox): the process-reaper "share one read" test fails in CI with 169–182 reads in flight #4209 failure.068110c468c8c558937818db354e5c2710a88016already proposes changing that separate PID-reuse assertion to>= 2. That is source inspection only, not a verification of fix(sandbox): preserve rotation holds and bound post-exec reaping #4167, and not a recommendation to weaken test(sandbox): the process-reaper "share one read" test fails in CI with 169–182 reads in flight #4209's exact one-read assertion.Logs
local-run-01.logthroughlocal-run-20.logpreserve every invocation and nested failure. No failed run was retried until green or omitted from the count.Remaining gap and smallest proposed repair
The sharing test still uses a fixed 100 ms sleep at line 429. Child isolation does not guarantee that listing/stat/ordinary environment reads have settled, or that both tag scans have reached the outstanding synthetic FIFO read, by that wall-clock point. Counts may be transiently zero or greater than one on a slow/saturated child. No such target failure occurred in these 20 runs, so this is a concrete source-level gap, not an observed pressure reproduction.
Proposed narrow repair for the existing same-file owner:
pendingProcReads() === 1assertion in the child and the existing scan-result assertions; do not use a delta or relaxed threshold that can hide duplicate reads.Proposed integration owner: Codex #2 / TALE-500 (#4167); fleet manager owns admission/order. Coordination was posted on TALE-500 as comment
bc38bedd-3447-49e1-a829-bac77694bc63. This is a proposal and handoff, not an acknowledged agreement or authorization to restart a protected review. No file overlap was edited. Pending human review/independent acceptance on #4167 remains untouched.Scope, resources and unrun work
Disk checked first: 250 GiB free, then 244 GiB, both above 20 GiB floor. Existing clone fetched; review branch
chore/reconcile-process-reaper-evidencestarts from origin/main and remains local/clean. No source edits, commits, push, PR, merge, issue closure or card move. Authentication uses environment-only token through gh; no credential written into a file or remote.Unrun: deterministic historical cross-suite reproduction, the proposed explicit-readiness/active-unrelated-scan regression, injected filesystem/threadpool/CPU/memory pressure, all-daemon local suite, full-platform suite, full-workspace typecheck/check, lint/format gates (no source changed), stack, browser, E2E and containers. These behaviors are not proven by the receipt.
Deliverables: this report, CI execution log and daemon excerpt, CI metadata/main snapshot, all 20 local logs, and posting receipts. Findings are posted to #4209 and TALE-527, with a short verdict note to TALE-357. #4209 stays open.
yannickmonney commentedon Oct 4, 2026
Closing as resolved by #4170 (merged 02:21Z as
9b7463b707c5e44349f0a8c51e764a39e3e5c4fb). The fleet manager confirmed the following from source and the job log:services/sandbox-runtime/daemon/src/process-reaper.tshas the same blob (c7f0973f) before and after the merge (6524150fe→9b7463b70). Onlyprocess-reaper.test.tschanged (ce63ecd4→0fc88e22). It now runs the FIFO and global-counter cases in fresh child processes, with the original assertions and scan deadlines, and each child must exit 0 and write its completion marker.(pass) signalExecProcesses > scans that run at once share one read of a stuck process [353.88ms]and a daemon total of327 pass / 2 skip / 0 fail.Remaining limit, not an observed failure: the sharing case still waits a fixed 100 ms for readiness. Explicit, keyed read readiness would be stronger. That hardening was proposed to the owner of the same file, TALE-500 / #4167 (Codex #2), and is not filed separately. This closure doesn't claim that every pressure behaviour is tested.