Skip to content

fix: preserve child signal termination during CLI respawn - #144838

Merged
shakkernerd merged 2 commits into
mainfrom
preserve-child-signals
Sep 11, 2026
Merged

shakkernerd merged 2 commits into
mainfrom
preserve-child-signals

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #144200

What Problem This Solves

Fixes an issue where supervisors receive an ordinary exit code after a respawned OpenClaw runtime is terminated by a Unix signal. The lost signal can send the development watcher into restart or Doctor recovery instead of stopping.

Why This Change Was Made

Both startup respawn runners now terminate with the child's actual Unix signal after their existing shutdown cleanup. Explicit numeric exits and acknowledged stops stay numeric, and Windows keeps its current handling.

User Impact

Supervisors can distinguish an interrupted runtime from a command that explicitly returns an exit code, including 143. Forced shutdown preserves the actual SIGKILL outcome.

Evidence

  • Linux/Node 24.19.0 on Blacksmith Testbox: 323 tests passed, 1 skipped across 10 affected files. All 38 real-process cases passed across source, packaged, built, and warning respawn routes.
  • Killing only the respawned runtime produced (code: null, signal: "SIGKILL") at the outer watcher command. Its invocation log contained only gateway, with no Doctor pass or restart.
  • Restoring the pre-fix launcher owner makes that regression fail: the watcher runs Doctor and restarts instead of preserving SIGKILL.
  • Explicit exit 143, acknowledged shutdown returning 0, forwarded SIGINT/SIGTERM, forced SIGKILL, and mocked Linux/Windows termination controls passed.
  • Changed-file formatting, syntax checks, targeted typed lint, and repository ratchets passed. Independent review reported no actionable P0–P2 findings.

@shakkernerd shakkernerd self-assigned this Sep 11, 2026
@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: M maintainer Maintainer-authored PR labels Sep 11, 2026
@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 11, 2026, 6:46 AM ET / 10:46 UTC (Revision 3).

ClawSweeper review

What this changes

The CLI startup wrappers preserve Unix child termination signals while retaining numeric exits and Windows behavior, with matching regression tests and documentation.

Merge readiness

✅ Ready for maintainer review

This remains a useful fix: current main still loses child signal identity, and the supplied process-level evidence supports the repair. No actionable introduced defect was found.

Priority: P2
Reviewed head: 452e88e98c13a99a56a458d9f57312b6cb89a2ff

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level fix with meaningful process-boundary evidence and no actionable findings; CI completion remains a separate merge gate.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The captured Testbox observations exercise the real startup wrapper through runner and watcher boundaries: direct child SIGKILL reaches the outer command as SIGKILL without Doctor or restart, while numeric exits remain numeric; the pre-fix owner fails this scenario.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured Testbox observations exercise the real startup wrapper through runner and watcher boundaries: direct child SIGKILL reaches the outer command as SIGKILL without Doctor or restart, while numeric exits remain numeric; the pre-fix owner fails this scenario.
Evidence reviewed 7 items Current main still contains the defect: The fetched main revision maps child signals to numeric exits in both startup owners. The source runner explicitly distinguishes exitSignal from numeric completion when deciding whether execution was interrupted.
Latest-release comparison: The same numeric signal conversion is present in the supplied latest release, v2026.9.4; this repair is not already covered by that release.
Cleanup and signal propagation: The startup-only runner detaches forwarding listeners and clears timers before signaling itself. The typed runner’s bridge registers its exit cleanup before the runner’s exit handler; numeric completion and Windows branches remain intact.
Findings None None.
Security None None.

How this fits together

OpenClaw startup wrappers sometimes launch a replacement runtime for Node settings or compile-cache handling. They report that runtime’s completion to shells and supervisors, whose stop, restart, and recovery decisions depend on distinguishing signals from numeric exits.

flowchart TD
  A[CLI invocation] --> B[Startup respawn wrapper]
  B --> C[Replacement runtime]
  C --> D{Completion type}
  D -->|Unix signal| E[Clean up and preserve signal]
  D -->|Numeric exit or Windows| F[Preserve numeric handling]
  E --> G[Shell or supervisor]
  F --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +4, Tests +234, Docs 0, Other +4. Total +242 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 1 4 0 +4
Tests 4 281 47 +234
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 4 0 +4
Total 7 290 48 +242

Review metrics

Metric Value Why it matters
Production versus test growth Production +8 net lines; tests +234 net lines The production growth is limited to Unix signal preservation; most growth validates process outcomes and watcher recovery behavior.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #144200
Summary: This PR is the explicit implementation candidate for the linked signal-identity report; the issue remains open until resolution.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep termination identity intact through both startup wrappers so supervisors stop on actual signals while explicit numeric completions retain their existing meaning.

Do we have a high-confidence way to reproduce the issue?

Yes: the linked report supplies a direct-child SIGKILL reproduction, and current-main source confirms conversion to an ordinary numeric exit. This review verified the path without executing it.

Is this the best way to solve the issue?

Yes: repairing the two startup owners preserves the existing supervisor contract without adding configuration or another recovery mechanism.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 56fcd66e4848.

Labels

