Skip to content

feat(update): keep the Gateway running while package updates prepare - #203497

Merged
obviyus merged 27 commits into
mainfrom
update-release-packages-pr2
Nov 22, 2026
Merged

obviyus merged 27 commits into
mainfrom
update-release-packages-pr2

Conversation

@obviyus

@obviyus obviyus commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Global npm, pnpm, and Bun updates replace the package underneath the running Gateway. A broken candidate or a failed restart can leave it stopped, and the running updater must keep recovering code that has already been replaced.

User Impact

Owned global package installs now prepare the next release beside the serving one, as Git installs do since #203194. The resident launcher commits the trial when the new Gateway becomes ready, or starts the previous release again when the candidate cannot start.

--no-restart leaves the serving Gateway alone and activates the same rollback-protected trial at its next start. Plugin maintenance uses the new release's code; plugin problems are reported without failing the core update.

Why This Change Was Made

The CLI, Gateway update.run, and automatic updates share the release owner. Packages are packed and extracted outside node_modules, then production dependencies are installed there. Staged manifests omit development dependencies and checkout-only preparation hooks while retaining runtime dependencies, peer checks, and install hooks. Existing global entry points forward to the launcher; owned user-service definitions are staged through the existing definition-backup owner, without stopping the serving Gateway. System-owned definitions retain forwarding entries. Native restarts verify the listener's launchd job membership when the resident launcher, rather than its Gateway child, is the supervised PID.

Unowned installs and unfinished legacy recovery retain their existing admission owners. Explicit package artifacts, package-spec overrides, downgrade consent, campaign targets, local-only delegation, and timeout budgets are preserved.

Package dev-channel selections still use the existing Git conversion owner. Schema compatibility is checked against pinned Git/package metadata before staging, so an older release cannot strand the Gateway on newer state.

Accepted compatibility boundaries: update.run cannot yet carry package target specs, --accept-capabilities, or the invoking checkout identity. Explicit package specs stay local; the optional protocol fields and their caller migration follow separately. This PR does not change that protocol. Deletions follow in PR 3; the explicit local-override owner and shipped-updater bridge remain until their compatibility readers can be retired.

Accepted edge cases:

  • Targets lacking the release-update/check-readiness contract are refused without publication, forwarding, service changes or a trial; the error gives the exact manual install/build command. Shipped older versions also support older state schemas and were already refused by the existing updater's schema guard. The remaining affected same-schema targets are developer-pinned commits between the schema bump and the release-path introduction; supporting them automatically would require permanent compatibility readiness/finalization machinery. A briefly explored direct-switch route was removed after real qualification demonstrated a dead Gateway and false success.
  • Explicit --reapply-local-overrides is temporarily refused instead of silently losing edits or reintroducing another activation owner. Save edits, update without the flag, then reapply them manually. Staged replay restoration with real update/rollback proof is tracked in Restore trusted local dist override replay in prepared release updates #203498.
  • Through a running Gateway, update.run cannot yet carry --channel or --accept-capabilities. The CLI saves the channel first, but a Gateway with gateway.reload.mode=off (or inside the reload debounce) can prepare the previous channel, and plugin maintenance runs without the consent. Both arrive as optional update.run fields in fix(update): preserve plugin consent and target the invoking installation #203504; the same channel gap exists for Git installs since feat(update): Git installs update through prepared releases and a resident launcher #203194. Today --no-restart (in-process preparation) carries both.
  • When an update settles an interrupted earlier update before preparing its release, the settlement note ("kept, because its Gateway was verified on the version it installed…") is recorded on the interrupted run's history (openclaw update status), but the new run's CLI report does not repeat it, as the in-place executor's report did.
  • A CLI run from one installation while the managed Gateway serves another, with an explicit --tag, prepares the release in the invoking installation instead of the served one; the served Gateway restarts on its current version. Carrying the admitted service target is part of fix(update): preserve plugin consent and target the invoking installation #203504.
  • Local release preparation validates the target with the invoking runtime, not the service's pinned runtime; a target the service runtime cannot run fails its launcher trial and rolls back. Tracked in update: release preparation validates the invoking runtime, not the service's #203628.
  • --full-integrity-check is not yet carried to the release path's verification. Tracked in update: --full-integrity-check is silently ignored on the release update path #203629.

The shipped updater requires more than a schema-only finalizer: executor delegation, retained-owner binding, and Gateway restart completion remain necessary. The bridge and its dependency closure are retained unweakened; their deletion follows in PR 3, after the supported upgrade floor passes the release containing this change. No schema, protocol-version, or runtime dependency version/range changes.

Using the same production update-surface selection as #203194: 114,944 → 115,339 lines (+395); 107,033 → 107,418 code lines (+385). Outside that selection, the native launchd listener-ownership fix and launcher-child restart routing preserve native restarts. The complete diff removes 8,474 net test/support lines that asserted retired normal-entry swap, rehearsal, handoff, and lifecycle execution; standalone repair, shipped post-core continuation, and helper-owner contracts remain. Overall: 2,212 additions / 10,255 deletions (−8,043 lines) across 82 files.

