Repository navigation
test: stabilize flaky tests at root cause (batch 1) - #109347
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 16, 2026, 5:15 PM ET / 21:15 UTC. Summary PR surface: Tests +6. Total +6 across 1 file. Reproducibility: no. deterministic current-main reproduction was established, but the existence-only poll against a non-atomic file publication gives a clear source-level race consistent with the cited CI failure. Review metrics: none identified. Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Retain the atomic PID publication and bounded deadlines, refresh the branch against current main, and merge after the test-types failure is either resolved or demonstrated to be unrelated. Do we have a high-confidence way to reproduce the issue? No deterministic current-main reproduction was established, but the existence-only poll against a non-atomic file publication gives a clear source-level race consistent with the cited CI failure. Is this the best way to solve the issue? Yes. Publishing complete content through a same-directory rename fixes the race at its source, while bounded deadline increases address loaded-runner scheduling without weakening assertions or adding sleeps. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a327e43023cb. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Tests +6. Total +6 across 1 file. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
70c9f50 to
3762494
Compare
The child published its pid with a non-atomic writeFileSync while the test polled file existence only, so a loaded runner could read an empty pid file (NaN -> isProcessAlive false). Publish the pid via rename and widen the spawn-chain poll deadlines; assertion strength is unchanged.
3762494 to
4387cca
Compare
|
Merged via squash.
|
…claw#109347) The child published its pid with a non-atomic writeFileSync while the test polled file existence only, so a loaded runner could read an empty pid file (NaN -> isProcessAlive false). Publish the pid via rename and widen the spawn-chain poll deadlines; assertion strength is unchanged.
…claw#109347) The child published its pid with a non-atomic writeFileSync while the test polled file existence only, so a loaded runner could read an empty pid file (NaN -> isProcessAlive false). Publish the pid via rename and widen the spawn-chain poll deadlines; assertion strength is unchanged.
What Problem This Solves
Policy shift: no more flake reruns — flaky tests get fixed as discovered. This batch stabilizes flakes observed in today's CI runs, each fixed at root cause in an isolated worktree with a bounded stress-loop proof.
Fix 1: test-group-report SIGTERM descendant-cleanup race (failed run 29515993768,
expected false to be true). The fixture's grandchild published its pid with a plainwriteFileSync—open(O_CREAT|O_TRUNC)creates the file empty before the write lands — while the test'swaitForFilepolls existence only. Uniquely in this test the ready file is written by the parent right afterspawn(), so the pid poll races the grandchild's write directly: a loaded runner reads the empty window,parseInt("")→ NaN →isProcessAlive(NaN)false. The product's reap-before-forward ordering was never at fault (the assertion fires before SIGTERM is sent).Why This Change Was Made
.tmp+renameSync— atomic, so existence implies complete content. Deterministic; no sleep widening.Further worker fixes (gateway timing/mock family, chat-responsive browser locators) will join this branch as their proofs complete.
User Impact
None at runtime — test-only. CI stops paying rerun cycles for this flake.
Evidence
node scripts/run-vitest.mjs test/scripts/test-group-report.test.ts— 43/43 passed; bounded stress loop 10/10 iterations green in the fix worktree.