Repository navigation
fix(test): prevent residual cleanup fixture readiness race - #136185
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 2, 2026, 5:18 AM ET / 09:18 UTC. ClawSweeper reviewWhat this changesThe PR replaces temporary-file polling in the residual-descendant cleanup test with an IPC readiness acknowledgement forwarded through the watched child’s stdout. Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review Keep open. This maintainer-owned, labeled test repair remains necessary: current main still uses the independent temporary-file poll, while the PR makes readiness a single observed process-output event before signalling the leader. No blocking correctness or security finding was identified. Priority: P3 Review scores
Verification
How this fits togetherThe Vitest runner watches child output for stalls and terminates an owned process group when output stops. The changed fixture starts a leader and detached descendant, then verifies the runner’s cleanup joins the entire group rather than only the leader. flowchart LR
A[Test fixture] --> B[Watched test leader]
B --> C[Residual descendant]
C --> D[Readiness output]
D --> E[Leader termination]
E --> F[Process-group cleanup]
F --> G[Stopped-group assertion]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +1. Total +1 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Use the output-backed readiness handshake so the fixture validates a live descendant before leader termination, while retaining the runner’s existing watchdog and group-join behavior. Do we have a high-confidence way to reproduce the issue? Yes, at source level: the former independent polling could continue after the 5-second no-output watchdog terminated the silent group. The supplied PR body also records a real-process fault-injection trace, though this read-only review did not re-execute it. Is this the best way to solve the issue? Yes. Readiness is now synchronized on the output event that the watchdog observes, avoiding a timeout increase or a second delayed polling path while preserving process-group cleanup as the runtime owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c077653cd4ec. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Land-ready verification for fdac6d61d36ac3e23cf15c7e30cdba41b988f4a0. The readiness race belongs to the residual-descendant test fixture. It now receives descendant-generated readiness, checks a live positive PID, and signals only the leader synchronously on watched stdout. The old PID-file handoff/poller is removed; the real 5000 ms watchdog and pipe-independent group cleanup are unchanged. Production/tooling +0/-0; tests +34/-33. No changes beyond the reviewed one-file patch. Verified commands and results:
The fault-injected real-process before/after replay was independently repeated: the old delayed polling continuation fails the liveness assertion after watchdog cleanup; the repaired fixture passes with a descendant still alive at leader exit and no running group at completion. Negative controls fail for missing group join and watchdog-driven termination. This is explicitly scheduling-injection proof, not a natural failure of the unchanged Vitest command. Known proof gap remains unchanged: the separate progress-only/group command did not load this changed test, passed 38 group cases, and failed two unchanged progress cases (case-1 readiness for Read the latest ClawSweeper review: fresh exact-head review, no findings, Native hosted prepare initially rejected a missing Workflow Sanity run. The PR creation event had GitHub Recovered cohort: Workflow Sanity 33612990883 and CI 33612990844, both attempt 1, completed successfully for the same source head. The second pinned CI watcher exited 0 with GREEN. An intermediate prepare retry correctly refused the still-active recovery CI; no prior-green shortcut was used, and its exact owned lock was recovered only after process completion.
|
|
Merged via squash.
|
What Problem This Solves
Resolves a problem where developers running the Vitest runner tests could hit a residual-descendant fixture failure when readiness polling resumed after the real no-output watchdog had already terminated the process group. This is a maintainer-requested fixture repair, kept separate from other lifecycle work.
Why This Change Was Made
The fixture now waits for an acknowledgment from the descendant after it installs its running loop. The leader disconnects private IPC and forwards the PID over watched stdout; the test validates a positive, live PID and signals only the leader synchronously in the line callback. This replaces the stale PID-file handoff and independent polling continuation with one readiness path.
The real 5000 ms watchdog still starts at spawn. No timeout increase, fake clock, keepalive, suppression, or production seam is added. The test now rejects watchdog termination explicitly, retains the complete stopped/zombie-only group snapshot at completion, and awaits the owned completion promise in final cleanup. Descendant stdout/stderr remain ignored, so pipe closure cannot substitute for process-group cleanup.
User Impact
No product behavior changes. Developers get a fixture that proves residual-descendant cleanup without confusing delayed readiness polling or watchdog group termination with the intended leader-only exit. A truly silent startup exceeding five seconds still fails intentionally.
Production/tooling LOC: +0/-0. Tests: +34/-33 (one existing test file; no new test-only production hooks). No changelog, dependency, configuration, schema, or release changes.
Evidence
groupStopped: false) and when leader-only termination is withheld (noOutputTimedOut: true). They exercise real production processes, watchdogs, signals, and joining; repository production code is unchanged.OPENCLAW_VITEST_MAX_WORKERS=16 node scripts/run-vitest.mjs test/scripts/test-projects.test.ts test/scripts/test-projects-routing.test.ts test/scripts/run-vitest.test.ts— 644 passed in 3 files, exit 0, 593.7 s. This isolated baseline contains 644 tests, not the initial report's 649; no unrelated routing changes were imported.OPENCLAW_VITEST_MAX_WORKERS=16 node scripts/run-vitest.mjs test/scripts/run-vitest.test.ts test/scripts/vitest-process-group.test.ts— 172 passed, independently rerun during landing with exit 0.node scripts/check-changed.mjs -- test/scripts/run-vitest.test.ts— exit 0: selected guards, formatting, root-test typecheck, script lint, and targeted test lint.git diff --checkalso passes.f0d792a772188c1efbcf21ff4db63a1115cc8747confirms the old fixture remains and relevant runner/process-group sources are unchanged.Known local extra-proof limitation: a separate command selecting only
test/scripts/vitest-process-group.test.tsand unchangedtest/scripts/run-vitest-progress.test.tspassed 38 group tests but failed two progress cases:stall=falsetimed out waiting for case-1 readiness, andstall=truetimed out waiting for owned group cleanup. It did not load the changed file. Its exact fixture namespace/process commands were verified gone. These failures, plus the unchanged silent-child case's late diagnostic output, remain in the separately tracked follow-up Investigate Vitest progress fixture timeouts; this PR does not claim that wider sibling sweep passed.Local proof used macOS and Node 24.20.0; no full-suite or browser proof is claimed. Regression introduction is not attributed here because raw-parent provenance was not independently reverified for landing.