Repository navigation
fix: let updates stop a Gateway that OpenClaw reran under a compatible Node - #203152
Conversation
…r Node A service whose Node is unsupported or lacks a recommended security patch reruns the Gateway under a compatible Node as a child of the launcher, so the service's main PID never equals the PID the resident reports. Maintenance drain refused every such update with 'Gateway process changed during maintenance drain'. Accept the resident when every Gateway port listener is that process and its parent is the service's main process, matching restart port ownership. Refs #202954
|
🦞👀 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. What this changesThis PR lets maintenance drain recognize a Gateway running as the service launcher's direct child under a recovered Node runtime. Example: systemd tracks launcher PID 42 while Gateway PID 43 serves port 18789 under a compatible Node.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it narrowly repairs a current managed-update failure, and inspection found no actionable code defect. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe update maintenance owner connects to the local Gateway, verifies its identity and lifecycle readiness, and invokes the existing native service stop. flowchart LR
A[Update maintenance] --> B[Inspect native service]
B --> C[Query local Gateway]
C --> D[Verify PID and listener parent]
D --> E[Drain lifecycle work]
E --> F[Stop native service]
Technical reviewBest possible solution: Keep resident recognition in the existing maintenance owner and accept the verified serving child while retaining native service identity and lifecycle safeguards. Do we have a high-confidence way to reproduce the issue? Source establishes the failure: runtime recovery creates a serving child, while current-main maintenance requires its reported PID to equal the launcher's native service PID; the linked report observes that layout. Is this the best way to solve the issue? This is a focused repair of resident identity recognition: one reused local predicate covers the affected paths without introducing state, retries, options, or another service owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 314a47d16d80. Provenance checked
TestingProof path: unit tests only. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +22, Tests +27, Docs +8. Total +57 across 3 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 21, 2026, 11:03 AM ET / 16:03 UTC. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Merged via squash.
|
…e Node (openclaw#203152) * fix(update): drain a Gateway that runtime recovery reran under another Node A service whose Node is unsupported or lacks a recommended security patch reruns the Gateway under a compatible Node as a child of the launcher, so the service's main PID never equals the PID the resident reports. Maintenance drain refused every such update with 'Gateway process changed during maintenance drain'. Accept the resident when every Gateway port listener is that process and its parent is the service's main process, matching restart port ownership. Refs openclaw#202954 * docs(update): runtime recovery reruns the Gateway only when its Node fails admission Co-authored-by: Peter Steinberger <[email protected]>
…e Node (#203152) * fix(update): drain a Gateway that runtime recovery reran under another Node A service whose Node is unsupported or lacks a recommended security patch reruns the Gateway under a compatible Node as a child of the launcher, so the service's main PID never equals the PID the resident reports. Maintenance drain refused every such update with 'Gateway process changed during maintenance drain'. Accept the resident when every Gateway port listener is that process and its parent is the service's main process, matching restart port ownership. Refs #202954 * docs(update): runtime recovery reruns the Gateway only when its Node fails admission Co-authored-by: Peter Steinberger <[email protected]> (cherry picked from commit a27f0c3) Release-companions: #204017 is a separate Linux release-install Doctor fallback when lsof/ss cannot attribute listeners; it is not required for this attributed-listener runtime-recovery case. #203486 pnpm recovery, #201668 data-risk repair, and #202591 snapshot cleanup only overlap documentation; #203236 is independent auto-update retry policy. The neighboring native drain suite remains unchanged. Co-authored-by: RomneyDa <[email protected]>
…e Node (#203152) Baseline adaptation: Use the listener PID and immediate service parent for the launcher fallback, preserving resident identity and stop authority checks. (cherry picked from commit a27f0c3) Co-authored-by: RomneyDa <[email protected]>
…#203236) * fix(update): back off identical automatic update failures Automatic campaigns retried a target that kept failing the same way before activation (for example managed-service-stop-failed) every hour forever. One install accumulated ~330 failed runs, each costing a validation pass and a candidate state snapshot. The campaign already used the newest terminal run rows as its durable backoff fact for repeated activation failures. Extend that streak to every identical failure class for the same target: keep the hourly first retry, then wait 2, 4, 8 and 16 hours and once a day after six. A new target, a success, or a manual update breaks the streak. No new state, store, or config. Refs #202954 * test(update): assert backoff expiry before the new-candidate reset Co-authored-by: Peter Steinberger <[email protected]> (cherry picked from commit adc0876) Companion audit: #203194 and #203497 change update architecture and are not needed by the backoff; #203274 is chat reset cleanup, #203528 is node credential repair, and #203578 adds a separate database custody refusal. #203152 addresses stopping a Gateway after a Node runtime respawn, not pre-mutation outcome history; no dependency on that process-shutdown repair. Co-authored-by: RomneyDa <[email protected]>
Refs #202954
Related: #202642, #202633
What Problem This Solves
When the Node.js that a Linux systemd Gateway service starts with fails the Gateway's runtime check, OpenClaw reruns the Gateway under a compatible Node it finds, such as its private runtime in
~/.openclaw/tools/cli-node. The service's main process is then that launcher, and the Gateway that actually serves is its child. Every update of such a service fails withmanaged-service-stop-failed("Gateway process changed during maintenance drain"), although the Gateway is healthy. Automatic updates retry this every one to two hours. One reporter has about 330 failed runs, each taking ~10 minutes and leaving a ~1.9 GiB snapshot. 2026.10.8 and 2026.10.9 Gateways on Node 24 below 24.22.1 are in exactly this layout, and so is any release whose service Node is below its supported floor.User Impact
Updates succeed again for Gateways that OpenClaw reran under a compatible Node. The refusal comes from the installed updater's stop, before the package swap. The fix therefore applies to updates driven by a release that contains it. Installs already stuck on an older release need the one-time step posted on #202954: refresh the service definition from a CLI on a supported Node, or use the manual npm hop.
Why This Change Was Made
Maintenance drain required the PID the Gateway reports to equal the service's main PID, which is never true in this layout. The restart path already treats a port listener whose parent is the service's main process as the service's own Gateway (
listenerOwnedByRuntimePid). Drain now accepts the same relation, with a stricter rule: every listener on the Gateway port must be the reporting process, and its parent must be the service's main PID. Stopping the unit stops both processes. An unrelated listener, or a child of another parent, is still refused.Evidence
Regression test.
update-command-service-drain.test.tscovers the normal and explicit drain for the child case, plus the two refusals. On base, the two child cases fail (2 failed / 62 passed). With the fix, 87 tests pass across the drain, native drain and resident-restart suites.Live proof. Run on Crabbox Linux against a systemd user unit, with a private patched Node 24.22.1 in
~/.openclaw/tools/cli-node. The resident layout was captured before each update: MainPID is the launcher, and the port listener is its child on the private Node.Gateway process changed during maintenance drain; Gateway left on 10.9update.run)/readyz200 on target, twiceopenclaw gateway install --forcefrom a patched-Node CLI, then → 11.6A separate pre-existing problem showed up during this proof: main-driven Gateway
update.runupdates fail after the stop, with or without this layout and without this patch. It will be tracked separately and is unrelated to this change.Checks. Format and lint are clean.
$autoreviewis scoped-clean, and an independent Codex read-only review reported no findings.