Evidence

  • Real macOS npm first hop: shipped 2026.11.6 updater → final source e72deb6d3625b81e915bd8f4b87461d5eb75859f, terminal succeeded; 19,774 installed files, /readyz 200, and Gateway RPC verified after the recorded manual restart. Automatic first-hop restart is not claimed.
  • The same final artifact passed real package A→B with one restart and a committed trial (136.6 s total; sampled outage 5.0–7.0 s); a genuinely crashing candidate rolled back after two attempts (141.3 s total). --no-restart retained the serving PID with 102 ready samples until the next start committed C. Real plugin maintenance updated lossless-claw 1.1.1→1.2.0, and a refused downgrade wrote no update run.
  • Final source e72deb6d3625b81e915bd8f4b87461d5eb75859f passed physical-home macOS LaunchAgent conversion through managed update.run, two subsequent ordinary native restarts, and B→C --no-restart followed by a committing native restart. The frozen service definition and resident parent→Gateway relationship were preserved. An actual updater SIGKILL immediately after definition-backup creation also preserved the old serving Gateway; retry staged successfully and one restart committed the candidate.
  • Repair batch: changed-file formatting/Oxlint and pnpm -s tsgo:core passed. The touched/direct-and-support-importer set runs together in one ocx test call.
  • The e72 source above passed a full build (including declarations) and self-contained package integrity/import-graph checks on macOS arm64, Node 24.21.0. The frozen launcher and service conversion are unchanged since e72, so those receipts are reused. Package preparation changed after e72 (below), so the npm case was rerun on the final head c3d8f62d9b (Node 24.21.0): A→B through the release path, one succeeded run, the trial committed after one restart (123.0 s), B verified by RPC build id and /readyz 200, the staged manifest without development metadata and with all 76 runtime dependencies and postinstall kept.
  • Final head b40cfee13e (after the CI-round fixes to refusal order, launcher-marker cleanup and restart ownership), same method on macOS arm64, Node 24.21.0: A→B through the release path, CLI exit 0, one succeeded run, trial committed after one restart (update wall 111.8 s), B serving with /readyz 200 and RPC build id 2026.11.6-b40cfee13e04-…; all 76 runtime dependencies and postinstall kept.
  • Bun-run package installs: preflight checks Bun's own capability contract (Bun 1.4.4+ with WAL-reset-safe node:sqlite, through the existing isBunRuntime/resolveBunRuntimeInfo owner) instead of comparing Bun's version with engines.node; packing uses the existing resolveNpmCommand (npm bundled with Bun, so a Bun-only host needs no system npm or Node) with --quiet, taking the tarball from the pack destination instead of parsing the multi-megabyte --json listing; the staged install runs bun install --trust; the staged manifest also drops checkout-only workspaces. Node installs keep the sibling npm. Real proof on macOS arm64 with Bun 1.4.5 (c06f48cf9f): A→B through the release path, a --no-restart pending trial committed on the next start, ready/coreReady, a succeeded row, Bun as both launcher and Gateway runtime.
  • A large piped stdout from an exit-0 child arrived half-read under Bun in the shared command runner (1,376,256 of 2,854,736 bytes, no truncation flag); preparation no longer depends on that output. Filed separately as Bun 1.4.5: an exit-0 child loses the end of large piped stdout in runCommandWithTimeout #203519.
  • Downgrade and older-target qualification on a real macOS LaunchAgent profile: A→B committed with B serving over RPC; the shipped v2026.11.6 target refused before any change (state schema 41 > 36); a pre-release-path target refused before staging with the manual command; an ordinary native restart afterwards kept the launcher as parent; three requests left exactly three rows. The removed direct-switch route's dead-Gateway run and its manual recovery are kept in that report as the reason for the refusal.
  • Combined local changed-test/importer runs hit timeouts in unchanged Git→package wrapper rollback and retained legacy pin-migration compensation; the former also produced a subsequent late-output assertion. The same CLI file and the isolated pin case passed unchanged with one worker; the pin case also passed on the merged baseline. The repair batch's combined call also timed out in retained cancellation/repair cases and the existing Git beta→package switch. All new release-support cases passed. No timeout or assertion was relaxed; hosted CI is the gate for these retained suites.
  • The local check:changed SQLite-worker ratchet exhausted its fixed 4-GiB heap, as on feat(update): Git installs update through prepared releases and a resident launcher #203194; that ratchet is left to hosted CI.

Merge Danger

One-way install conversion: reverting source alone does not remove the release store, forwarding marker, or staged service definition. Previous releases and definition backups remain available. Writes during a failed trial can be lost; PostgreSQL migrations do not have data rollback. Blast radius: owned global package updates through the CLI, Gateway, and scheduler; shared read-only admission guards; and launchd restart ownership checks for resident-launcher Gateways.

