Skip to content

fix(update): preserve automatic update policy and outcomes - #134566

Merged
steipete merged 4 commits into
mainfrom
codex/auto-update-lifecycle
Sep 1, 2026
Merged

steipete merged 4 commits into
mainfrom
codex/auto-update-lifecycle

Conversation

@steipete

@steipete steipete commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes cases where saved update policy was displaced by a one-off beta install, stopped discovery could revive an old campaign, and the Updates page lost the result or allowed conflicting changes during installation. Live testing also exposed a managed service restarting twice and an Updates page that could not recover when update checks were disabled.

Why This Change Was Made

The saved core channel now owns channel selection, cached availability belongs to its channel, and stopped schedulers cannot publish or apply late results. An applying campaign retains its exact target. Failed attempts are recorded before observers refresh, while rejected or retired requests leave the active owner's result intact.

Automatic installation uses the existing managed-service handoff. Foreground Gateways record a skipped attempt with stop → update → launch guidance; backend/CLI instructions preserve the active profile. Fresh Doctor processes and package verification share the existing update policy; the parent updater owns service refresh and activation, preventing the extra restart found in the live test.

The Control UI has one update lifecycle owner for busy state, status refresh, hold responses, and result reconciliation. A bounded Gateway/profile-scoped browser notice preserves reconciliation across reloads; it never replays an update. Historical attempt details show the recorded Before update and After attempt identities rather than inferring a target from a later available release. Recovery text wraps within its status row.

User Impact

Channel policy stays consistent across CLI, Gateway, and web updates, including after a one-off --tag beta. Controls lock during installation, recorded failures remain visible, and reloading during an update preserves pending reconciliation.

Settings → Updates → Check for updates now edits the existing update.checkOnStart preference through the normal save flow. Turning checks off disables the Automatic updates control while preserving its saved preference; turning checks on resumes discovery and any enabled automatic-update policy. Both the visible label and existing setting are searchable. No config key, default, SQLite schema, or feature-statistics preference is added or changed.

Foreground automatic installation intentionally becomes a recorded skip with explicit manual recovery guidance. Plugin compatibility channel selection remains unchanged. Old unscoped success toasts are discarded; the new notice is transient per-tab display state.

Evidence

  • 855 unique focused unit/integration tests pass across 24 files, including 225 Control UI tests, scheduler/RPC ownership, real-child Doctor policy, service integration, and CLI output routing.
  • All 23 updater browser scenarios pass: applying/read-only controls, disabled-check recovery through autosave, readable recovery guidance, light/dark lifecycle, reconnects, coalesced restarts, and results retained after reload.
  • The full changed-code gate passed; the final UI recovery delta also passed typecheck, lint, and localization checks. Independent review of the complete candidate and subsequent test-only alignment found no findings in the requested P0 scope.
Real Linux/npm scenario Observed result
Saved stable policy with a beta installed CLI status, dry-run, and authenticated Gateway status stay on stable; a one-off beta target does not rewrite the saved channel.
Foreground automatic attempt Real countdown ends in a recorded skip; the package and serving process remain unchanged and healthy. The displayed manual stop/update/launch recovery installs and starts the requested version.
Disable checks while old beta discovery is in flight The old scheduler stops; its late response cannot revive the campaign or mutate the package.
Managed update while the beta tag advances Installs the announced beta.2 after the tag moves to beta.3, with one helper, exactly one service activation, no Doctor-owned restart, a healthy runtime, and a terminal success record.

These four service cases passed on 48bfd0ba447d60097d5e88e02c664ed66bdd7c6f; subsequent changes affect UI, tests, docs, and the measured UI baseline. Core production source is unchanged. The original duplicate-activation failure was retained and rerun successfully after the Doctor ownership repair.

The isolated lane uses Linux/ARM64, Node 24.19.0, npm 11.17.0, and native systemd. Release metadata and tarballs use a fixture registry; the compiled CLI, countdown, npm install/swap, Doctor, managed helper, authenticated RPC, and HTTP health checks are real. Synthetic versions contain the same candidate code, so this establishes lifecycle/install behavior rather than historical-release compatibility. No operator Gateway was changed.

