Repository navigation
fix(process): keep signal forwarding through child errors - #126493
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Land-ready proof for
Ready for the repository-native prepare and merge gates. |
|
Codex review: needs maintainer review before merge. Reviewed August 19, 2026, 8:59 PM ET / August 20, 2026, 00:59 UTC. ClawSweeper reviewWhat this changesThe PR keeps CLI respawn, relaunched TUI, and Fleet log-follow child processes responsive to later parent signals after nonterminal Node child-process errors. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open. Current main still removes signal forwarding on every child error; this PR moves cleanup to terminal lifecycle events and preserves true spawn-failure handling across all three affected owners. No blocking patch defect found; the maintainer-labelled PR needs normal exact-head CI and maintainer merge handling. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherOpenClaw launches child processes for CLI respawn, TUI relaunch, and Fleet log following. Their shared bridge forwards parent termination signals and must only clean up after the child has actually ended. flowchart LR
A[Parent process] --> B[Signal bridge]
B --> C[CLI, TUI, or Fleet child]
C --> D[Operational error]
C --> E[Exit or close]
D --> B
B --> F[Forwarded termination]
E --> G[Bridge cleanup]
Decision needed
Why: The PR is maintainer-labelled and changes child shutdown ownership, so the final merge choice needs explicit maintainer judgment despite the clean source review. Before merge
Agent review detailsSecurityNone. PR surfaceSource +12, Tests +194. Total +206 across 8 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the local PID-based spawn-failure checks and exit-or-close bridge cleanup, then merge after exact-head CI confirms the covered process paths. Do we have a high-confidence way to reproduce the issue? Yes—source-reproducible but not executed here: current main detaches the bridge on error, while the supplied focused tests exercise a live-PID error followed by a later parent signal. Is this the best way to solve the issue? Yes. Node’s PID/error contract supports keeping the shared bridge until exit or close while leaving each local owner responsible for true spawn failure. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c6ecfd26e5f4. 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.
|
Closes #126488
What Problem This Solves
Fixes an issue where a failed signal delivery or IPC operation could make a live CLI respawn, relaunched TUI, or
fleet logs --followchild stop receiving later parent termination signals. Node reports those operational failures through the child'serrorevent without necessarily ending the process, but OpenClaw treated every child error as terminal and released process ownership early.Why This Change Was Made
The shared child-process bridge now keeps signal forwarding installed until Node reports the terminal
exitorcloselifecycle event. The respawn runner, TUI launcher, and Fleet stream runner keep persistent error listeners and settle immediately only for a true spawn failure, identified by an undefined child PID. Successful exit and spawn-failure behavior remain unchanged, while post-spawn errors no longer cancel respawn escalation or release terminal/stream ownership.This is the canonical owner-boundary repair: Node's
errorevent is an operational report, whileexitandcloseown terminal state. A shared exported helper or broader bridge API was rejected because the three local PID checks express the dependency contract without expanding the process API. Detaching only onclosewas also rejected becauseexitpreserves prompt signal-listener cleanup for normally terminated children.User Impact
Supervisors and operators can continue to stop respawned CLI, TUI, and Fleet follow processes after a transient signal or IPC failure. Those children no longer risk being silently orphaned because one nonterminal error disabled later signal forwarding.
Evidence
EPERM-style child error, and a later parent signal produced zero child kill calls. The new owner regressions failed on the frozen baseline for the same reason in the bridge, respawn, TUI, and Fleet paths.close.kill()and repeated IPC errors can leave the PID/handle live, while spawn failure has no PID and proceeds fromerrortoclose.node scripts/check-changed.mjs -- <8 changed paths>passed all selected formatting, typecheck, lint, architecture, state/database, import-cycle, and safety gates.pnpm openclaw --help: https://github.com/openclaw/clawsweeper/actions/runs/32318951966. Its public comment publisher was still pending at landing time.3495ce55d8054fb29c39e23c326226590d372f73.+17/-5(net+12). Tests:+196/-2(net+194).Proof gap: no packaged supervisor or platform-specific end-to-end signal session was run. The repair is covered by deterministic owner-boundary regressions, live Node runtime probes on the two supported runtime lines, exact-head CI, and the ClawSweeper terminal smoke.