- Route package CLI, Gateway and scheduled updates through release trials.
- Extract packages outside node_modules and retain forwarding rollback entries.
- Stage user service conversion through the existing definition backup owner.
- Preserve the shipped updater finalizer and compatibility dependency closure.
- Keep release-target overrides and downgrade consent before admission.
- Reuse the existing package no-op decision and normalize catch handling.
- Remove normal-entry swap, rehearsal, handoff and lifecycle assertions superseded by release trials.
- Preserve standalone repair, post-core bridge and helper-owner contracts.
- Keep Homebrew and unresolved legacy recovery refusals before release delegation.
- Prepare locally when an implicit local Gateway has no credentials.
- Reject unrecognized Gateway installations without recording an update.
- Remove remaining retired in-place test continuations and keep their current owner contracts.
- Keep the retained Linux preview contract without impossible Windows comparisons.
- Exclude root development dependencies before npm resolves the production graph.
- Exclude checkout-only lifecycle hooks while preserving install scripts and runtime dependency declarations.
- Cover the real-install npm peer-resolution failure without bypassing peer checks.
- Verify non-supervisor listeners through the existing native launchd membership owner before changing the service.
- Keep foreign and unreadable listeners fail-closed, with dual-stack and detached-child regression coverage.
- Keep dev conversion and explicit packaged override replay at their existing owners.
- Publish pre-release-path targets with the same launcher and a recorded no-rollback result.
@clawsweeper

clawsweeper Bot commented Nov 22, 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 gateway Gateway runtime cli CLI command changes size: XL labels Nov 22, 2026
- Reuse the existing database schema admission owner for pinned Git and package targets.
- Preserve one refused run with no staging, slot, service or forwarding changes.
@clawsweeper clawsweeper Bot added the clawsweeper:intake:feature Preliminary submission classification; full source review pending. label Nov 22, 2026
@clawsweeper

clawsweeper Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR prepares package updates beside the serving installation and uses the resident launcher to activate candidates and recover failed starts.

Example: Run openclaw update --no-restart on an owned global package installation.

  • Before: Package replacement can trigger the running Gateway to restart despite the flag.
  • After: The Gateway keeps serving while the next release is prepared for activation at its next start.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) Useful architecture with substantial real-install evidence, but incompatible older-target publication and lost managed-service context make the patch unsafe to merge.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied macOS receipts exercise real package activation, crashing-candidate rollback, deferred activation, LaunchAgent conversion, and the shipped 2026.11.6 upgrade through the CLI and Gateway at e72deb6; these support the central release-preparation behavior.
Patch quality 🧂 unranked krab (1/6) 4 actionable review findings remain.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Replacing packages underneath a serving Gateway can interrupt it and leave recovery dependent on code that was replaced.
Reason: Preparing releases separately provides clear availability and recovery value, and the maintainer-authored PR supplies direction for the cutover and its stated tradeoffs.

Merge readiness

⛔ Blocked before merge - 9 items remain

Keep open: this PR delivers useful package-update isolation, but introduces schema-admission, service-profile, and runtime-selection regressions, plus a concrete CI blocker.

Priority: P1
Reviewed head: c370902202b0d164c6a1f377c9a3a4820ae4c11a

Before merge

  • Preserve schema admission before publishing older targets (P1) - An explicit official 2026.11.6 tarball, such as --tag file:/tmp/openclaw-2026.11.6.tgz --yes, bypasses the same-version no-op. It has no release-update modules, so this branch skips check-release and later switches the link and records success without checking database compatibility. The reviewed build uses shared-state schema 41, while 2026.11.6 supports 36 and refuses newer schemas; the next Gateway start therefore fails without a readiness trial or automatic rollback. Fresh profiles also reach createUpdateRunAsync before target-owned initialization and can acquire schema 41 solely from this update. Reuse the existing target-schema admission and target-owned initialization contracts before publication.
  • Bind local package preparation to the managed service profile (P1) - The new package branch returns before resolveUpdateCommandAdmissionEnv and never carries the selected managed-service environment into runReleaseUpdateCli. For example, with shell state /home/alice/.openclaw and an owned service using OPENCLAW_STATE_DIR=/srv/openclaw, --no-restart prepares the release, trial, and history under the shell profile. stageReleaseService preserves the service's /srv/openclaw environment, so the next Gateway writes and settles against a different database; the launcher's rollback inventory is also rooted in the wrong state directory. Bind preparation, configuration, history, and service staging through the existing owned-service environment owner.
  • Validate the Node executable that will start the staged service (P1) - Local release preparation validates and runs the candidate with process.execPath, but this conversion preserves programArguments[0] and the old runtime pin. If the shell uses Node 26.1.0, the owned service uses Node 24.21.0, and an explicit candidate requires Node >=26.1.0, preparation passes while the next native service start still uses Node 24.21.0 and cannot run the candidate. The previous package path selected and checked the service runtime through its existing runtime owner. Carry that selection into preparation and retain its supported migration or refusal behavior before staging the service.
  • Make the new mock factories satisfy the existing export ratchet (P2) - The new closed mocks for service.js, runtime-pin-state.js, and service-reconciliation.js here, plus config/mutate.js and target.js in cli.test.ts, neither preserve real exports nor explain required isolation. scripts/check-test-mock-exports.mts rejects these factories, matching the current-head mock-exports failure in checks-fast-baseline-ratchets. Preserve real exports where safe or document genuine state isolation immediately above the relevant mock; do not expand the baseline.
  • Resolve merge risk - A maintainer must attribute the remaining model-selection and interrupted-monitor CI failures before merge; current annotations alone do not establish whether this PR causes them.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.
  • Explain or restore the original intent of Target-owned fresh initialization and schema compatibility - 212f041: fix(update): preserve compatible state when switching to npm stable #144155 initializes fresh state with the selected target before history and refuses existing schemas newer than the target.
  • Explain or restore the original intent of Managed-service profile binding - ff79e33: refactor(update): reuse selected admission environment #188189 carries the selected service environment consistently through admission, capture, and ledger publication.
  • Explain or restore the original intent of Service runtime prerequisite checks - 764761e: The prerequisite contract explicitly checks the Gateway service's Node and uses the existing runtime owner to move an eligible owned service to a compatible executable.

