Skip to content

fix: complete Gateway upgrades after Node prefix changes - #145335

Merged
fuller-stack-dev merged 52 commits into
mainfrom
fix/107930-node-upgrade-continuity-land
Sep 19, 2026
Merged

fuller-stack-dev merged 52 commits into
mainfrom
fix/107930-node-upgrade-continuity-land

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Sep 11, 2026 •

Copy link
Copy Markdown
Member

Problem

Closes #107930.

After a Node upgrade, the invoking CLI and managed Gateway can use different global installations. Preparation must preserve the verified service; an owned failed activation must recover its exact original runtime without losing operator data.

Implementation and scope

  • Keep the invoking installation as the update target; select a compatible installed Node or provision a checksum-verified private runtime. Rebind only the owned Gateway after candidate preparation and validation.
  • Preserve requester/executor authority and both original/candidate root owners across installer, native-service and Doctor children. Forced or uncertain child cleanup remains a canonical refusal, including nonzero commands.
  • Restore an owned runtime-pin rewrite and compensate retained service A even when before.stopped=false, under the actual final native lifecycle lock. Preserve operator timeout intent, current-main definition backups, ownership/readiness, and source-update contracts.
  • Preserve --no-restart, foreign services, non-rewritable definitions and fresh-profile preflight. Optional full-package scan budgets emit explicit unverified-contents warnings; mandatory runtime identities and strict package-swap bounds remain enforced.

Canonical head: 47aa7daa495e526b9cbef71d77ab77f105b44fa2; tree: a48bd890155f3f3cafa38419bb0e264147172326. Normal merges preserve original head 3d28f1bd5a6960bd0726a35db028dd617e0964a8 and Jason (Json), Peter Steinberger and Dallin Romney's contributor ancestry. No replacement PR, rebase or force-push.

The main-relative component contains 148 paths. The all-file audit retains updater regression/support coverage and required compiled native-worker entries/type-graph partitions. Browser tab provenance uses upstream #150233; generic Vitest profiling uses upstream #149010. PR defer-cleanup tooling, UI/Canvas and quota diagnostics are retained upstream history, not component changes.

Source and CI verification

Independent API reviews found no actionable P0–P2 findings in the authority/restoration repairs and subsequent integrations. Earlier qualified source includes the full519-case CLI suite,174 focused main-integration cases,140 changed handoff/native/partition cases, and148 package-integrity/original-service cases. The preceding timeout integration passed32 infra,19 migrated and70 CLI tests, with55 execution cases rerun after intact helper extraction. Existing line caps and exact-once shard coverage remain enforced.

The previous hosted merge tree exposed the newer structured PackageLauncherFingerprint API. All six failed jobs reported the same obsolete string declaration. Current source integrates main 695501b81158e483011df9416b14f8ea54236d1b, imports the authoritative type, preserves all207 upstream-only paths, and retains the component's typed optional scan limits. Frozen pnpm12.4 dependency sync adopted upstream fs-safe0.16 without changing the lockfile. Independent API review and current focused original-service/package-integrity/filesystem/lease-publication tests passed:234 passed, with one Bun-only case skipped on Node. The final typed fixture correction then passed19 migrated-worker and37 post-update tests, fresh core/CLI-update types, lint, formatting and the unchanged line-cap ratchet.

The subsequent main fd22b275d548b137f2054e39d7cd81674693c590 integration preserves all283upstream-only paths exactly. Its two partition conflicts were resolved by retaining upstream CLI-program exclusions and all ownership assertions alongside the dedicated updater/gateway-methods shards. The complete exact-once partition suite, fresh core/CLI-update typegraphs, lint, formatting, line-cap ratchet and independent API review passed. No component runtime source changed in this integration.

R13 hosted CI identified two inherited fixture readiness/teardown failures. Both were reproduced on the published source. The follow-up joins actual identity-bound task-event writes before teardown and gives two real-provider startup setup waits a finite10second budget. Product deadlines and all ownership/failure assertions remain unchanged. All31 corrected focused tests, owning typegraphs, style/line-cap checks and independent API review pass; original failures remain recorded.

Repository policy permits squash/rebase but not merge commits. Landing uses the supported squash path with verified explicit credit to Jason (Json), Peter Steinberger and Dallin Romney. Original commits remain in this canonical PR history; main receives the squash commit. No PR replacement or source-history rewriting.

Resulting-head hosted CI, supported prepare and merge remain pending. Prior failures are retained and are not counted as green resulting-head checks.

Finite isolated native component acceptance

