Skip to content

fix: finish shutdown without disabling V8 compilers - #168587

Merged
roboclaw-bot merged 22 commits into
mainfrom
openclaw/shutdown-natural-exit-current-main
Oct 11, 2026
Merged

roboclaw-bot merged 22 commits into
mainfrom
openclaw/shutdown-natural-exit-current-main

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #163788

What Problem This Solves

Fixes commands hanging after output during forced Node shutdown without retaining the blanket Maglev and concurrent-Sparkplug workaround.

User Impact

CLI commands and the Gateway finish owned work and cleanup before exiting naturally, with Node's default compiler settings restored. Exit status, Unix signal termination, output, explicit compiler overrides, and system-CA trust are preserved.

The Gateway still joins native skills-watcher retirement. This can retain synchronous FSEvents shutdown latency on macOS; the separate upstream certificate-loader stall is not fixed. Native macOS/Windows qualification is not claimed.

Why This Change Was Made

Existing lifecycle owners retain admitted work, native workers, child transports, updater recovery, and watchdogs through actual completion. The boundary guard prevents new forced normal exits. Cleanup dependencies are retained before a command can replace its package, without eagerly importing them into CLI bootstrap. No new configuration, dependency, or schema is introduced.

Evidence

  • Earlier full pnpm build passed on composed tree faaafbe6b1f47e707f8392243898525990f3a452 (the terminal repair plus pinned CI base 97e81ce), including the canonical CLI-bootstrap import gate, in 4m35.7s. Explicit/requested exits restore terminal state after cleanup; ordinary completion stays reset-free. The build retains a Control UI startup-JS size warning; no budget was raised or waived.
  • The built packaged CLI completed a real-PTY model round trip and exited naturally with status 0. Eight dual-TTY failure probes and twelve piped/dual-TTY telemetry probes passed. These used the built executable and existing helpers, not a claimed canonical Vitest smoke run.
  • The composed memory helper parses with one run/execute binding and passes 20 publication tests. The final runtime, one-shot, and cleanup suites passed 40 tests, including red proof of premature watcher loading. Broker regressions: 84 passed; real-process negative controls cover IPC disconnect and Unix signal propagation after output settlement.
  • The SIGTERM capture fixture retains its 20-second parent deadline and persistence assertions: red was 99 instead of 143; repaired case passed in 708ms (11.19s wrapper). The latest message/update fixture matrix passed 25/25 (179.52s): synthetic pending resources release only after observed stall diagnostics and join completion; ordered exit listeners remain checked. These later repairs change test/support files only, not production code.
  • Latest pinned-main integration preserved QA error reporting without forced exit: 204 QA tests, 10 reconciliation tests, and 6 real service-child relay tests passed. The reconciliation case failed before removing an obsolete admission close. Scoped types, lint, and three-pass review are complete; this integration did not repeat the full application build.
  • CI repair qualification: 96 tests across seven files passed (196.15s); final QA integration: 34 tests across three files passed (43.28s). Scoped types, type-aware lint, formatting, and mock-export checking passed. Fresh independent P0–P2 reviews found no actionable issues.
  • Browser startup recovery: all three saved/chat/toast cases passed (35.743s). Output and local-chat shutdown regressions were exercised with the rebuilt CLI. Fixture repairs preserve native completion, privacy, output, and fallback-model assertions.
  • Historical pre-integration proof: 115 affected test files; 137 built-executable cases with two platform skips; package-integrity checks; Linux Node 24.19.0 compiler activity and real Gateway SIGTERM-to-natural-exit in 175ms; published 2026.9.9 driver update with readiness and durable/incognito state checks. Historical verification. Compiler traces are functional witnesses, not throughput benchmarks or universal deadlock proof.

Current-head CI run 38106144930 is red: 12 failing test jobs are attributed to the tested baseline (294b2e3), with complete job and source-bound evidence for native admission. They cover browser catalog/focus and a stale Details selector, channel mocks, Codex import/steering, and Claude discovery fixtures. None is claimed fixed or green by this PR. The original Gateway read-admission and node-wire timeout observations remain unreproduced, not declared fixed. Earlier local smoke preparation was refused by managed-artifact separation; no guard was bypassed.

Requested and directed by @steipete.

Work sessions

Worked on by


View the OpenClaw team session

roboclaw-bot and others added 2 commits October 10, 2026 18:04
Worked on by:
- @steipete

Co-authored-by: steipete <[email protected]>
OpenClaw-Publication: 09df66dc-cd63-4093-b782-154eeacdaa8f
@clawsweeper