Findings

  • [P1] Preserve schema admission before publishing older targets — src/update/run.ts:292-294
  • [P1] Bind local package preparation to the managed service profile — src/cli/update-cli/update-command.ts:116-121
  • [P1] Validate the Node executable that will start the staged service — src/update/convert-service.ts:48-50

Provenance

  • Target-owned fresh initialization and schema compatibility changes intended behavior without addressing why it exists (212f041: fix(update): preserve compatible state when switching to npm stable #144155 initializes fresh state with the selected target before history and refuses existing schemas newer than the target.)
  • Managed-service profile binding changes intended behavior without addressing why it exists (ff79e33: refactor(update): reuse selected admission environment #188189 carries the selected service environment consistently through admission, capture, and ledger publication.)
  • Service runtime prerequisite checks changes intended behavior without addressing why it exists (764761e: The prerequisite contract explicitly checks the Gateway service's Node and uses the existing runtime owner to move an eligible owned service to a compatible executable.)
Agent review details

How this fits together

The CLI, Gateway update RPC, and automatic updater submit targets to the release owner, which prepares packages, stages service definitions, and publishes activation records consumed by the resident launcher.

flowchart TD
  A[Update CLI] --> D[Release update owner]
  B[Gateway update RPC] --> D
  C[Automatic updater] --> D
  D --> E[Prepared package release]
  D --> F[Service definition and trial]
  F --> G[Resident launcher]
  G --> H[Gateway candidate or previous release]
Loading

Technical review

Best possible solution:

Keep the shared release owner while reusing existing target-schema admission, target-owned fresh initialization, managed-service environment and runtime selection, and compliant test mocks.

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

Source inspection establishes the failing paths, including schema 41 versus released schema 36 and mismatched shell/service contexts; no reproduction was executed during this read-only review.

Is this the best way to solve the issue?

Extending the existing release owner is appropriate, but the smallest complete cutover must carry forward the existing compatibility and managed-service selection owners rather than bypass them.

Full review comments:

  • [P1] Preserve schema admission before publishing older targets — src/update/run.ts:292-294
    An explicit official 2026.11.6 tarball, such as --tag file:/tmp/openclaw-2026.11.6.tgz --yes, bypasses the same-version no-op. It has no release-update modules, so this branch skips check-release and later switches the link and records success without checking database compatibility. The reviewed build uses shared-state schema 41, while 2026.11.6 supports 36 and refuses newer schemas; the next Gateway start therefore fails without a readiness trial or automatic rollback. Fresh profiles also reach createUpdateRunAsync before target-owned initialization and can acquire schema 41 solely from this update. Reuse the existing target-schema admission and target-owned initialization contracts before publication.
    Confidence: 0.99
  • [P1] Bind local package preparation to the managed service profile — src/cli/update-cli/update-command.ts:116-121
    The new package branch returns before resolveUpdateCommandAdmissionEnv and never carries the selected managed-service environment into runReleaseUpdateCli. For example, with shell state /home/alice/.openclaw and an owned service using OPENCLAW_STATE_DIR=/srv/openclaw, --no-restart prepares the release, trial, and history under the shell profile. stageReleaseService preserves the service's /srv/openclaw environment, so the next Gateway writes and settles against a different database; the launcher's rollback inventory is also rooted in the wrong state directory. Bind preparation, configuration, history, and service staging through the existing owned-service environment owner.
    Confidence: 0.99
  • [P1] Validate the Node executable that will start the staged service — src/update/convert-service.ts:48-50
    Local release preparation validates and runs the candidate with process.execPath, but this conversion preserves programArguments[0] and the old runtime pin. If the shell uses Node 26.1.0, the owned service uses Node 24.21.0, and an explicit candidate requires Node >=26.1.0, preparation passes while the next native service start still uses Node 24.21.0 and cannot run the candidate. The previous package path selected and checked the service runtime through its existing runtime owner. Carry that selection into preparation and retain its supported migration or refusal behavior before staging the service.
    Confidence: 0.98
  • [P2] Make the new mock factories satisfy the existing export ratchet — src/update/convert-service.test.ts:12-17
    The new closed mocks for service.js, runtime-pin-state.js, and service-reconciliation.js here, plus config/mutate.js and target.js in cli.test.ts, neither preserve real exports nor explain required isolation. scripts/check-test-mock-exports.mts rejects these factories, matching the current-head mock-exports failure in checks-fast-baseline-ratchets. Preserve real exports where safe or document genuine state isolation immediately above the relevant mock; do not expand the baseline.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

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

Merge-risk options

Maintainer options:

  1. Attribute the remaining failing test jobs (recommended)
    A maintainer should compare the model-selection and interrupted-monitor failures with the base, then require repair only for failures caused by this PR.

Provenance checked

  • Shared release preparation and resident launcher keeps the original intent (be5f7fa: feat(update): Git installs update through prepared releases and a resident launcher #203194 introduced separate Git releases so recovery would no longer depend on replacing the running installation.)
  • Legacy updater bridge keeps the original intent (unknown: The PR retains the existing bridge and dependency closure for shipped updater delegation, retained-owner binding, and restart completion; scoped history shows multiple owners rather than one verified introduction.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/update/cli.test.ts src/update/prepare.test.ts src/update/convert-service.test.ts src/cli/update-cli.node-runtime.test.ts src/cli/update-cli.target-schema.test.ts --maxWorkers=1
  • pnpm check:test-mock-exports --base be5f7fa
  • pnpm tsgo:core
  • git diff --check

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit be5f7fa adds src/update/run.ts:47 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: be5f7fad9dfe; files: src/update/run.ts)
  • Vincent Koc: Raw commit ff79e33 adds src/cli/update-cli/update-command.ts:147 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ff79e3374f2e; files: src/cli/update-cli/update-command.ts)
  • Peter Steinberger: Raw commit 6209f31 adds src/daemon/service-process-membership.ts:48 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 6209f31ce9bb; files: src/daemon/service-process-membership.ts)

PR surface

Source +404, Tests -8499, Docs +8. Total -8087 across 79 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 14 646 242 +404
Tests 63 1388 9887 -8499
Docs 2 83 75 +8
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 79 2117 10204 -8087

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P1: Package updates can select an older release that cannot open the existing state, without automatic rollback.
  • add merge-risk: 🚨 compatibility: The package cutover bypasses target-schema and actual service-runtime checks that existing installations depend on.
  • add merge-risk: 🚨 session-state: Local preparation can place history, trial records, and rollback selection under the shell profile instead of the managed Gateway profile.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🐚 platinum hermit and patch quality is 🧂 unranked krab.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P1: Package updates can select an older release that cannot open the existing state, without automatic rollback.
  • merge-risk: 🚨 compatibility: The package cutover bypasses target-schema and actual service-runtime checks that existing installations depend on.
  • merge-risk: 🚨 session-state: Local preparation can place history, trial records, and rollback selection under the shell profile instead of the managed Gateway profile.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🐚 platinum hermit and patch quality is 🧂 unranked krab.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • 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.

Reviewed November 22, 2026, 8:41 AM ET / 13:41 UTC.

…release

- Remove direct no-trial publication and its premature success result.
- Keep launcher restart ownership independent of inherited native service markers.
- Preserve schema admission and actionable local-override recovery guidance.
- Repair mock export declarations and prune deleted test baselines.
@obviyus

obviyus commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator Author

Additional real-install qualification on source 28f6a9e, macOS arm64 / Node 24.21.0, through an isolated native LaunchAgent:

  • Real A→B update: one succeeded row, committed trial, B's RPC build identity verified, health/readiness 200, resident launcher verified as Gateway parent.
  • Real v2026.11.6 Git target: refused before preparation because state schema 41 exceeds target support 36. Exactly one failed row; serving B, slot, trial, marker, service definition and PIDs unchanged.
  • Genuine immediate-predecessor-of-PR1 target with compatible schema 41: refused before staging because it lacks release-update support. Exactly one failed row; B and all selection/service artifacts unchanged.
  • Ordinary native restart: successful readiness and RPC-served B identity, new launcher→Gateway ancestry, unchanged selection/service artifacts. Three update requests produced exactly three rows; the ordinary restart produced none.
  • All fixture processes, services, profiles and scratch were removed; existing launchd jobs were unchanged.

The earlier c370902 candidate's direct no-trial downgrade falsely reported success and left no listener after a native-handoff failure. That route was removed, not counted as a passing downgrade. The final source refuses unsupported targets safely. The qualification's quoted-tilde guidance defect is separately fixed in e6225d3 with a HOME-path regression; no additional runtime behavior changed.

- Admit Bun through the existing SQLite capability probe instead of Node engines.
- Install staged production dependencies with Bun and retain its runtime for release commands.
- Discover the single staged tarball rather than parsing npm pack output.
- Read local target identity from its manifest so truncated pack metadata cannot refuse an otherwise valid archive.
- The staged manifest already omits development dependencies.
- Preserve Bun lifecycle trust without its incompatible production flag.
- Reuse the existing bundled npm command owner for Bun tool checks and packing.
- Keep the Node sibling-npm invocation unchanged and carry installer commands as argv.
- Published releases do not contain every checkout workspace.
- Keep Bun production installs independent of those absent development directories.
- Bun imports pnpm-workspace.yaml even without a workspaces manifest field.
- Remove the staged checkout-only workspace file before installing runtime dependencies.
…es-pr2

# Conflicts:
#	src/update/prepare.test.ts
#	src/update/run.ts
@obviyus

obviyus commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator Author

Rejected review findings:

obviyus added a commit that referenced this pull request Nov 23, 2026
…arget (#203944)

## What Problem This Solves

`src/update/cli.test.ts` fails on `main` (3 cases: "preserves a one-off package tag" ×2, "restarts the local Gateway after preparing an explicit package tag"). Its fixture, added in #203497, pins the selected release at `2026.11.6`. Since `main` moved to `2026.11.7` (#203880, release close-out), those cases see a downgrade, wait for downgrade consent (unanswered in the test) and prepare nothing. It turns `checks-node-changed-1` red on PRs that touch the update CLI (seen on #203925).

## Change

The default selected release is the build's own `VERSION`, set before each test; the downgrade case uses `2000.1.1`, which stays older than any build. Explicit `--tag` inputs are unchanged.

## Evidence

- `ocx test src/update/cli.test.ts`: 17/17 (main at 2e8c1ad: 3 failed, 14 passed).

Co-authored-by: Ayaan Zaidi <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 24, 2026
…tate database (#203578)

* fix(update): refuse migrating updates while a node service keeps the state open

Refs #203457

* docs(update): explain the node-service migration refusal

Refs #203457

* fix(update): match the node service's own state directory by filesystem identity

A default node service omits the state selector and must not inherit the updater's; path aliases name one directory. Refs #203457

* fix(update): refuse every activation while a node service keeps the state open

Update Doctor takes native exclusion of openclaw.sqlite on every activation, including patch updates without a schema change (#203457 reported 2026.11.5 -> 2026.11.6, both schema 36). Refuse whenever a running, kind-marked node service resolves to the same state directory, not only for pending migrations. Refs #203457

Co-authored-by: Peter Steinberger <[email protected]>
(cherry picked from commit 19fcba1)

Release adaptation: retain stable captureUpdateActivationSchemas destructuring and check node ownership only before first mutation, so Git revalidation after mutation does not report a pre-mutation refusal. Keep stable preparatory staging and check before any Gateway stop or installed activation.

Release adaptation: keep only the node-service docs and regression in the conflict regions; the separate Gateway migration admission (#203170) is not a prerequisite and remains outside the lane.

Companion audit: no later PR or SHA mentions through 665c286. #203497 (future package preparation) is not needed; the existing stable package/Git activation hooks already share the pre-stop boundary. #203981 is selected elsewhere and already present at lane base (f6ad5b5). Later #204275, #204253, #204224, #204127, #204094, #204095, #204151, #204054, #203994, #203990, #203917, #203959, #203926, #203925, #203915, #203914, #202934 and #203735 are not applicable as companions: independent Git, rollback, Doctor/recovery, plugin, output, docs and host changes do not supply or consume node-service admission.

Validation: two same-state activation cases red on f6ad5b5 (wrongly reached mutation), three controls passed; all 73 tests in update-command-execution.test.ts passed with the fix.

Co-authored-by: RomneyDa <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 24, 2026
## What Problem This Solves

The update rewrite's receipts did not prove what they claimed (audit 2026-11-23): every acceptance Gateway carried `OPENCLAW_UPDATE_PACKAGE_SPEC`, so real channel selection never ran; `T+1` was a re-stamped `T`, so no migration or restore ran; openclaw#203497 merged with macOS-only package proof, and Linux container failures (openclaw#203735, openclaw#203769) surfaced after merge.

## Change

Adds "Proof for update changes" to the update implementation contract in `docs/install/updating.md` (the section repo `AGENTS.md` points to for update work): required platforms, what counts as a Gateway-route receipt, product-installed services with saved effective state, a real next build, freshness, `T → T+1 → T+2` for installed-side code, and replacement before retiring a fault lane. Each rule names the incident it comes from.

## Evidence

Docs only; `git diff --check` clean. Audit and spot check: maintainer handoff `update-rewrite/consult-2026-11-23/`.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 24, 2026
…arget (openclaw#203944)

## What Problem This Solves

`src/update/cli.test.ts` fails on `main` (3 cases: "preserves a one-off package tag" ×2, "restarts the local Gateway after preparing an explicit package tag"). Its fixture, added in openclaw#203497, pins the selected release at `2026.11.6`. Since `main` moved to `2026.11.7` (openclaw#203880, release close-out), those cases see a downgrade, wait for downgrade consent (unanswered in the test) and prepare nothing. It turns `checks-node-changed-1` red on PRs that touch the update CLI (seen on openclaw#203925).

## Change

The default selected release is the build's own `VERSION`, set before each test; the downgrade case uses `2000.1.1`, which stays older than any build. Explicit `--tag` inputs are unchanged.

## Evidence

- `ocx test src/update/cli.test.ts`: 17/17 (main at 165da77: 3 failed, 14 passed).

Co-authored-by: Ayaan Zaidi <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 24, 2026
…ate acts on it (#201668)

* fix(update): verify recorded data-at-risk marks before repair acts on them

* fix(update): verify any unverified data-at-risk mark and honor receipts in handoff recovery

* fix(update): recognize a Git release-mode service as its checkout's own

* fix(update): check a recorded data-at-risk mark before the next update, including already-current runs

* fix(update): lead data-at-risk refusals with triage and record them on the refused run

* fix(update): keep data-at-risk refusals within the recorded warning limit

* test(e2e): finish the seeded data-at-risk run with a terminal phase

* fix(update): name the agent route in killed-update recovery refusals

* fix(update): drop an unused import

* test(update): expect the agent route in killed-update refusals

* fix(update): verify the newest mark before restoration without comparing run ids

* fix(update): address review: keep the Gateway down on any inconsistent mark, resolve all marks, harden release ownership

* fix(update): break the admission-root import cycle and type the e2e schema read

* fix(update): address rating findings: agent rollback leftovers, helper restart, blocking findings first, shared Git metadata

* test(e2e): prove the next plain update resolves a mark with the Gateway running

* fix(update): address rating round 2: refuse marks before Doctor, registry-based rollback check, handoff fallback, async history read

* test(update): pick the repair run, not a settlement row, in the data-at-risk cell

* fix(update): resolve live-writer marks after Doctor holds the state

* fix(doctor): say a skipped stale-Gateway stop left the PID running

* fix(update): address rating round 3: leftovers before deferrals, retained rollback files, refusal after Doctor fails finalization

* docs(update): note retained rollback files and refusals after Doctor

* fix(doctor): say a stale Gateway stop could not be confirmed when nothing shows it running

* fix(update): address landing review: revert release-mode ownership, check leftovers first, handoff entry guard, durable rollback evidence

* test(update): follow main's Git release link layout in the launcher refusal test

* fix(update): treat uninspectable leftovers and unreadable databases as unchecked; true wording after Doctor

Release adaptation: Retain the stable installed-recovery harness. Do not add main's installed Docker service cell, later retired by #203808, or Git release-launcher wording/test because stable uses the in-place Git updater. Keep the state-verification, next-update, repair and interrupted-handoff paths and their compatible regressions.

Companion audit: #203486 is present-equivalent at 3081077 (preserved). #201978 is selected next in this lane. #203808 and #203966 involve the inapplicable installed service-cell layout; #203497 and #203194 change main's package/Git activation layout and are not applicable; #204017 depends on that release-install layout. #204077, #204043, #203555 and #203520 are independent authority, cleanup, helper-fixture and config-validation changes. #204151, #203917, #203849 and #203406 are separate guidance, cleanup or status changes, not required by the data-risk verifier. #203569 fixes a separate cron receipt fixture in the same Doctor suite; the touched stale-stop cases do not depend on it.

(cherry picked from commit a28f211)
Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit f8d4bc138ed2512c413cf96f66fe0eefb3b28d65)
tideclaw-bot pushed a commit that referenced this pull request Nov 24, 2026
…01978)

* fix(update): copy original state only at the first state change

* docs(update): say when the original-state capture is taken

* fix(update): copy before a Gateway handoff, legacy config repair, or a fresh post-core process

* test(update): expect the copy before a fresh post-core process

* test(update): prove real Git and release updates copy at their mutation hook

* fix(update): copy after the last pre-stop refusal and before writing a changed channel

* test(update): a refused update copies nothing; sort run ids with a comparator

* fix(update): copy before plugin records publish, outside the update deadline, and only once a handoff is certain

* fix(update): copy before the combined plugin index write, every channel write and a fresh post-core launch, outside every update clock

* fix(update): let the lazy capture follow this run's prepared package publication

* test(update): drive the Git no-op capture case through the release runner

* style(test): sort merged imports

Release adaptation: Keep stable’s in-place Git runner and its existing service and rollback paths. Route the Git no-op fixture through updateGitCheckout and retain the before-mutation capture assertions. Omit the prepared Git release branch and its release-link-only tests. Merge the Doctor and fresh-handoff timing checks alongside the stable-only handoff coverage. Stable arms the executor clock before already-current package maintenance; keep both its timer and its synchronous fence/SQLite deadline checks paused during separately bounded capture. Exercise a live fence assertion after the original activation deadline elapses inside excluded work.

Companion audit: #203578 is present-equivalent at e396e3f; its stable state-ownership guard is preserved. #203194, #203497 and #203926 apply to main’s newer release staging/activation flow and are not applicable here. #204127 changes when plugins are installed after activation, #203917 concerns retained-runtime cleanup, #202934 adds a separate macOS Git prereq, and #204151 is independent handoff repair guidance. None is required for lazy original-state capture.

(cherry picked from commit a577911)
Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 1a2e6a7bec75074a150a684848990710c3fddc48)
obviyus added a commit that referenced this pull request Nov 24, 2026
## Problem
The scheduled Install Smoke has been red since 2026-11-24 (run 45318966120, step "Verify candidate already-current no-op without a Gateway service"). The last green run was on 2026-11-23. #203497 moved package updates to the release path in `src/update/`. On that path, `prepareUpdate` treats an explicit artifact (`--tag <tgz>`) as already current only if it is a registry target (`isPackageTargetAlreadyCurrent`). An artifact with the same version and the same build identity as the installed package was staged, validated and started as a trial, and the update ended `running` (phase `activating`). The user asked for the build that is already installed, but got a new release and a trial.

## Fix
- `src/update/run.ts`: after preparation, an explicit package artifact is current when its version and its known `buildId` are the same as the running install's. The run records `skipped` / `already-current`. It publishes no release and starts no trial. A missing build identity does not count as a match, so a rebuilt artifact at the same version still updates (the #144894 contract).
- `scripts/docker/install-sh-smoke/run.sh`: the no-op validator now reads the release update record: `skipped`/`already-current`, artifact staged (`prepare:pack`), no `validating`/`activating`, installed `build-info.json` buildId unchanged. The legacy JSON branch stays for shipped updaters.

## Evidence
- `src/update/prepare.test.ts`: new cases `build: installed` (current, no release, no trial) and `build: rebuilt` (still pending). On base 689d524-descended main, `build: installed` fails (`expected { status: 'pending' } to match { status: 'current' }`). On head, 33/33 pass.
- Local Docker install smoke, update group (`OPENCLAW_INSTALL_SMOKE_GROUP=update`), from latest stable 2026.11.7 to this candidate: the update completes, and the already-current no-op prints `Verified already-current no-op: artifact staged, installed build unchanged, no activation`. The record is `phase: finished, status: skipped, reason: already-current`.
- `pnpm check:changed`: clean.

## Risk
This changes the update path only when an explicit artifact carries the installed build identity. Every other target goes through preparation and the trial as before.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 25, 2026
…w#204426)

## Problem
The scheduled Install Smoke has been red since 2026-11-24 (run 45318966120, step "Verify candidate already-current no-op without a Gateway service"). The last green run was on 2026-11-23. openclaw#203497 moved package updates to the release path in `src/update/`. On that path, `prepareUpdate` treats an explicit artifact (`--tag <tgz>`) as already current only if it is a registry target (`isPackageTargetAlreadyCurrent`). An artifact with the same version and the same build identity as the installed package was staged, validated and started as a trial, and the update ended `running` (phase `activating`). The user asked for the build that is already installed, but got a new release and a trial.

## Fix
- `src/update/run.ts`: after preparation, an explicit package artifact is current when its version and its known `buildId` are the same as the running install's. The run records `skipped` / `already-current`. It publishes no release and starts no trial. A missing build identity does not count as a match, so a rebuilt artifact at the same version still updates (the openclaw#144894 contract).
- `scripts/docker/install-sh-smoke/run.sh`: the no-op validator now reads the release update record: `skipped`/`already-current`, artifact staged (`prepare:pack`), no `validating`/`activating`, installed `build-info.json` buildId unchanged. The legacy JSON branch stays for shipped updaters.

## Evidence
- `src/update/prepare.test.ts`: new cases `build: installed` (current, no release, no trial) and `build: rebuilt` (still pending). On base 9d7a8f2-descended main, `build: installed` fails (`expected { status: 'pending' } to match { status: 'current' }`). On head, 33/33 pass.
- Local Docker install smoke, update group (`OPENCLAW_INSTALL_SMOKE_GROUP=update`), from latest stable 2026.11.7 to this candidate: the update completes, and the already-current no-op prints `Verified already-current no-op: artifact staged, installed build unchanged, no activation`. The record is `phase: finished, status: skipped, reason: already-current`.
- `pnpm check:changed`: clean.

## Risk
This changes the update path only when an explicit artifact carries the installed build identity. Every other target goes through preparation and the trial as before.

Co-authored-by: Ayaan Zaidi <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
…#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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:feature Preliminary submission classification; full source review pending. cli CLI command changes docs Improvements or additions to documentation gateway Gateway runtime size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant