You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tests: test-invocation-lifetime reads PID files before they are written, so a stopped-compiler check can pass on PID 0 #3432
Found while fixing #3401. That issue's storage-inventory tests waited for a child's PID file with existsSync, then parsed it. writeFileSync creates the file before writing it, so a descheduled child could expose an empty file, and Number("") is 0. The same pattern exists in tests/test-invocation-lifetime.test.ts:
The fake tsc publishes tmp/compiler-pid with writeFileSync (line 47). The test waits on existsSync and reads it (tests/test-invocation-lifetime.test.ts:51-52). It then asserts OWNED_COMPILER_STOPPED with !existsSync(\/proc/${pid}`)(line 56). Withpid === 0, /proc/0` never exists, so the assertion passes vacuously and the test no longer checks that the owned compiler stopped.
tmp/survivor-pid is published with writeFileSync (line 68), awaited with existsSync and parsed (tests/test-invocation-lifetime.test.ts:71-72).
This is a false-green risk rather than a flake: the check can silently prove nothing under load. Not observed failing in CI. Found by auditing the bug class.
Acceptance criteria
Every PID file in tests/test-invocation-lifetime.test.ts that the test polls for and then parses is published atomically (temporary file then rename), or the reader accepts only a complete, newline-terminated positive PID (the shape tests/workspace-lease.test.ts already uses).
A forcing receipt shows the base reading PID 0 (a widened window between create and write), and shows the fix rejecting or never seeing the empty file.
A mutation receipt shows OWNED_COMPILER_STOPPED still fails when the owned compiler is left running.
Claiming (token wi-3432-b4fb), branch fix/3432-invocation-pid-race. Collisions for tests/test-invocation-lifetime.test.ts: no path report; only shared-closure reports (38 open PRs, including #3433). Plan: publish every polled file in this test atomically (temp file, then rename), and make the PID reads refuse 0 or an unparsable value. The same file has two more instances besides the cited lines: tmp/nested-compiler, which can make NESTED_CANCEL_STOPS_COMPILER_BEFORE_OUTER_EXIT pass vacuously, and tmp/orphan/tmp/late. A repo-wide audit of the bug class will be filed separately.
Fix, forcing, mutation and loaded receipts are in draft #3439 (head 9ad632062). That PR is ready to confirm but held: main is green, but the integration lease is held by another candidate. To resume: once the lease is free, run bun scripts/integrate.ts confirm 3439 --issues schlessera/brain-kit#3432. The remaining instances of this bug class found by the repo-wide audit are filed as #3435. Releasing my claim (wi-3432-b4fb); #3439 is the resumable work.
Activity
schlessera commentedon Nov 3, 2026
Claiming (token
wi-3432-b4fb), branchfix/3432-invocation-pid-race. Collisions fortests/test-invocation-lifetime.test.ts: nopathreport; only shared-closure reports (38 open PRs, including #3433). Plan: publish every polled file in this test atomically (temp file, then rename), and make the PID reads refuse 0 or an unparsable value. The same file has two more instances besides the cited lines:tmp/nested-compiler, which can makeNESTED_CANCEL_STOPS_COMPILER_BEFORE_OUTER_EXITpass vacuously, andtmp/orphan/tmp/late. A repo-wide audit of the bug class will be filed separately.schlessera commentedon Nov 3, 2026
Fix, forcing, mutation and loaded receipts are in draft #3439 (head
9ad632062). That PR is ready to confirm but held: main is green, but the integration lease is held by another candidate. To resume: once the lease is free, runbun scripts/integrate.ts confirm 3439 --issues schlessera/brain-kit#3432. The remaining instances of this bug class found by the repo-wide audit are filed as #3435. Releasing my claim (wi-3432-b4fb); #3439 is the resumable work.