clawsweeper Bot commented Oct 10, 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 channel: matrix Channel integration: matrix gateway Gateway runtime cli CLI command changes scripts Repository scripts commands Command implementations agents Agent runtime and tooling extensions: acpx extensions: qa-lab plugin: file-transfer plugin: mxc channel: reef Channel integration: reef plugin: onnx size: XL labels Oct 10, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 10, 2026
@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR restores Node’s default V8 compilers and makes executable lifecycle owners finish cleanup before exiting naturally.

Example: A Node 24.19.0 CLI command finishes with status 7 while native cleanup remains pending.

  • Before: Forced termination can bypass cleanup, with compiler defaults disabled to avoid an exit deadlock.
  • After: The CLI joins cleanup, retains status 7, and lets Node terminate with its default compiler settings.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful, owner-directed lifecycle work with reported shipped-entry-point evidence and meaningful process regressions; inspection found no new discrete defect, but CI attribution still blocks landing.
Proof confidence 🐚 platinum hermit (4/6) The ordinary contributor-proof gate is exempt for this collaborator-authored PR; its body reports built-CLI model completion, Linux Gateway natural exit, and published-driver update checks, with historical and platform limits stated.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: CLI and Gateway termination can stall or abandon cleanup, and the existing mitigation changes Node’s compiler defaults.
Reason: The collaborator-authored direction approves replacing the workaround with existing lifecycle owners and explicitly records the remaining native-platform limitations.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: this maintainer-directed PR replaces main’s compiler workaround with owned natural shutdown; current-head CI remains blocked, and no new actionable defect was established in the inspected paths.

Priority: P2
Reviewed head: a39a27b7f99c9d6b4e53dad9e924375bcd0b9387

Before merge

  • Complete next step - Account for every failed job in CI run 38106144930 with matching baseline evidence, repairing failures caused by this PR and qualifying inherited failures through the documented landing route.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied shipped-CLI and Linux Gateway observations are historical; native macOS and Windows qualification is expressly unclaimed.
Agent review details

How this fits together

CLI, Gateway, worker, and child-process lifecycle owners receive completion or cancellation requests and release accepted work, native resources, transports, and output before recording terminal outcomes.

flowchart TD
A[CLI or Gateway entry] --> B[Command lifecycle owner]
B --> C[Accepted work and child transports]
B --> D[Shutdown request]
D --> E[Join work and native cleanup]
C --> E
E --> F[Record exit status]
F --> G[Natural Node shutdown]
Loading

Technical review

Best possible solution:

Land the owned natural-shutdown cutover after current-head CI failures are repaired or qualify through the documented inherited-failure route.

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

No reproduction was run during this read-only review; the merged predecessor records real Node deadlocks, while current main mitigates them by disabling the affected compilers.

Is this the best way to solve the issue?