Completed at direct product source 3e0ab8628b386635feb72d48f2b5e48d952c7cd3 (isolated runtime payloads A59a14/B6205; no newer-payload claim):

  • A served throughout actual B build and frozen deployment:1,205 completed readiness probes, all HTTP200.
  • Actual B activation and deliberate B failure restored A's captured service command/runtime pin with before.stopped=false; original2 sessions/4 messages retained their exact digest.
  • Actual external final-lock cases refused mutation after independent A or B lease revocation, executor-object replacement, and service reassignment. Service definition, pin, PID and health remained unchanged.
  • A native command exited7 with a TERM-resistant descendant: canonical uncertain/forced-cleanup refusal retained both roots, definite descendant extinction was verified, then supported exact owned lease reconciliation removed the four task rows.
  • Final A health and original data were verified. Supported uninstall removed the isolated registration, process and runtime pin; task state/runtime copies were verified removed. Shared lease storage was retained.

Subsequent integrations preserve the direct native restoration/ownership algorithm. Updated upstream fingerprint and bigint database-publication dependencies receive focused current-source tests; accepted native cases are not replayed.

Original signed-D1 Doctor failures remain failures. The earlier post-rebind outcome remains UNKNOWN/NOT_PROVED because its intended fault was not injected. Initial fixture failures and the optional entry-cap observation failure remain recorded; the latter was repaired and exercised on the actual tree.

The whole published-driver first-hop/npm-prefix installer journey, in-flight inference handoff and wider native-platform qualification are separate program obligations, not established by this bounded component acceptance. No live Odin deployment, restart or failure testing was performed.

@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 cli CLI command changes scripts Repository scripts size: XL maintainer Maintainer-authored PR labels Sep 11, 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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 11, 2026
@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 19, 2026, 6:22 PM ET / 22:22 UTC (Revision 40).

ClawSweeper review

What this changes

The PR selects compatible Node runtimes during updates, rebinds eligible Gateway services to the invoking installation, and restores the original service after failed activation.

Merge readiness

⛔ Blocked before merge - 7 items remain

The PR remains useful, but a source-proven Linux planning defect prevents ordinary systemd installations from receiving the intended prefix reconciliation. Earlier recovery repairs and their bounded native proof remain valid.

Priority: P1
Reviewed head: 47aa7daa495e526b9cbef71d77ab77f105b44fa2
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful recovery work has meaningful native evidence, but a concrete Linux contract mismatch blocks correctness.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The recorded native component run exercises retained-service restoration and final-effect rejection after lease revocation, executor replacement, and service reassignment; the inspected authority/restoration modules remain unchanged. That proof stands, but does not cover the newly identified Linux planning defect or establish complete published-driver qualification.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The recorded native component run exercises retained-service restoration and final-effect rejection after lease revocation, executor replacement, and service reassignment; the inspected authority/restoration modules remain unchanged. That proof stands, but does not cover the newly identified Linux planning defect or establish complete published-driver qualification.
Evidence reviewed 10 items Introduced Linux planning defect: The new canRebind condition rejects the presence of managedOverrides or managedDefinition. Ordinary canonical systemd units carry both fields, including managedOverrides: {}, so eligible split-prefix updates select the old service root instead of rebinding.
Canonical systemd metadata contract: The systemd reader includes the managed definition and override metadata for canonical user units; its drop-in reader deliberately returns an empty object when no overrides exist. Existing override helpers distinguish this from an operator override.
Same assumption in retained recovery: Original-service observation rejects either metadata field at lines 263–270, and original-definition restoration repeats that rejection at line 58. Repairing only planning would therefore expose a later refusal; the owning paths need one consistent interpretation.
Findings 1 actionable finding [P1] Recognize known-empty systemd metadata before rejecting rebinds
Security None None.

How this fits together

The updater coordinates package installation, Node selection, Doctor maintenance, and the operating system's Gateway service. It must preserve service ownership and operator state while activating or recovering an installation.

flowchart TD
  A[Update request and installed packages] --> B[Inspect Node and Gateway ownership]
  B --> C{Service can be rebound}
  C -->|Yes| D[Prepare invoking installation]
  C -->|No| E[Update existing service installation]
  D --> F[Activate under live ownership]
  E --> F
  F --> G{Gateway healthy}
  G -->|Yes| H[Complete update]
  G -->|No| I[Restore verified original service]
Loading

Decision needed

Question Recommendation
After the Linux metadata defect is repaired, must the current candidate complete published-driver qualification before landing, or may this land as a bounded component improvement? Complete upgrade qualification: Require a current published-driver compatibility result before accepting the broader upgrade claim.

Why: Root policy requires published-driver upgrade evidence, while the body explicitly defers that qualification; the prior review requested a landing disposition that remains unresolved.

