Repository navigation
chore: show OS state for stalled CLI process tests - #151946
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 19, 2026, 4:34 PM ET / 20:34 UTC (Revision 5). ClawSweeper reviewWhat this changesAdds bounded operating-system process snapshots to stalled CLI tests, including Linux thread state, before requesting Node diagnostics. Merge readiness✅ Ready for maintainer review Keep open: this remains a useful diagnostic addition absent from current main. No actionable correctness or security findings were identified, consistent with the previous review of the same head. Priority: P3 Review scores
Verification
How this fits togetherThe CLI test harness launches real child processes and collects their output and exit status. When a child exceeds its deadline, this change gathers operating-system evidence before the existing diagnostic and cleanup sequence. flowchart TD
A[CLI process test] --> B[Child process harness]
B --> C{Deadline exceeded?}
C -->|No| D[Output and exit result]
C -->|Yes| E[Bounded OS observer]
E --> F[Node diagnostic request]
F --> G[Failure report and child cleanup]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +132. Total +132 across 4 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep OS capture in the shared CLI deadline path while preserving failure semantics, restricted diagnostic output, and existing cleanup ownership. Do we have a high-confidence way to reproduce the issue? Not applicable to a production fix: this PR adds instrumentation. Busy-loop and stopped-child scenarios directly exercise the diagnostic gap; the intermittent CI stall itself remains unreproduced. Is this the best way to solve the issue? Yes. Capturing OS state before signaling addresses unresponsive children without depending on their event loop or changing successful test execution. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e9390ffd104e. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
Infrastructure tests could pass and then stall during fork termination without identifying the outstanding resource or blocked wait. Extend the existing diagnostic forks adapter to the infra pool and capture bounded active-resource, thread, child-process, and blocked-wait evidence after ten seconds. A separate Linux observer can collect evidence even when the worker event loop is blocked. Preserve Vitest shutdown ownership, deadlines, isolation, and worker limits, and join diagnostic capture before removing its temporary directory. This is internal test instrumentation with no user-visible runtime change. The natural intermittent stall was not reproduced, so this change does not claim to resolve its root cause. Related: #151663, #151946. Validation: normal shutdown and three injected stalled-shutdown scenarios, Linux observer boundary proof, 93/93 routing assertions, and changed-file checks passed. The hosted campaign passed 20 repetitions, 80 plan invocations, and 1,000 fork teardowns. Exact-head CI run 35416912203 passed; the native watcher excluded 12 superseded check contexts. Campaign autoreview was scoped-clean, and the exact-head ClawSweeper review had no actionable findings or Rank-up moves. Production LOC: 0. Tests: +123/-23. Test support: +272/-5.
Capture bounded process and Linux thread state before requesting child diagnostics. Preserve the original deadlock failure and cleanup when JavaScript cannot answer SIGUSR2. Related to #151161.
b9f4f62 to
df3130d
Compare
|
Merged via squash.
|
Infrastructure tests could pass and then stall during fork termination without identifying the outstanding resource or blocked wait. Extend the existing diagnostic forks adapter to the infra pool and capture bounded active-resource, thread, child-process, and blocked-wait evidence after ten seconds. A separate Linux observer can collect evidence even when the worker event loop is blocked. Preserve Vitest shutdown ownership, deadlines, isolation, and worker limits, and join diagnostic capture before removing its temporary directory. This is internal test instrumentation with no user-visible runtime change. The natural intermittent stall was not reproduced, so this change does not claim to resolve its root cause. Related: openclaw#151663, openclaw#151946. Validation: normal shutdown and three injected stalled-shutdown scenarios, Linux observer boundary proof, 93/93 routing assertions, and changed-file checks passed. The hosted campaign passed 20 repetitions, 80 plan invocations, and 1,000 fork teardowns. Exact-head CI run 35416912203 passed; the native watcher excluded 12 superseded check contexts. Campaign autoreview was scoped-clean, and the exact-head ClawSweeper review had no actionable findings or Rank-up moves. Production LOC: 0. Tests: +123/-23. Test support: +272/-5.
Stalled CLI test children can miss both JavaScript diagnostic signals, leaving the deadlock guard without OS evidence. Capture bounded PID ancestry, process state, and Linux thread wait channels, stacks, and signal status in the shared CLI test harness before requesting Node diagnostics. Preserve the existing deadline failure and joined child/pipe cleanup. Test instrumentation only; no user-visible runtime change. The intermittent CLI exit failure remains unproven. Related: openclaw#151161. Validation: 18/18 helper tests, busy-loop and SIGSTOP regression checks on macOS and Linux, 30 full-shard runs (1,260 cases), and 200 focused repetitions. Exact-head CI passed; campaign review and ClawSweeper found no actionable defects. Production LOC: 0; tests and test support: +165/-33.
What Problem This Solves
CLI process test failures can print complete output and then reach the deadlock guard without answering either SIGUSR2 diagnostic hook, leaving CI without OS-level evidence of the stalled process.
Maintainer-requested diagnostic follow-up. Related: #151161. Observed in the gateway-backed CLI shard.
User Impact
No user-visible runtime change. This is test instrumentation; it does not claim to fix the intermittent CLI exit failure.
Why This Change Was Made
The child harness now captures PID ancestry, process state, and Linux per-thread wait channels, kernel stacks, and signal status before requesting the Node report. A separate observer bounds the entire probe and reports partial or unavailable evidence. It omits command arguments, environment, and command names.
The exact failing revision already disables both warning and compile-cache respawn. The watched PID is the real CLI, and missing credentials are rejected before opening a Gateway client. The normal path unwinds
runClicleanup, prints guidance, drains output, and callsprocess.exit(1). Node 24.19.0 implements report-on-signal through a JavaScript signal callback, so absence of both dumps does not independently prove a watchdog failure. CI uses a prepared JavaScript entrypoint, so a TSX loader-thread explanation also needs direct evidence. A native exit-time wait remains a hypothesis until captured.Evidence
The helper suite passed 18/18 on macOS. The busy-loop and SIGSTOP assertions both failed against the original harness because its errors contain no OS snapshot; both passed after restoring this patch. Both the scoped pre-commit review and the requested branch review (
--mode branch --base origin/main --max-priority P1) are scoped-clean.pnpm check:changedpassed after correcting five brace-style lint findings.The exact
agentic-cli-process-hosted-3mix issrc/cli/gateway-backed-exit.process.test.ts(42 cases). WithOPENCLAW_VITEST_MAX_WORKERS=2, 30 complete runs passed (1,260 cases), plus 14 standalone focused runs; no wedge was captured. The target's 30-run distribution was min 530 ms, median 564 ms, p95 742 ms, max 797 ms. This Testbox used Node 24.19.0, exposed 4 CPUs, and backed/tmpwith ext4; the failing CI job reported 2 logical CPUs. The original job did not record cgroup or filesystem facts, and the Testbox's cgroup-v2 limit files were not exposed.The 30-run snapshot differs from this head only by the five brace-style corrections. On committed head
b9f4f62b2bc6d57f8299d222d3dab42410737c0a, both Linux injected-state checks passed, then all 200 focused repetitions passed with--repeats 199and zero retries. Reporter-observed per-repeat intervals: min 523 ms, median 728 ms, p95 915 ms, max 1,368 ms. This fresh Testbox exposed 4 CPUs and 15.4 GiB RAM, versus the original CI shard's reported 2 logical CPUs and 7.66 GiB; both used Node 24.19.0. Neither probed cgroup-v1 nor cgroup-v2 limit interface was exposed on the Testbox.No wedged state or production mechanism was captured in the requested campaign. The fix remains diagnostics-only. The external campaign watcher was armed to capture the process tree and force SIGUSR2 throughout it before the existing guard; it never fired. The injected busy-loop/SIGSTOP cases prove the committed observer still reports OS state when the child cannot answer.
Testbox runs: full-shard cohort and committed-head focused cohort. These are delegated Testbox leases: individual test results and the focused wrapper's exit 0 are the proof; ending the leases can cancel their hosting workflows. The first cohort driver was intentionally interrupted after the completed 30 full runs and 14 extra focused passes to switch to native repeat mode.
Production LOC: 0. Tests and test support: +165 / -33 (net +132).
Exact-head CI on
df3130db49d50f9e3e9ea26d576bac4cde47c1d2is green: the aggregate gate succeeded, and all 159 check runs are complete with success, skipped, or neutral conclusions. The earlier unrelated Gateway task-list performance failure is superseded by this current-head proof; no CI rerun was requested for landing.ClawSweeper also reviewed this exact head: no actionable findings and ready for maintainer review.
ClawSweeper disposition (September 19, 2026): the latest review at 17:22 UTC covers this exact head, lists no actionable findings, and has no Rank-up moves or before-merge requests. No code changes or review rerun are needed. The campaign review of record is scoped-clean at P0/P1.