The canonical package embeds final commit c48b22a855d395f462d61ea5a0eb2863c788debf; its SHA-256 is 3c7a659eb7c9f0f710ab40bfbf3fe2e016224a777e1749aa65254e44859829b6. All 6,971 non-UI runtime JavaScript files are byte-identical to the package used for the four passing service scenarios. All 187 dependency inputs are unchanged. Build identity, final UI assets, and declaration member/chunk ordering account for the other artifact differences.

The final Gateway-connected browser run used this exact package with no RPC mocks: the browser enabled checks, persisted checkOnStart: true while preserving auto.enabled: true, observed the production countdown and recorded skipped outcome, then reloaded and recovered the same result. The package stayed unchanged and healthy, controls settled, no update request replayed, no page errors occurred, and HTTP-served JavaScript/CSS matched the installed archive. Final startup JavaScript measured 347,787 bytes, below the existing 348,368-byte limit.

Exact-head CI passed: 208 successful jobs, including Windows and the real-Gateway and native-browser lanes.

Before/after: controls during an automatic apply (controlled browser regression)

Before, policy controls remained usable during apply:

Before: automatic apply leaves policy controls enabled

After, both policy toggles and update actions are locked while applying:

After: automatic apply locks policy controls

Final real Gateway: disabled checks and recorded recovery

Final package: disabled checks preserve the automatic-update preference

Final package: recorded before/after identities and readable recovery

Uncut 70-second recording, started after authentication, showing the real settings recovery, countdown, terminal outcome and reload:

openclaw-auto-update-recovery-video.webm

Production delta: +386 lines; tests/test support: +1,312; docs: +26. Growth owns cancellation, durable outcomes, bounded browser continuity, and an operable existing-setting recovery path. The unsafe foreground subprocess and duplicated status/Doctor policy paths are removed. The measured startup baseline is 347,792 bytes with the existing 348,368-byte enforcement limit; the 358,400-byte hard cap and growth/variance allowances are unchanged.

CI exposed a missing export in a whole-module CLI fixture and two provider fixtures tied to the real UTC pricing cutoff. The unnecessary CLI stub is removed. The provider fixtures match the equivalent fixes already landed in #134564; production pricing is unchanged. Earlier browser CI stopped at the stale intermediate bundle baseline, which is now refreshed from the canonical production measurement. The final exact-head CI run passes. A prior native-browser tab-creation case also passes on the final head without browser-source changes.

The latest review's recovery finding is addressed by the explicit checks control, search, interaction coverage, and connected-browser proof. Foreground compatibility and production growth are documented above.

Remaining boundary: direct CLI invocation still uses the existing install-coordinator contract. This change does not claim cross-process serialization between every direct CLI update and managed helper. Lost RPC responses without a handoff ID retain the existing identity-based reconciliation limit.

Named UI follow-up: expose backend-owned, profile-aware terminal recovery commands in the browser; its current terminal fallback remains generic. The backend/CLI profile-preservation proof does not claim that browser behavior.

Build follow-up: identical source/dependencies can reorder declaration members and change generated chunk names; runtime JavaScript identity is unaffected.

Keep saved channels authoritative, retire stopped schedulers, and record
automatic failures before campaign completion. Use managed handoff for
automatic installation and preserve scoped web reconciliation across reloads.
@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: XL maintainer Maintainer-authored PR labels Sep 1, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 1, 2026
@clawsweeper

clawsweeper Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 9:42 PM ET / September 1, 2026, 01:42 UTC.

ClawSweeper review

What this changes

The PR preserves saved automatic-update policy and update outcomes across managed-service handoffs, restarts, and Control UI reloads, while exposing the existing update-check setting for recovery.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for normal maintainer validation: the prior recoverability finding is addressed and no introduced functional or security defect was found, but this compatibility-sensitive update lifecycle change still needs final real-environment evidence and completion of its exact-head checks.