Owned cleanup and natural termination address the lifecycle cause while preserving explicit compiler policy, signal outcomes, and system-certificate trust.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Default V8 compiler suppression changes intended behavior with a stated reason (1aa0aeb: Observed forced-exit deadlocks required disabling both compiler paths; the predecessor documented measurable cost and natural-exit constraints.)
  • Process-owning skills-watcher detachment changes intended behavior with a stated reason (8832904: Detachment avoided synchronous macOS FSEvents retirement latency; this PR expressly accepts joining native retirement instead.)
  • Unix respawn signal termination keeps the original intent (5320028: Supervisors distinguish actual signal termination from numeric exits; the current patch preserves that distinction after child and output settlement.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

PR surface statistics unavailable: the file list is incomplete.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a maintainer-directed lifecycle improvement to an existing exit-deadlock mitigation, without an established urgent new user regression.
  • merge-risk: 🚨 compatibility: The patch changes process-exit semantics, restores compiler defaults, and adds opt-in SDK worker retirement; its documented native-shutdown tradeoffs are explicitly accepted in the collaborator-authored direction.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (7 earlier review cycles)
  • reviewed 2026-10-10T18:12:26.081Z sha a120747 :: needs changes before merge. :: [P1] [P1] Preserve Unix signal termination through respawn wrappers
  • reviewed 2026-10-10T22:39:00.121Z sha c54801d :: needs changes before merge. :: none
  • reviewed 2026-10-10T23:19:21.446Z sha 85115b0 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-11T00:00:59.897Z sha 62b0179 :: needs changes before merge. :: [P2] Align built-CLI terminal assertions with natural completion | [P2] Stop the capture fixture deadline from retaining the child
  • reviewed 2026-10-11T00:38:37.566Z sha 3a408fd :: needs changes before merge. :: none
  • reviewed 2026-10-11T01:53:39.631Z sha 9b95ad8 :: needs changes before merge. :: none
  • reviewed 2026-10-11T02:35:48.009Z sha 9b95ad8 :: needs changes before merge. :: none

Reviewed October 10, 2026, 11:06 PM ET / October 11, 2026, 03:06 UTC (Revision 8).

roboclaw-bot and others added 2 commits October 10, 2026 19:51
Worked on by:
- @steipete

Co-authored-by: steipete <[email protected]>
OpenClaw-Publication: 0cf512ac-0bca-402e-aab2-7a2721c9175a
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review October 10, 2026 19:55
roboclaw-bot and others added 2 commits October 10, 2026 22:20
Join process-owned CLI skills watchers and leave terminal restoration with the terminal owners. Align natural-exit and native-cleanup fixtures without restoring forced exits.

Integrate the exact CI-tested main base and repair memory publication observation, eligible terminal transcript recording, fallback thinking metadata, and compatible Responses private-context expectations. Preserve the post-reload UI readiness boundary.

Co-authored-by: steipete <[email protected]>
Worked on by:
- @steipete

Co-authored-by: steipete <[email protected]>
OpenClaw-Publication: 2997ea59-8441-47bb-b6ee-88c5d27a5f84
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui extensions: memory-core Extension: memory-core labels Oct 10, 2026
Merge pinned main ea4693e while retaining natural shutdown ownership. Adopt its already-reviewed canonical private-completion parser and native/compatible carrier tests instead of duplicating the branch-local oracle. Preserve negative controls for leaked, missing, unmarked, and stale private context.

Co-authored-by: steipete <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 2, 2026
matrix-js-sdk's timeoutSignal ponyfill arms a referenced setTimeout for every
request and never clears it. /sync requests use pollTimeout + 80s, so each
Matrix CLI command stayed alive for up to 110s after printing its result once
CLI completion stopped forcing process exit (#168587). The QA Matrix E2EE CLI
scenarios timed out on these idle waits.

Unref the deadline timer, matching AbortSignal.timeout semantics: an in-flight
request still keeps the process alive through its socket and the deadline still
fires while the loop is running.
RomneyDa added a commit that referenced this pull request Nov 3, 2026
matrix-js-sdk's timeoutSignal ponyfill arms a referenced setTimeout for every
request and never clears it. /sync requests use pollTimeout + 80s, so each
Matrix CLI command stayed alive for up to 110s after printing its result once
CLI completion stopped forcing process exit (#168587). matrix-js-sdk 43.0.0
still ships the same ponyfill.

Unref the deadline timer, matching AbortSignal.timeout semantics: an in-flight
request still keeps the process alive through its socket and the deadline still
fires while the loop is running.

Forward-port of 4bbc597 from release/2026.10.10.
RomneyDa added a commit that referenced this pull request Nov 5, 2026
matrix-js-sdk's timeoutSignal ponyfill arms a referenced setTimeout for every
request and never clears it. /sync requests use pollTimeout + 80s, so each
Matrix CLI command stayed alive for up to 110s after printing its result once
CLI completion stopped forcing process exit (#168587). matrix-js-sdk 43.0.0
still ships the same ponyfill.

Unref the deadline timer, matching AbortSignal.timeout semantics: an in-flight
request still keeps the process alive through its socket and the deadline still
fires while the loop is running.

Forward-port of 4bbc597 from release/2026.10.10.
RomneyDa added a commit that referenced this pull request Nov 5, 2026
)

* fix(matrix): defer ready status through startup

Keep account readiness in startup until Matrix startup maintenance and crypto ownership initialization have settled, preventing hard-restart consumers from interrupting final state handoff.

The monitor is the status controller's only consumer, so deferral is unconditional rather than an option.

Forward-port of 5fe32d9 from release/2026.10.10.

* fix(matrix): let Matrix CLI commands exit after their client stops

matrix-js-sdk's timeoutSignal ponyfill arms a referenced setTimeout for every
request and never clears it. /sync requests use pollTimeout + 80s, so each
Matrix CLI command stayed alive for up to 110s after printing its result once
CLI completion stopped forcing process exit (#168587). matrix-js-sdk 43.0.0
still ships the same ponyfill.

Unref the deadline timer, matching AbortSignal.timeout semantics: an in-flight
request still keeps the process alive through its socket and the deadline still
fires while the loop is running.

Forward-port of 4bbc597 from release/2026.10.10.

* fix(matrix): report late in-room verification failures instead of crashing

matrix-js-sdk starts in-room verification processing without awaiting it,
including after an encrypted verification event finishes decrypting. Once the
client has stopped, OpenClaw's retired crypto IndexedDB generation rejects
receiveVerificationEvent, and the rejection reaches the process
unhandled-rejection guard, which begins process exit. In the QA Matrix lane the
exit gate stopped the CLI scheduler mid-run, so every later isolated scenario
failed with "Failed to stage the isolated QA auth profile store".
matrix-js-sdk 43.0.0 still leaves this path unguarded.

Catch and log the failure inside the SDK's fire-and-forget verification path.

Forward-port of 2a6a3bc from release/2026.10.10.

* test(qa): align Matrix E2EE scenarios with offline ownership contracts

Two Matrix QA scenarios asserted behavior the product intentionally retired;
earlier lane failures masked them.

- matrix-e2ee-cli-setup-then-gateway-reply ran `openclaw matrix encryption
  setup` while the Gateway owned the state root. Since #168471 only verify
  status/bootstrap/device route through a running Gateway; other Matrix
  commands refuse until it is stopped (docs/channels/matrix.md). Run setup in
  the stop/run/restart window, then keep the Gateway reply proof.
- matrix-e2ee-corrupt-crypto-idb-snapshot expected backup restore to repair a
  corrupted crypto snapshot. Since #160707 crypto ownership refuses unsafe or
  corrupt snapshots and points at `openclaw matrix doctor inspect`
  (docs/channels/matrix/encryption.md). Assert that refusal and that the
  corrupted snapshot is left in place.

The refusal assertion and the backup-bootstrap classifier move to the
destructive-recovery sibling to keep the scenario module under its line cap.

Forward-port of 0f4dc59 from release/2026.10.10.

* test(matrix): scope forward-port regression allocation
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 5, 2026
…claw#192385)

* fix(matrix): defer ready status through startup

Keep account readiness in startup until Matrix startup maintenance and crypto ownership initialization have settled, preventing hard-restart consumers from interrupting final state handoff.

The monitor is the status controller's only consumer, so deferral is unconditional rather than an option.

Forward-port of 5fe32d9 from release/2026.10.10.

* fix(matrix): let Matrix CLI commands exit after their client stops

matrix-js-sdk's timeoutSignal ponyfill arms a referenced setTimeout for every
request and never clears it. /sync requests use pollTimeout + 80s, so each
Matrix CLI command stayed alive for up to 110s after printing its result once
CLI completion stopped forcing process exit (openclaw#168587). matrix-js-sdk 43.0.0
still ships the same ponyfill.

Unref the deadline timer, matching AbortSignal.timeout semantics: an in-flight
request still keeps the process alive through its socket and the deadline still
fires while the loop is running.

Forward-port of 4bbc597 from release/2026.10.10.

* fix(matrix): report late in-room verification failures instead of crashing

matrix-js-sdk starts in-room verification processing without awaiting it,
including after an encrypted verification event finishes decrypting. Once the
client has stopped, OpenClaw's retired crypto IndexedDB generation rejects
receiveVerificationEvent, and the rejection reaches the process
unhandled-rejection guard, which begins process exit. In the QA Matrix lane the
exit gate stopped the CLI scheduler mid-run, so every later isolated scenario
failed with "Failed to stage the isolated QA auth profile store".
matrix-js-sdk 43.0.0 still leaves this path unguarded.

Catch and log the failure inside the SDK's fire-and-forget verification path.

Forward-port of 2a6a3bc from release/2026.10.10.

* test(qa): align Matrix E2EE scenarios with offline ownership contracts

Two Matrix QA scenarios asserted behavior the product intentionally retired;
earlier lane failures masked them.

- matrix-e2ee-cli-setup-then-gateway-reply ran `openclaw matrix encryption
  setup` while the Gateway owned the state root. Since openclaw#168471 only verify
  status/bootstrap/device route through a running Gateway; other Matrix
  commands refuse until it is stopped (docs/channels/matrix.md). Run setup in
  the stop/run/restart window, then keep the Gateway reply proof.
- matrix-e2ee-corrupt-crypto-idb-snapshot expected backup restore to repair a
  corrupted crypto snapshot. Since openclaw#160707 crypto ownership refuses unsafe or
  corrupt snapshots and points at `openclaw matrix doctor inspect`
  (docs/channels/matrix/encryption.md). Assert that refusal and that the
  corrupted snapshot is left in place.

The refusal assertion and the backup-bootstrap classifier move to the
destructive-recovery sibling to keep the scenario module under its line cap.

Forward-port of 0f4dc59 from release/2026.10.10.

* test(matrix): scope forward-port regression allocation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui channel: matrix Channel integration: matrix channel: reef Channel integration: reef cli CLI command changes commands Command implementations docs Improvements or additions to documentation extensions: acpx extensions: qa-lab gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. plugin: file-transfer plugin: mxc plugin: onnx rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant