Repository navigation
fix(process): join relay reaping before extinction probe - #140134
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 6, 2026, 9:31 AM ET / 13:31 UTC. ClawSweeper reviewWhat this changesThe process supervisor waits for the relay to exit before checking whether a command’s POSIX process group has disappeared, with regression coverage for ordering and timeout behavior. Merge readiness✅ Ready for maintainer review This remains a useful, focused repair: pinned main still has the premature extinction probe, and no blocking introduced defect was found. Maintainer-authored work also remains protected from automatic closure. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s process supervisor runs managed commands through a relay and process-group anchor. It reports command output separately from cleanup completion, which requires evidence that the owned process group has disappeared. flowchart TD
A[Managed command] --> B[Relay and process anchor]
B --> C[Command result and output]
B --> D[Closing receipt and control closure]
D --> E[Wait for relay exit within deadline]
E --> F[Kernel process group probe]
F --> G[Confirmed cleanup or explicit uncertainty]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +25, Tests +82. Total +107 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep cleanup observation ordered after relay reaping while preserving the shared deadline, independent output delivery, and strict kernel disappearance check. Do we have a high-confidence way to reproduce the issue? Yes, at the source boundary: control closure before relay exit combined with a transient EPERM makes pinned main reject cleanup prematurely. The added deterministic test models this ordering; no runtime reproduction was executed during this review. Is this the best way to solve the issue? Yes. Joining the existing child-exit lifecycle repairs the ordering at its owner while retaining the same timeout and ESRCH-only success condition. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 21dc7d5d7b6c. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
Fixes a race where a service-managed command can report uncertain cleanup after its control channel closes but before the relay reaps the anchor process. On Darwin, querying an unreaped zombie process group can return EPERM even though its leader has exited.
Why This Change Was Made
Join the existing relay child-exit lifecycle before the first POSIX group-disappearance probe. Joining consumes the same deadline captured when control closes. The existing kernel check still requires ESRCH to confirm extinction; EPERM and other errors remain failures after the join. No new receipt, signal, timeout increase or retry of EPERM is introduced.
User Impact
Normal command cleanup waits for its owner to reap the anchor before observing group disappearance. Root-result/output delivery stays independent, and cancellation, missing-receipt failure, source authority and Windows Job cleanup retain their current behavior. The join remains bounded when the relay stalls.
Evidence
Found while diagnosing the macOS argv0 service-lifecycle failure in run 34032828960 for #139995. That native change does not modify process sources. The failure's PID state was not captured; an isolated owned-child Darwin probe separately demonstrates live-group success, zombie-group EPERM, then ESRCH after parent reaping. A deterministic regression using the actual host implementation reproduces premature failure when control EOF precedes relay exit, and fails before this repair.
All 32 host cases pass, including the original ordering, unchanged deadline, stalled relay, EPERM/EIO, missing receipt and Windows branches. Real service-child lifecycle tests pass 26 cases on macOS and 26 on Linux, including argv0. A normal Linux build and root lifecycle E2E pass at source tree 1e605bc1f37f630ca9c6970655028ded4c3c9b69: Testbox run 34035221374. The owned lease is stopped and verified completed.
All 29 selected checks and fresh complete-candidate P2 review pass. The existing timeout helper clears its timer; its import adds no new runtime module to the prior source closure. This correctness repair adds 23 production and 75 test code lines. No schema, configuration, dependency or protocol change.