Skip to content

fix(runtime): workers fail silently after Node is upgraded under a running Gateway - #175206

Merged
steipete merged 10 commits into
mainfrom
codex/stab-runtime-binary-gone
Oct 17, 2026
Merged

steipete merged 10 commits into
mainfrom
codex/stab-runtime-binary-gone

Conversation

@steipete

@steipete steipete commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: when Node is upgraded underneath a running Gateway (for example brew upgrade node removing the Cellar path the Gateway was started from), every new worker process fails to start. Read-only SQLite sessions, schema inspection, vector, broker and other workers die with opaque errors such as SQLite read-only worker exited with signal SIGABRT (dyld cannot find the removed libraries) or ENOENT. The Gateway itself stays up with nothing that says what happened or what to do, and resident worker threads keep serving some reads, so health looks fine while new work fails.

User Impact

User impact: after a Node upgrade, a service-managed Gateway restarts itself once into the new Node and keeps working. If the service's own Node is unusable, the Gateway stays up and clearly reports NODE_RUNTIME_UNAVAILABLE with "Restart the Gateway", health shows the runtime unavailable, and /readyz returns 503 instead of failing silently.

Why This Change Was Made

Maintainer decision (Peter): "Restart via lifecycle". When the service command's runtime resolves to a working Node, the Gateway asks its existing lifecycle owner for a graceful restart into a fresh process. Otherwise it stays up in report-only mode, which avoids restart loops when the pinned binary is gone.

  • Diagnosis (one owner). A shared child-runtime viability owner (src/infra/child-runtime-viability.ts) classifies confirmed startup failures of the retained executable. dyld symbol errors are confirmed with a bare-Node probe, so an add-on-only loader failure cannot disable the runtime. The owner logs the diagnosis once and rejects further launches immediately. Readiness observations publish to the same owner.
    • Paths covered: SQLite read-only sessions and one-shots, integrity, schema inspection, vector workers, the spawn broker, and Tailscale.
    • childRuntime.available becomes false, and /readyz returns 503 with failing: ["child-runtime"].
    • Native error metadata and stderr ordering are preserved.
  • Recovery (existing lifecycle owner). Recovery triggers once per diagnosis. It verifies the service's Node can start (--version); on launchd it also checks the loaded job against its plist. It then requests a graceful restart through the existing lifecycle restart and supervisor handoff, with admission close, active-work drain and a fresh process. It never uses the in-process restart fallback, which cannot repair this condition.
    • A loop guard keeps the Gateway report-only if the service runtime is unusable or a restart for this reason already happened recently.
    • Unmanaged foreground Gateways stay report-only.
  • No protocol, schema, config, SDK, dependency or persistent-state change. Health and restart docs describe the behavior.

Evidence

  • Live, real launchd service (throwaway profile and port; the service's Node was a symlinked copy). The upgrade was simulated by copying Node to a new path, flipping the symlink and deleting the old path; everything was cleaned up after each cycle.
    • (A) Viable new Node: exactly one diagnosis and one restart request. Clean shutdown took 1,032 ms, the PID went from 71618 to 84546, and launchd runs went from 1 to 2. The new process ran on the new Node, readiness returned 200, and chat.history, health and sessions.list succeeded.
    • (B) Service Node also unusable: one report-only decision and zero restart requests. The PID and run count were unchanged across 182 s. Liveness stayed 200, readiness stayed 503, and health reported childRuntime.available: false.
    • The first live run found a real gap: readiness saw the missing executable but did not hand it to recovery, because resident workers kept serving reads, so no restart happened. Fixed here; the regression expected one recovery and saw zero before the fix.
  • Before: a real Homebrew Node upgrade under campaign Gateways produced SQLite read-only worker exited with signal SIGABRT on new worker spawns with no diagnosis. The regression reproduced the opaque exit 134 with dyld stderr before the fix.
  • Earlier focused rounds: 277 + 48 tests passed across the affected suites, each run individually: viability classifier, read-only sessions, broker, vector, schema inspection, readiness, recovery decision cases, and respawn. Core and scoped types, lint, format, import boundaries, wrapper inventory, and madge (0 cycles) pass. Codex autoreview is scoped-clean.
  • Known test timeouts, not caused here:
    • The run-loop SIGINT package-lifecycle case times out identically on main (inherited).
    • The SIGTERM case passes on both main and this branch, but timed out once under heavy host load.
  • Size after main integration: production +516/−94, tests +782/−9, docs +40/−0; 30 files.

Main integration validation

Merged current main while preserving its retirement of the standalone database-verification subprocess and keeping the current bounded-diagnostic tests. The lifecycle recovery policy is unchanged.

The resolved candidate passed 19 focused tests: current verifier diagnostics (9), real read-only runtime failures/readiness (8), and lifecycle drain/failed-handoff behavior (2). Core types, targeted type-aware lint, formatting, and diff checks passed. A fresh independent review of the complete 30-file delta found no actionable P0–P2 or security findings; the signed merge commit has exactly the reviewed tree. The previously documented SIGINT timeout and one-off SIGTERM timeout remain attributed as above; this does not claim a fully green local run-loop suite.

Landing review correction

Exact-head CI and ClawSweeper exposed a pre-handshake diagnosis gap: a child can lose IPC, or exit before transferred stderr arrives. Those observed startup failures now reach the existing bounded bare-runtime probe. The probe still requires runtime failure evidence; ordinary worker crashes and add-on-only loader errors leave a usable Node available.

The correction also gives the ordinary-crash fixture an IPC admission barrier, completes fake broker disconnect receipts, types the restart-request mock from production, resolves a real Node service target when tests run under Bun, and documents the isolated logger mock. A new regression failed before the classifier correction because the broken executable remained present and the IPC error contained no executable path. The real broker regression also exposed the bare-exit shape before the session correction.

CI run 39011161425 on head 92efc80 found the task-owned defects above. Its separate session-accessor disposal and worker-placement failures match scheduled main run 39010956087 exactly (jobs 117333372934 and 117333373118). The older Bun stderr shutdown timeout remains unattributed: the untouched test passed on the baseline under pinned Bun, which is not a claim that the timeout was fixed. Local CLI test types additionally find two inherited stale using declarations in config health-state tests; main already fixes them in 7b727f0, and that fix was present in the original CI merge baseline.

Final correction proof: Node classifier and real read-only runtime 19/19; Bun read-only session/runtime 19/19, broker stderr 5/5, recovery budget 2/2 and lifecycle drain/failed-handoff 2/2. Core types, targeted type-aware lint, formatting and mock-export ratchet pass. Local CLI test types retain only the inherited config-health using error described above. Final product delta: production +515/−100, tests +826/−10, docs +40/−0 across 31 files.

Final test-fixture corrections

The snapshot timeout expectation excludes the independent bare-Node diagnostic probe while still asserting exactly one snapshot launch and its timeout, kill signal, hidden-window and stdio options. The real sync and async timeout cases passed.

A later CI investigation found that the Tailscale claim fixture emitted exit without native close, leaving cleanup waiting now that the production owner correctly waits for stderr completion. The fixture now emits exit followed by close for normal stop, kill and explicit exit scenarios, and expects piped stderr. Before the correction, all three selected denial cases timed out locally; afterward all 31 tests passed under both Node and Bun. Targeted type-aware lint, formatting, infra test types and diff checks passed. Production source is unchanged by these test corrections.

Independent P0–P2 review of the final Tailscale fixture correction is scoped-clean. Fresh exact-head CI and ClawSweeper review are requested for 3e2ee6215109383194f2564b0a59119b30cc01e6; earlier CI is retained as historical failure evidence, not current-head success.

Final CI attribution

CI run 39021553780, attempt 1 completed on final head 3e2ee6215109383194f2564b0a59119b30cc01e6. Both PostgreSQL conformance jobs, all production/test typecheck lanes, and security-fast passed. Independent Security Review 39021551842 passed. ClawSweeper revision 5 reviewed this exact head with no actionable or security findings and no remaining before-merge items.

Five baseline-attributed root failures leave CI red; the failed openclaw/ci-gate is their aggregate.

Failed job Attribution
117364631507, UI 3/8 Startup-history paint case matches scheduled main 39021393912/job 117363944623.
117364631603, UI 4/8 Both model-selection label cases match scheduled main/job 117363944654.
117364631525, UI 5/8 Composer layout measurement: source-attributed; no exact scheduled-main case match claimed.
117364631564, UI 6/8 Row mode matches scheduled main/job 117363944644; steady-state composer matches job 117363944654. The frame-budget variant is source-attributed.
117364631831, Node compact large 13 Initial catalog worker-thread pool count (2 instead of 1), before failure injection: source-attributed; no exact scheduled-main case match claimed.

The actual tested merge is 74e718f461ba350acb75d253090282c4caa3b8ac, with ordered parents baseline 85507ee9070bb97345b7621440d683845dd64403 and this PR head. Complete UI/package/test-fixture inputs and the directly imported contracts are identical between baseline and tested merge. For the catalog case, the complete agents/plugins trees and test/shared inputs are also identical; that healthy initial worker-thread load does not execute child-process runtime recovery. The native inherited-failure evidence retains the exact input objects, job logs, checkout, passing scoped checks, and complete failed-job accounting.

…ades

Classify retained-runtime loader and exec failures at worker startup, report
one actionable restart error, and mark Gateway readiness degraded. Preserve
native error metadata and completion across process-worker owners, then
reject further launches once runtime loss is confirmed. Keep ordinary
worker crashes and supervisor exit/restart policy unchanged.

Cover real native and brokered pre-handshake failures, removed or
non-executable runtimes, addon-only loader errors, once-only logging,
and cached readiness. Retain session-owned capture for delayed broker
pipes. Move broker spawn-option translation to its existing pipe owner
and cut over both callers.
…start

Request one graceful fresh-process restart when the native service command's
Node can start. Preserve admission, active-work drain, and supervisor handoff
ownership; refuse in-process fallback when the retained runtime is unavailable.

Keep unverifiable targets and recent runtime-recovery successors report-only.
Verify launchd's loaded job corresponds to its definition before probing Node.
Reuse the existing health fields and shutdown history without new config or
persistent-state contracts.

Prove decision cases, graceful drain ordering, failed-handoff exit, and retained
degraded health. Document automatic recovery and operator repair behavior.
Require the existing bare-Node probe for missing-symbol diagnostics that native addons can also emit. Prepare compiled subprocesses before runtime-recovery test hooks.
Publish confirmed missing Node executable observations from health and readiness through the shared diagnosis owner. Service-managed Gateways can request guarded fresh-process lifecycle recovery even while resident workers continue serving reads.

Exercise the real readiness boundary after deleting an executable, preserve one-shot publication, and correct fixture isolation and the deferred test type. Real isolated launchd proof verifies one successful restart with a viable service runtime and report-only behavior without a loop when that runtime is unusable.
@clawsweeper

clawsweeper Bot commented Oct 17, 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T09:36:42.163163Z 3e2ee62 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime cli CLI command changes commands Command implementations size: XL labels Oct 17, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 17, 2026
@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Diagnose unavailable child runtimes and request one graceful service restart when a working replacement Node is verified.

Example: A Homebrew Node upgrade removes the executable retained by a running launchd Gateway.

  • Before: New SQLite workers fail with ENOENT or SIGABRT while the Gateway remains running.
  • After: The Gateway diagnoses NODE_RUNTIME_UNAVAILABLE and requests one graceful restart when the service Node works; otherwise readiness returns 503 with actionable recovery guidance.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful, coherent repair with recorded service-level recovery evidence, focused boundary regressions, and no actionable findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The recorded isolated launchd service exercised executable removal through real readiness and lifecycle recovery, showing one successful fresh-process restart and a separate unusable-target case with no restart loop; the latest commit changes only fixture completion events.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: After Node is upgraded, a Gateway can remain alive while new worker operations fail with opaque errors.
Reason: The maintainer approved lifecycle restart, and the implementation retains report-only behavior when a safe replacement cannot be verified.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-directed repair addresses a concrete runtime failure, and the final fixture correction introduces no actionable defect; current-head CI remains pending.

Priority: P1
Reviewed head: 3e2ee6215109383194f2564b0a59119b30cc01e6

Before merge

None.

Findings

None.

Agent review details

How this fits together

Worker launchers publish startup failures to the shared runtime owner, which supplies health facts and delegates recovery to the existing Gateway lifecycle.

flowchart TD
  A[Worker startup failure] --> B[Child runtime owner]
  C[Health and readiness observation] --> B
  B --> D[Unavailable runtime diagnosis]
  D --> E[Service runtime verification]
  E --> F[Graceful lifecycle restart]
  E --> G[Report only recovery guidance]
Loading

Technical review

Best possible solution:

Land the shared diagnosis and guarded lifecycle recovery after required current-head checks pass.

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

Current-main launchers retain process.execPath, so removing that executable establishes the failing startup path; the PR also records real upgrade failures and isolated launchd reproduction, without this review executing target code.

Is this the best way to solve the issue?

The repair preserves exact-runtime requirements and uses existing diagnosis, admission, drain, and supervisor owners instead of substituting a potentially incompatible interpreter.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Runtime availability and diagnostic text changes intended behavior with a stated reason (92c86fe: Expose the running Gateway's missing Node path through deep status and Doctor without automatically restarting it.)
  • Exact-runtime worker selection keeps the original intent (520db50: Native modules and bidirectional V8 serialization require the parent's exact runtime even when command relays can use a stable Node path.)
  • Broker spawn-option translation keeps the original intent (67cedc3: Translate supported child-process options while retaining host ownership of unsupported descriptors and cancellation.)
  • Worker completion and pooled-reader lifecycle keeps the original intent (refactor(auth): prepare runtime profile reads asynchronously #149309: Keep isolated reads and their resource claims owned through native process completion; the patch collects startup diagnostics without replacing that settlement owner.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Final correction matches native completion: The latest commit changes only the Tailscale claim fixture: stop, kill, and explicit exits emit exit followed by close, and the launch expectation includes piped stderr. (src/infra/tailscale.claim.test.ts:46, 3e2ee6215109)
  • Earlier findings addressed: Pre-handshake errors now reach the bounded bare-runtime probe; the ordinary-crash control admits its IPC request before exiting, broker fixtures complete disconnect receipts, and the restart mock uses the production signature. (src/infra/child-runtime-viability.ts:172, 3e2ee6215109)
  • Recovery retains lifecycle ownership: Recovery verifies the effective service Node, refuses unverifiable or recently recovered targets, and checks current lifecycle ownership immediately before requesting restart; failed handoff cannot fall back to an in-process restart. (src/infra/process-respawn.ts:68, 3e2ee6215109)
  • Recorded live recovery evidence: The PR records an isolated launchd upgrade simulation: the viable replacement changed PID from 71618 to 84546 and restored readiness and RPCs; the unusable replacement retained its PID, requested no restart, and kept readiness at 503. The maintainer explicitly chose lifecycle restart and report-only refusal. (3e2ee6215109)
  • Current main still needs this repair: Fetched main checks executable access and formats warnings but lacks the shared failure latch and lifecycle recovery. The earlier stable-path repair deliberately retained exact runtimes for native workers; fix(gateway): spawn Node children through the stable runtime path after a Homebrew Node upgrade #166430 credits mightyx's report and reproduction. (src/infra/child-runtime-viability.ts:18, 85507ee9070b)
  • Existing watcher concern assessed: The directory-watch helper still launches directly, but that unchanged coverage gap is not an introduced regression; health and readiness independently publish a missing executable to recovery. (src/infra/directory-watch-host.ts:59, 3e2ee6215109)

Likely related people:

  • Peter Steinberger: Raw commit 67cedc3 adds src/process/spawn-broker/host.ts:104 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 67cedc32e996; files: src/process/spawn-broker/host.ts)
  • Olli: Raw commit 92c86fe adds src/infra/child-runtime-viability.ts:21 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 92c86fefcd44; files: src/infra/child-runtime-viability.ts)

PR surface

Source +415, Tests +823, Docs +40. Total +1278 across 33 files. Added test files: 4.

View PR surface stats
Area Files Added Removed Net
Source 15 515 100 +415
Tests 16 841 18 +823
Docs 2 40 0 +40
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 33 1396 118 +1278

Review metrics

Metric Value Why it matters
Production versus test changes Production +515/-100; tests +841/-18 Growth supports one shared diagnosis owner, guarded lifecycle recovery, and distinct native, broker, readiness, and recovery regressions.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: A Node upgrade can leave a running Gateway unable to launch workers required for normal agent operations.
  • 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.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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 execution lanes are retired.

History

Review history (4 earlier review cycles)
  • reviewed 2026-10-17T06:13:55.895Z sha 0058e3e :: needs changes before merge. :: none
  • reviewed 2026-10-17T07:02:30.812Z sha 92efc80 :: needs changes before merge. :: [P2] Handle pre-handshake IPC failure in the runtime diagnosis | [P2] Make the ordinary-crash control independent of IPC timing | [P2] Complete the fake broker's IPC lifecycle before awaiting recovery | [P2] Type the restart mock with the production request signature
  • reviewed 2026-10-17T07:51:01.144Z sha 33e627e :: needs maintainer review before merge. :: none
  • reviewed 2026-10-17T09:05:20.923Z sha aab7006 :: needs changes before merge. :: none

Reviewed October 17, 2026, 5:39 AM ET / 09:39 UTC (Revision 5).

@openclaw-barnacle openclaw-barnacle Bot reopened this Oct 17, 2026
Merge origin/main at 2044a2c.
Keep the retired standalone verifier removed and retain the current
bounded-diagnostic tests. Preserve runtime diagnosis and lifecycle recovery
for the remaining worker owners.
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Resolved the main conflict while preserving removal of the retired standalone verifier. The signed head is 92efc804ad599e760e517c089a46759308e31ab1; 19 focused tests, core types, targeted lint, formatting, and a fresh complete-delta independent review pass. The PR body contains the updated proof and retained timeout attribution.

@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 17, 2026
@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 17, 2026
Emit native exit then close from the fake route owner for stop, kill,
and explicit exits. Keep the launch assertion aligned with captured
stderr. Production waits for close so runtime diagnosis sees all stderr.

Before this correction, three denial cases time out locally and the
prior CI shard repeatedly stalls in the claim fixture. Afterward all
31 tests pass under Node and Bun. Targeted lint, formatting, infra test
types, and independent P0-P2 review pass.
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Please review current head 3e2ee6215109383194f2564b0a59119b30cc01e6. The final correction makes the Tailscale claim fake emit native exit followed by close and updates its stderr expectation. Three selected denial cases timed out before the correction; all 31 tests now pass under both Node and Bun. Infra types, lint, formatting, and independent P0–P2 review pass. Production source is unchanged. The PR body now records both final fixture corrections and their proof.

@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 17, 2026
@steipete
steipete merged commit ec23eef into main Oct 17, 2026
159 of 166 checks passed
@steipete
steipete deleted the codex/stab-runtime-binary-gone branch October 17, 2026 10:18
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

steipete added a commit that referenced this pull request Oct 17, 2026
The reason added by #175206 has always been consumed within process-respawn.
Remove its unused export while retaining the recent-restart loop check,
graceful lifecycle request and independent admission reason unchanged.

Validation: both process-respawn suites pass, 37 tests in 84.13s wall time.
The dependency scan no longer reports this export. Production and full-tree
unused-file scans pass; the MCP v1 peer fixtures are live compatibility
proof and their audit ownership was already repaired in 801d701.
P2 review found no actionable findings.
steipete added a commit that referenced this pull request Oct 17, 2026
The loader fixture added by ec23eef (#175206) can receive bootstrap
EPIPE before native exit. Closing then records its intentional loader
failure as a shutdown error. Awaiting that close before restoring
process.execPath leaked the synthetic Node path into later process tests;
removing the fixture left those tests spawning a nonexistent executable.

Restore the original runtime before cleanup. Validate only the exact
expected loader shutdown error, and prove a fresh broker starts afterward.
Keep every readiness, stderr, descriptor, and lifecycle assertion. The
runtime detector correctly diagnosed the broken fixture; production code
is unchanged.

Reproduced the original failure on Linux with host-stderr.test.ts under
--maxWorkers=1 --repeats 30 (1 failed, 4 passed; 29.17s wrapper).
After repair, seven selected files pass 40 tests on Linux (12.09s), and
six process files pass with --maxWorkers=4 --repeats 10 (26.90s), including
both real EMFILE cases. On macOS the same serial proof passes 38 tests
with two Linux-only skips (46.22s wall), and parallel pressure passes
27 tests with those same skips (96.99s wall).

Targeted services test types, normal/boundary lint, formatting and P2
review pass. No retries, timeout changes, or production recovery changes.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
…nning Gateway (openclaw#175206)

* fix(runtime): diagnose unavailable worker executables after Node upgrades

Classify retained-runtime loader and exec failures at worker startup, report
one actionable restart error, and mark Gateway readiness degraded. Preserve
native error metadata and completion across process-worker owners, then
reject further launches once runtime loss is confirmed. Keep ordinary
worker crashes and supervisor exit/restart policy unchanged.

Cover real native and brokered pre-handshake failures, removed or
non-executable runtimes, addon-only loader errors, once-only logging,
and cached readiness. Retain session-owned capture for delayed broker
pipes. Move broker spawn-option translation to its existing pipe owner
and cut over both callers.

* fix(gateway): recover unavailable child runtimes through lifecycle restart

Request one graceful fresh-process restart when the native service command's
Node can start. Preserve admission, active-work drain, and supervisor handoff
ownership; refuse in-process fallback when the retained runtime is unavailable.

Keep unverifiable targets and recent runtime-recovery successors report-only.
Verify launchd's loaded job corresponds to its definition before probing Node.
Reuse the existing health fields and shutdown history without new config or
persistent-state contracts.

Prove decision cases, graceful drain ordering, failed-handoff exit, and retained
degraded health. Document automatic recovery and operator repair behavior.

* test(gateway): prepare lifecycle imports before case deadlines

* fix(runtime): verify dyld symbol failures before recovery

Require the existing bare-Node probe for missing-symbol diagnostics that native addons can also emit. Prepare compiled subprocesses before runtime-recovery test hooks.

* fix(runtime): recover missing executables observed by readiness

Publish confirmed missing Node executable observations from health and readiness through the shared diagnosis owner. Service-managed Gateways can request guarded fresh-process lifecycle recovery even while resident workers continue serving reads.

Exercise the real readiness boundary after deleting an executable, preserve one-shot publication, and correct fixture isolation and the deferred test type. Real isolated launchd proof verifies one successful restart with a viable service runtime and report-only behavior without a loop when that runtime is unusable.

* fix(runtime): confirm pre-handshake worker exit failures

Probe the retained runtime after startup IPC errors or an observed read-only
worker exit, including broker exits whose stderr arrives too late. A healthy
bare-runtime probe still preserves ordinary worker and add-on failure behavior.

Complete broker fixture disconnect receipts, admit the ordinary-crash fixture
request before exit, type the restart request mock, and use a real Node service
target when the lifecycle regression runs under Bun.

* test(runtime): separate snapshot budgets from runtime probes

Keep the exact snapshot launch and timeout assertions while excluding the diagnostic Node version probe after a pre-start timeout. Production behavior is unchanged.

Validation: real sync and async timeout cases pass; targeted lint and format pass; infra test types pass. Full test types retain the already-attributed config health disposal errors. Independent P0-P2 review is scoped-clean.

* test(runtime): complete Tailscale claim child lifecycle

Emit native exit then close from the fake route owner for stop, kill,
and explicit exits. Keep the launch assertion aligned with captured
stderr. Production waits for close so runtime diagnosis sees all stderr.

Before this correction, three denial cases time out locally and the
prior CI shard repeatedly stalls in the claim fixture. Afterward all
31 tests pass under Node and Bun. Targeted lint, formatting, infra test
types, and independent P0-P2 review pass.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
The reason added by openclaw#175206 has always been consumed within process-respawn.
Remove its unused export while retaining the recent-restart loop check,
graceful lifecycle request and independent admission reason unchanged.

Validation: both process-respawn suites pass, 37 tests in 84.13s wall time.
The dependency scan no longer reports this export. Production and full-tree
unused-file scans pass; the MCP v1 peer fixtures are live compatibility
proof and their audit ownership was already repaired in b2f3d47.
P2 review found no actionable findings.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
The loader fixture added by dbcbf12 (openclaw#175206) can receive bootstrap
EPIPE before native exit. Closing then records its intentional loader
failure as a shutdown error. Awaiting that close before restoring
process.execPath leaked the synthetic Node path into later process tests;
removing the fixture left those tests spawning a nonexistent executable.

Restore the original runtime before cleanup. Validate only the exact
expected loader shutdown error, and prove a fresh broker starts afterward.
Keep every readiness, stderr, descriptor, and lifecycle assertion. The
runtime detector correctly diagnosed the broken fixture; production code
is unchanged.

Reproduced the original failure on Linux with host-stderr.test.ts under
--maxWorkers=1 --repeats 30 (1 failed, 4 passed; 29.17s wrapper).
After repair, seven selected files pass 40 tests on Linux (12.09s), and
six process files pass with --maxWorkers=4 --repeats 10 (26.90s), including
both real EMFILE cases. On macOS the same serial proof passes 38 tests
with two Linux-only skips (46.22s wall), and parallel pressure passes
27 tests with those same skips (96.99s wall).

Targeted services test types, normal/boundary lint, formatting and P2
review pass. No retries, timeout changes, or production recovery changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. cli CLI command changes commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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