Priority: P1
Reviewed head: c48b22a855d395f462d61ea5a0eb2863c788debf

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is coherent and well-covered by targeted source tests, with its remaining rank-up work being real deployment-path evidence.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: This maintainer-authored reliability repair has extensive source and mocked-browser coverage, but no completed real deployment artifact was supplied in the reviewed material.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored reliability repair has extensive source and mocked-browser coverage, but no completed real deployment artifact was supplied in the reviewed material.
Evidence reviewed 6 items Saved policy remains authoritative: The effective-channel resolver now returns an explicitly configured channel before considering an installed beta version, preserving the operator's saved stable/beta/dev policy.
Disabled checks are recoverable in the UI: The Updates page now renders a Check for updates toggle, retains the saved automatic preference, and disables the ineffective automatic control until checks are restored; the config page persists the existing key.
Current main lacks this recovery control: The fetched main version renders only the automatic-updates toggle in this policy area, confirming the recovery surface is introduced by this PR rather than base drift.
Findings None None.
Security None None.

How this fits together

The update subsystem turns saved Gateway policy into scheduled update campaigns and managed-service handoffs, then returns restart status to the Control UI. The UI reconciles that status after reconnecting so operators can see an outcome or actionable recovery path.

flowchart LR
  A[Saved update policy] --> B[Update scheduler]
  B --> C[Update campaign]
  C --> D[Managed service handoff]
  D --> E[Restart verification]
  E --> F[Gateway update status]
  F --> G[Control UI recovery notice]
Loading

Before merge

  • Resolve merge risk (P1) - Merging changes existing automatic-update and managed-service recovery behavior; final real managed-service and Gateway-connected UI evidence is not present in the reviewed material, while exact-head checks remain incomplete.
  • Complete next step (P2) - No repair job is warranted because no introduced defect was found; complete the deployment-path evidence and exact-head validation.
Agent review details

Security

None.

PR surface

Source +385, Tests +1313, Docs +26, Other -1. Total +1723 across 45 files.

View PR surface stats
Area Files Added Removed Net
Source 22 1111 726 +385
Tests 19 1530 217 +1313
Docs 2 32 6 +26
Config 0 0 0 0
Generated 0 0 0 0
Other 2 3 4 -1
Total 45 2676 953 +1723

Review metrics

Metric Value Why it matters
Production versus test delta production +396 net; tests/test-support +1,302 net; docs/config +25 net The production growth primarily establishes a dedicated UI lifecycle owner and restart reconciliation; the accompanying coverage is substantially larger.
Existing config exposure 1 existing control exposed; 0 config keys added The UI now exposes update.checkOnStart for recovery without expanding the persisted configuration contract.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/cli/update-cli/update-command-fresh-doctor.ts, migration/backfill/repair: src/cli/update-cli/update-command-package.ts, serialized state: ui/src/app/update-success-notice.ts, unknown-data-model-change: ui/src/app/update-success-notice.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Complete managed-update proof (recommended)
    Attach after-fix evidence from isolated managed-service and Gateway-connected UI runs showing the preserved policy and reported handoff outcome.
  2. Pause until operational validation
    Defer landing if the required deployment-path evidence cannot be produced for this lifecycle change.

Technical review

Best possible solution:

Keep saved policy and lifecycle ownership canonical, then attach after-fix managed-service and Gateway-connected UI evidence before landing.

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

Yes, from source: save a stable channel, install a one-off beta, and verify startup retains stable policy; the review could not execute that scenario because it is read-only.

Is this the best way to solve the issue?

Yes: the change preserves the configured policy at its owning resolver and makes disabled update checks recoverable through the existing settings surface rather than adding a workaround.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against bd2a91dac35a.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored reliability repair has extensive source and mocked-browser coverage, but no completed real deployment artifact was supplied in the reviewed material.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.
  • remove merge-risk: 🚨 other: Current PR review merge-risk labels are merge-risk: 🚨 compatibility.

Label justifications:

  • P1: Automatic Gateway updates are an existing operator workflow and a regression can affect deployed installations.
  • merge-risk: 🚨 compatibility: The PR changes saved-channel precedence and automatic managed-service update recovery for existing installations.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored reliability repair has extensive source and mocked-browser coverage, but no completed real deployment artifact was supplied in the reviewed material.