Before merge

  • Recognize known-empty systemd metadata before rejecting rebinds (P1) - For an ordinary canonical Linux user unit with no drop-ins, readSystemdServiceExecStart returns managedDefinition and managedOverrides: {}. Both are truthy, so these checks always disable the intended A-to-B rebind and update A instead, leaving the CLI/Gateway prefix mismatch. The Linux planner test omits these real reader fields. Interpret the canonical override contract consistently here and in the matching observation/restoration guards; preserve genuinely overridden definitions. This was missed in the previous review: the implicated code is unchanged since af393400847ade886087c4dde230ee53e5dd556c.
  • Resolve merge risk (P1) - The complete published-driver-to-current-candidate upgrade remains unqualified: older drivers choose their target before candidate code runs, and prior evidence includes both successful service-root updating and pre-activation refusal.
  • Resolve merge risk (P1) - The bounded native recovery evidence does not establish broader platform or schema-changing upgrade recovery; installations whose retained runtime cannot read migrated state may still require operator recovery.
  • Complete next step (P2) - Correct known-empty systemd metadata handling across planning and recovery, then record the maintainer's disposition of the published-driver qualification limits.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.

Findings

  • [P1] Recognize known-empty systemd metadata before rejecting rebinds — src/cli/update-cli/update-command-service-plan.ts:605-610
Agent review details

Security

None.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

Metric Value Why it matters
Production versus test growth Runtime and installer +3,110/-845; tests and support +8,251/-1,349 Dual-installation ownership and restoration justify added production responsibilities, but their platform contracts must be exercised through realistic service metadata.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/cli/update-cli/update-command-verification.ts, migration/backfill/repair: src/daemon/service-start-repair.ts, migration/backfill/repair: src/daemon/service.ts, unknown-data-model-change: src/daemon/service-start-repair.ts, unknown-truncated-pull-files. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #107930
Summary: This PR is an implementation candidate for the Node-upgrade continuity request; another open implementation overlaps service reconciliation without establishing supersession.

Members:

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

Merge-risk options

Maintainer options:

  1. Qualify the corrected upgrade path (recommended)
    Repair canonical systemd metadata handling and establish published-driver compatibility without weakening ownership, override, or state-readability checks.
  2. Accept limited landing coverage
    After the correctness repair, explicitly accept the component-only qualification and retain the documented broader upgrade obligations.

Technical review

Best possible solution:

Use canonical override semantics throughout planning and restoration, preserve authored service settings, and establish or explicitly accept the published-driver upgrade boundary before landing.

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

Yes, from source: an ordinary Linux user service with known-empty override metadata deterministically takes the service-root fallback in the new planner. No target code was executed during this read-only review.

Is this the best way to solve the issue?

Not yet: extending the existing updater is appropriate, but metadata presence is not equivalent to an operator override, and the same mistaken assumption appears in planning and recovery.

Full review comments:

  • [P1] Recognize known-empty systemd metadata before rejecting rebinds — src/cli/update-cli/update-command-service-plan.ts:605-610
    For an ordinary canonical Linux user unit with no drop-ins, readSystemdServiceExecStart returns managedDefinition and managedOverrides: {}. Both are truthy, so these checks always disable the intended A-to-B rebind and update A instead, leaving the CLI/Gateway prefix mismatch. The Linux planner test omits these real reader fields. Interpret the canonical override contract consistently here and in the matching observation/restoration guards; preserve genuinely overridden definitions. This was missed in the previous review: the implicated code is unchanged since af393400847ade886087c4dde230ee53e5dd556c.
    Confidence: 0.99
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp. Replaced prior rating: 🐚 platinum hermit.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P1: This addresses an established upgrade workflow, and the current Linux planner still misses the intended service reconciliation.
  • merge-risk: 🚨 compatibility: Changing service installation and runtime bindings requires an explicit disposition of older-driver and migrated-state compatibility limits.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp. Replaced prior rating: 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The recorded native component run exercises retained-service restoration and final-effect rejection after lease revocation, executor replacement, and service reassignment; the inspected authority/restoration modules remain unchanged. That proof stands, but does not cover the newly identified Linux planning defect or establish complete published-driver qualification.
  • proof: sufficient: Contributor real behavior proof is sufficient. The recorded native component run exercises retained-service restoration and final-effect rejection after lease revocation, executor replacement, and service reassignment; the inspected authority/restoration modules remain unchanged. That proof stands, but does not cover the newly identified Linux planning defect or establish complete published-driver qualification.

Evidence

What I checked:

  • Introduced Linux planning defect: The new canRebind condition rejects the presence of managedOverrides or managedDefinition. Ordinary canonical systemd units carry both fields, including managedOverrides: {}, so eligible split-prefix updates select the old service root instead of rebinding. (src/cli/update-cli/update-command-service-plan.ts:605, 47aa7daa495e)
  • Canonical systemd metadata contract: The systemd reader includes the managed definition and override metadata for canonical user units; its drop-in reader deliberately returns an empty object when no overrides exist. Existing override helpers distinguish this from an operator override. (src/daemon/systemd-service-files.ts:233, 47aa7daa495e)
  • Same assumption in retained recovery: Original-service observation rejects either metadata field at lines 263–270, and original-definition restoration repeats that rejection at line 58. Repairing only planning would therefore expose a later refusal; the owning paths need one consistent interpretation. (src/cli/update-cli/update-command-original-service.ts:263, 47aa7daa495e)
  • Upstream contract provenance: GitHub commit metadata and its patch confirm the intentional change from undefined to known-empty override metadata. This establishes the consumed contract, not responsibility for this PR's incompatible presence checks. (src/daemon/systemd-service-files.ts:369, 26c662436e68)
  • Re-review continuity: Comparison with the previous reviewed head changes only transcript fixture readiness waits and session-cleanup test teardown. The planning, observation, restoration, and systemd-reader files implicated by the finding are unchanged; this is a late discovery. (47aa7daa495e)
  • Current main still lacks the central reconciliation: The fetched main planner still redirects a different invoking installation to the managed service package root; it does not contain this branch's target-aware provisioning and retained-root rebind flow. (src/cli/update-cli/update-command-service-plan.ts:546, ff38246e6710)

Likely related people:

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

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Repair metadata interpretation across planning, observation, and restoration, with coverage using the canonical Linux reader's known-empty override shape.
  • Record an explicit landing disposition for the published-driver qualification limits.

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 (39 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-19T17:46:56.109Z sha 8b306d9 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-19T18:25:38.792Z sha 50f72c6 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-19T19:03:52.899Z sha 9cde992 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-19T19:41:28.005Z sha 59a14b2 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-19T20:10:37.296Z sha 6205f6b :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-19T20:42:31.847Z sha 3e0ab86 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-19T21:07:32.670Z sha ddcd547 :: blocked before merge. :: none
  • reviewed 2026-09-19T22:02:58.058Z sha af39340 :: blocked before merge. :: none

@fuller-stack-dev
fuller-stack-dev marked this pull request as ready for review September 11, 2026 22:25
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Sep 11, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 11, 2026
Reconcile the validated Node-continuity component with current main.
The source tree is identical to the tested a99b5b87 integration; rebase preserves the existing PR and avoids publishing unsigned local merge commits.
@fuller-stack-dev
fuller-stack-dev force-pushed the fix/107930-node-upgrade-continuity-land branch from 7cd723e to 8bdb422 Compare September 12, 2026 01:05
@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 12, 2026
@openclaw-barnacle openclaw-barnacle Bot added the app: web-ui App: web-ui label Sep 12, 2026
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 12, 2026
steipete added a commit that referenced this pull request Sep 20, 2026
Standalone finalizers park and restore their owned service even when the
updater restart is disabled. Use matching isolated package metadata and
assert one maintenance stop/restore while forbidding updater restart and
failure triage.

Pre-execution failures now report through UpdateCommandFailure. Preserve
the original error identity in its cause chain and assert the finished
failed run, published run ID, and report path. Unknown-owner refusals reach
the operator as bounded diagnostics before exit 1; retain the refusal and
package-manager recovery advice checks and the no-mutation assertions.

Readiness now invokes the UTF-8 child runner. Mock that transport with the
captured Doctor report and physical exit facts, preserving the chmod-000
warning, guidance, and byte-for-byte configuration assertions.

Reuse the three native Doctor fixture corrections from #145335
(97c7b35, Jason / @fuller-stack-dev), with shared payload assertions in
the existing support file. Pin native support so built checkout artifacts
cannot redirect Doctor past the fixture's intended transport.

Keep relative-selector triage checks on both contracts: update publishes
structured failure facts before exit 1, while standalone repair preserves
the original exception. Both retain absolute target selectors and restore
the caller environment.

Validation: changed checks and P1 review passed; Doctor permission cases
and both selector cases passed. The one-worker full-file attempt also hit
an existing 120-second test limit on the contended host. Per maintainer
ruling, hosted CI is the full-run judge; no timeouts were changed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL 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.

[Feature]: Improve OpenClaw upgrade experience when Node.js version requirement changes

2 participants