Label justifications:

  • P2: This repairs a bounded supervisor termination defect when CLI startup uses a respawn wrapper.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured Testbox observations exercise the real startup wrapper through runner and watcher boundaries: direct child SIGKILL reaches the outer command as SIGKILL without Doctor or restart, while numeric exits remain numeric; the pre-fix owner fails this scenario.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured Testbox observations exercise the real startup wrapper through runner and watcher boundaries: direct child SIGKILL reaches the outer command as SIGKILL without Doctor or restart, while numeric exits remain numeric; the pre-fix owner fails this scenario.

Evidence

What I checked:

  • Current main still contains the defect: The fetched main revision maps child signals to numeric exits in both startup owners. The source runner explicitly distinguishes exitSignal from numeric completion when deciding whether execution was interrupted. (src/process/respawn-child-runner.ts:108, 56fcd66e4848)
  • Latest-release comparison: The same numeric signal conversion is present in the supplied latest release, v2026.9.4; this repair is not already covered by that release. (src/process/respawn-child-runner.ts:108, 3a9d69db306c)
  • Cleanup and signal propagation: The startup-only runner detaches forwarding listeners and clears timers before signaling itself. The typed runner’s bridge registers its exit cleanup before the runner’s exit handler; numeric completion and Windows branches remain intact. (node-runtime-recovery.mjs:151, 452e88e98c13)
  • Production-path regression and supplied execution evidence: The captured PR body reports Linux/Node 24.19.0 Testbox execution: killing the respawned runtime yielded an outer watcher exit of code null and signal SIGKILL, with only the gateway invocation recorded. Restoring the old launcher owner caused Doctor and restart instead. The inspected regression exercises the real launcher, runner, and watcher with controlled entry code; the body also reports numeric 143, acknowledged 0, forwarded signals, and escalation coverage. These are contributor-recorded observations, not executions performed during this review. (test/scripts/run-node-lifecycle.test.ts:23, 452e88e98c13)
  • Linked report and review continuity: [Bug]: Source launcher converts child signals into normal exit codes #144200 documents the baseline signal-versus-numeric failure and is explicitly paired with this PR. The supplied previous review evaluated the same head and retained no findings or published rank-up moves. The host-verified introduction delta and test merge identify only the seven intended paths. (452e88e98c13)
  • Feature-history routing: Main-branch history identifies Vincent Koc’s shared-runner and process-group work and Peter Steinberger’s subsequent exit-semantics, signal-forwarding, and startup maintenance. Deeper blame and historical patch inspection encountered unavailable Git objects, so these are routing candidates without verified source-line introduction attribution. (src/process/respawn-child-runner.ts, 56fcd66e4848)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-11T10:13:19.810Z sha 452e88e :: needs maintainer review before merge. :: none
  • reviewed 2026-09-11T10:19:06.053Z sha 452e88e :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 11, 2026
@shakkernerd
shakkernerd merged commit 5320028 into main Sep 11, 2026
194 of 197 checks passed
@shakkernerd
shakkernerd deleted the preserve-child-signals branch September 11, 2026 11:06
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: startup respawns preserve Unix child signals so supervisors stop interrupted runtimes without entering watcher recovery.

vincentkoc added a commit that referenced this pull request Sep 11, 2026
Preserve the reviewed harness while incorporating the landed benchmark prerequisite.

Punchcard-Session: coral-orchard-orchard-d4

* commit '4407ed19ac63b1c1c84a0cfe6eb4bbeca9c2322c': (1196 commits)
  fix(perf): isolate benchmark subprocess transport (#144159)
  refactor(auth): await Copilot cache persistence (#144810)
  refactor(web-fetch): exercise URL normalization through the public tool (#144887)
  fix(ollama): preserve hosted subdomain model context (#144891)
  fix(doctor): explain Codex plugin health failures (#144813)
  fix(channels): honor pinned accounts in Mattermost model menus (#144880)
  fix(update): failed-update records hide the triggering error behind the excerpt tail (#144729)
  fix(logging): preserve OpenClaw package references in diagnostics (#144808)
  fix: retain plugin detail tab selections while inspection loads (#144647)
  fix: keep discovered models when sign-in tokens renew (#144861)
  fix(update): preserve local package overrides (#89985)
  fix(update): resolve compatibility bridges within the runtime graph (#144831)
  chore(i18n): refresh native locales (#144856)
  fix: preserve child signal termination during CLI respawn (#144838)
  fix(text): hide encoded MiniMax tool envelopes (#126307)
  fix(subagents): deliver child replies that match the empty placeholder (#130647)
  fix(cli): reject blank message channel selectors (#144802)
  fix(telegram): preserve mixed text order and pending stop (#144839)
  fix(memory): restore FTS fallback for same-name view collisions (#144783)
  chore(release): close out 2026.9.4 on main (#144708)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 12, 2026
…44838)

Preserve actual Unix child termination signals through startup respawns so supervisors stop interrupted runtimes without entering watcher recovery. Keep explicit numeric exits and Windows termination behavior intact.

Fixes openclaw#144200.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Source launcher converts child signals into normal exit codes

1 participant