Evidence

What I checked:

  • Saved policy remains authoritative: The effective-channel resolver now returns an explicitly configured channel before considering an installed beta version, preserving the operator's saved stable/beta/dev policy. (src/infra/update-channels.ts:127, 6bebbd721c8e)
  • Disabled checks are recoverable in the UI: The Updates page now renders a Check for updates toggle, retains the saved automatic preference, and disables the ineffective automatic control until checks are restored; the config page persists the existing key. (ui/src/pages/config/updates.ts:394, 14dfa901cbbb)
  • Current main lacks this recovery control: The fetched main version renders only the automatic-updates toggle in this policy area, confirming the recovery surface is introduced by this PR rather than base drift. (ui/src/pages/config/updates.ts:394, bd2a91dac35a)
  • Campaign state is protected while applying: Startup clears disabled policy state but returns before replacing an applying campaign's target, preserving the admitted update owner's lifecycle state. (src/infra/update-startup.ts:785, 6bebbd721c8e)
  • Focused source coverage exists: The introduced tests cover update-policy recovery, campaign/restart fencing, RPC outcome ownership, and mocked browser continuity; the mocked browser lane is supplemental rather than real deployment proof. (ui/src/e2e/updates-settings.e2e.test.ts:1, c48b22a855d3)
  • Area history: Update lifecycle history shows Peter Steinberger as the sustained contributor across the scheduled-campaign feature and subsequent managed-handoff repairs. (src/infra/update-startup.ts:780, e3de98a451b4)

Likely related people:

  • steipete: 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.

  • Attach a redacted managed-service handoff result and a Gateway-connected Control UI reconciliation result.

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 (2 earlier review cycles)
  • reviewed 2026-09-01T00:30:21.321Z sha 6bebbd7 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-01T01:00:57.650Z sha 48bfd0b :: found issues before merge. :: [P2] Make disabled update checks recoverable from this page

Use the canonical Doctor policy for fresh finalization and package verification so only the updater activates the managed Gateway. Preserve named profiles and explicit stop/update/start guidance in recovery commands.

Move the web update lifecycle into its own owner and fence delayed hold responses from newer campaign or authority state. Cover the live-found activation defect and UI races with existing owner-boundary tests.
@openclaw-barnacle openclaw-barnacle Bot added the cli CLI command changes label Sep 1, 2026
@steipete

steipete commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The new head fixes the live-found duplicate service activation by keeping fresh Doctor passes under the updater's existing activation policy. It also extracts the web update lifecycle, fences delayed hold replies, and preserves profiles in manual recovery guidance. Focused tests, browser regression scenarios, independent review, and the full package build pass. Final real npm/service and Gateway-connected browser evidence is being completed and will be added before landing.

@clawsweeper

clawsweeper Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. 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. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 1, 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. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Sep 1, 2026
@steipete
steipete merged commit 12092aa into main Sep 1, 2026
279 checks passed
@steipete
steipete deleted the codex/auto-update-lifecycle branch September 1, 2026 01:52
@steipete

steipete commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 1, 2026
…134566)

* fix(update): preserve automatic update policy and outcomes

Keep saved channels authoritative, retire stopped schedulers, and record
automatic failures before campaign completion. Use managed handoff for
automatic installation and preserve scoped web reconciliation across reloads.

* fix(update): retain activation ownership through finalization

Use the canonical Doctor policy for fresh finalization and package verification so only the updater activates the managed Gateway. Preserve named profiles and explicit stop/update/start guidance in recovery commands.

Move the web update lifecycle into its own owner and fence delayed hold responses from newer campaign or authority state. Cover the live-found activation defect and UI races with existing owner-boundary tests.

* fix(update): make automatic update recovery actionable

* test(update): align pricing fixtures with main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui cli CLI command changes docs Improvements or additions to documentation extensions: amazon-bedrock-mantle extensions: anthropic 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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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.

1 participant