Skip to content

fix(update): reconcile orphaned update runs automatically - #143774

Merged
steipete merged 5 commits into
mainfrom
steipete/upd-orphan-run-reconcile
Sep 10, 2026
Merged

steipete merged 5 commits into
mainfrom
steipete/upd-orphan-run-reconcile

Conversation

@steipete

@steipete steipete commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #139714
Refs #143136
Refs #143859

Additional instructions

This branch is in the upstream repository and is editable by maintainers.

What Problem This Solves

Fixes an issue where users with an untouched, identityless 2026.9.2-era update admission would keep seeing an update in progress and lose Control UI configuration-write access indefinitely, even after the updater was gone. The affected user need not start another update to recover.

Why This Change Was Made

Peter's 2026-09-10 contract is: “update should always work, best effort, never worse than before.” The approved bounded expiry applies only to a running/requested identityless admission older than 24 hours, with creation equal to last update, no finish timestamp, and only its original in-progress step. The ledger records failed/legacy-driver-expired with an abandonment step and retry advisory. Startup and status reads use the same owner; retained recovery, live/inconclusive drivers, and younger or progressed identityless records keep their protections. Existing #143136 dead-driver rules and the 30-minute inactivity window remain unchanged.

A new explicit update is a different scenario: existing admission logic may first terminalize the old row as failed/superseded. That is preserved and is not mislabeled as expiry. Either terminal state releases the Control UI write interlock. The browser refreshes authoritative status before refusing a suspended mutation and rechecks the connection before dispatch.

Best-effort reconciliation checks eligibility read-only before requesting write access. Gateway cold snapshots remain asynchronous, and write refusal is reported separately while retaining readable history. No configuration option, dependency, SQLite schema, protocol bump, or retention deletion is added.

User Impact

Operators regain settings writes automatically through startup/status reconciliation, with this advisory when the bounded expiry applies: “A 2026.9.2-era update never progressed past admission; treated as abandoned after 24 h; run openclaw update to retry.” Starting a new update also leaves the old admission terminal, using its existing supersession semantics.

Release-note context: expire untouched legacy update admissions after 24 hours, preserve explicit-update supersession, and release stale Control UI configuration-write suspension.

Evidence

Live retained-state proof

All cells ran in isolated Linux arm64 containers with Node 24.19.0, published baselines, real Gateway processes, authenticated browser/RPC flows, and a synthetic model endpoint. Each seeded the same identityless requested/running shape, 25 hours old and unmodified since creation.

Scenario Recorded outcome UI save, health, RPC, mock chat Observed health outage
A: candidate status against retained 2026.9.3 state, no new update failed/legacy-driver-expired; advisory in both status commands; admission IDs unchanged Passed 0 s
B: 2026.9.3 → candidate Unattended success; old row failed/superseded; no active run and no false expiry advisory Passed 31.100 s (30.100–32.099 s bounds)
B sibling: 2026.9.2 → candidate Unattended success; old row failed/legacy-driver-expired; advisory and no active run Passed 56.242 s (55.240–57.254 s bounds)

Phase A first proved the shipped defect: status retained the running row, the editor and Save were disabled, and no config.set was submitted. It then invoked candidate update status and status against that state while the published Gateway continued serving. The same settings save succeeded and persisted. Fixture history was initialized before seeding; no update was invoked after the aged row was seeded. Phase B exercised the actual update and retained-state checks. The sibling ran once. Cleanup shutdown is excluded from the one-second health samples. The updaters' own recorded downtimes were 38.643 s and 64.847 s respectively.

Live artifacts were built from 15c523bd0877bb49b63884aee2629780bc7d3229. Normal candidate SHA-256: 9591bd253b8b35bbfa7f75a9eda75dfef5bdd5d0573e57f73f8021b2a0ac2cf6. The 9.3 cell used the maintained first-hop version fixture (7213e1b612d12a8b4619ddb5c3f113d7bdc0cd50d9f0a878577d28acc9fae51b); its audited changes are only package.json and dist/build-info.json. Runtime/UI bytes are unchanged. Phase A and the 9.2 sibling used the normal candidate.

bash .local/l31/harness/launch.sh 2026.9.3 2026.9.2 phase-a-9.3-final 24 openclaw-phases.tgz 18831 A
bash .local/l31/harness/launch.sh 2026.9.3 2026.9.2 phase-b-9.3-final 24 openclaw-phases-first-hop.tgz 18831 B
bash .local/l31/harness/launch.sh 2026.9.2 2026.9.2 phase-b-9.2 24 openclaw-phases.tgz 18832 B
# Run alongside each cell, using its corresponding evidence directory:
node --import ./scripts/tsx.mjs .local/l31/harness/ui-proof.mjs .local/l31/<cell> both
Inspected synthetic browser evidence

Running orphan on shipped 9.3:

Running legacy admission

Disabled write controls:

Disabled Save

Persisted settings after a successful candidate config.set:

Accepted settings write

Tests and final rebase

The four implementation commits initially rebased patch-identically from reviewed head 332c38995cb; the added commit is test-only. It verifies reconciliation-first versus admission-first precedence, preserves terminal reasons, and exercises the real overlay/interlock for both terminal outcomes and protected running rows. The focused suites passed 96 tests, the test-file changed gate passed, and the full build/package checks passed.

Main moved during live proof. The final rebase onto cbc245824eb821a4f7ad1bc68cad5d143674f84c required one import-only resolution in update-run-report.ts, preserving both the legacy advisory imports and main's warning helpers from #143767. No further feature behavior changed. The live cells were not rerun after that final rebase; their artifact SHA remains explicit above. Report and precedence suites passed 116 tests after the rebase. The changed-file gate for the resolved report and three test files, plus git diff --check, passed:

node scripts/run-vitest.mjs src/infra/update-run-report.test.ts src/infra/update-run-abandonment.test.ts ui/src/app/update-config-interlock.test.ts ui/src/lib/config/config-write-coordinator.test.ts

Earlier regression proof on 46cbea5a demonstrated four protected-row write-admission failures, three CLI history-loss failures, two Gateway ownership exceptions, and two cold-snapshot responsiveness failures. Those regressions passed after the owner repair. The final precedence tests document the already-correct supersession behavior rather than changing it.

Final head: 8f7c4ad874c1c5a4833c0896759507eafc77ef01. Exact-head CI run 34464230234 completed successfully. node scripts/watch-pr-ci.mjs 143774 8f7c4ad874c1c5a4833c0896759507eafc77ef01 finished GREEN with zero pending checks and 12 superseded checks; GitHub's raw rollup still reported FAILURE. The PR remains unmerged; the lead owns landing.

@clawsweeper

clawsweeper Bot commented Sep 10, 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 app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes commands Command implementations size: L maintainer Maintainer-authored PR labels Sep 10, 2026
@steipete
steipete marked this pull request as ready for review September 10, 2026 06:29
@clawsweeper clawsweeper Bot added P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. 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 10, 2026
@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 10, 2026, 6:30 AM ET / 10:30 UTC (Revision 9).

ClawSweeper review

What this changes

Automatically retire untouched legacy update records after 24 hours, retain recovery guidance, and refresh Gateway status before refusing suspended Control UI configuration writes.

Merge readiness

✅ Ready for maintainer review

This PR remains necessary: current main and v2026.9.3 do not automatically expire the reported identityless orphan. The previous history-read findings are resolved, retained-state proof supports the fix, and no blocking patch defect remains.

Priority: P0
Reviewed head: 8f7c4ad874c1c5a4833c0896759507eafc77ef01

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with strong retained-state proof, meaningful regression coverage, and no remaining blocking finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Recorded real Gateway/browser runs show the ledger repair releasing a blocked settings save and persisting it, plus successful retained-state upgrades from both published baselines. Inspected screenshots corroborate the UI result; blob comparisons preserve applicability across the final rebase.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Recorded real Gateway/browser runs show the ledger repair releasing a blocked settings save and persisting it, plus successful retained-state upgrades from both published baselines. Inspected screenshots corroborate the UI result; blob comparisons preserve applicability across the final rebase.
Evidence reviewed 9 items Pinned introduction and clean checkout: Reviewed the merge-base-to-head delta using the supplied introduction identities. The verified test merge contains the pinned base and original head; unrelated base-only changes were excluded. The checkout remained clean and git diff --check passed.
Current main still needs this recovery: Current main's abandonment classifier requires explicit recovery for identityless records. The merged dead-driver repair at #143136 addresses a different condition and does not supply automatic legacy expiry.
Latest-release boundary: Read the v2026.9.3 classifier through GitHub's contents API. It also leaves identityless records running unless recovery is explicit; the supplied installed-baseline proof demonstrates the resulting UI suspension.
Findings None None.
Security None None.

How this fits together

The update ledger records installation progress in SQLite and feeds CLI status and the Control UI. Its recovery classification determines whether the UI continues suspending configuration writes.

flowchart TD
  A[Stored update history] --> B[Ledger recovery owner]
  C[Startup and status requests] --> B
  B --> D{Expired untouched orphan?}
  D -->|Yes| E[Retained abandoned outcome]
  D -->|No| F[Preserve live or protected history]
  E --> G[Status guidance and UI write refresh]
  F --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +263, Tests +469, Docs +24. Total +756 across 29 files.

View PR surface stats
Area Files Added Removed Net
Source 19 400 137 +263
Tests 8 525 56 +469
Docs 2 26 2 +24
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 29 951 195 +756

Review metrics

Metric Value Why it matters
Production versus regression coverage Production net +263 lines; tests net +469 lines Production growth centralizes reconciliation and preserves readable asynchronous status; regression coverage checks protected records and public entry points.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #139714
Summary: This PR is the candidate recovery fix for the linked orphan-admission issue; earlier merged update repairs address related but distinct conditions.

Members:

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

Technical review

Best possible solution:

Keep automatic recovery within the ledger owner so expired orphan history releases settings without weakening live-driver or retained-recovery protection.

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

Yes, from source: an untouched identityless running row remains active under main's automatic classifier and suspends UI writes. Supplied installed-baseline evidence demonstrates that failure; this read-only review did not execute it.

Is this the best way to solve the issue?

Yes. The accepted bounded expiry reuses the existing ledger transaction and UI write coordinator, preserves recovery exclusions, and has retained-state upgrade evidence.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P0: The reported orphan can indefinitely block Control UI settings and provider sign-in without an in-product recovery path.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Recorded real Gateway/browser runs show the ledger repair releasing a blocked settings save and persisting it, plus successful retained-state upgrades from both published baselines. Inspected screenshots corroborate the UI result; blob comparisons preserve applicability across the final rebase.
  • proof: sufficient: Contributor real behavior proof is sufficient. Recorded real Gateway/browser runs show the ledger repair releasing a blocked settings save and persisting it, plus successful retained-state upgrades from both published baselines. Inspected screenshots corroborate the UI result; blob comparisons preserve applicability across the final rebase.

Evidence

What I checked:

  • Pinned introduction and clean checkout: Reviewed the merge-base-to-head delta using the supplied introduction identities. The verified test merge contains the pinned base and original head; unrelated base-only changes were excluded. The checkout remained clean and git diff --check passed. (8f7c4ad874c1)
  • Current main still needs this recovery: Current main's abandonment classifier requires explicit recovery for identityless records. The merged dead-driver repair at fix(update): repair young runs after recorded drivers exit #143136 addresses a different condition and does not supply automatic legacy expiry. (src/infra/update-run-activity.ts:42, 3b615161878f)
  • Latest-release boundary: Read the v2026.9.3 classifier through GitHub's contents API. It also leaves identityless records running unless recovery is explicit; the supplied installed-baseline proof demonstrates the resulting UI suspension. (src/infra/update-run-activity.ts:41, 1391f7cd2d40)
  • Bounded policy and transactional protection: Expiry requires an untouched requested/running record older than 24 hours with no recorded drivers. Recovery descriptors exclude records, and the ledger rereads eligibility inside its existing write transaction before terminalization. The PR body records acceptance of this bounded recovery policy. (src/infra/update-run-ledger.ts:428, 8f7c4ad874c1)
  • Previous findings resolved: Gateway reconciliation prepares cold snapshots asynchronously. CLI and Gateway reads preserve available history when write admission fails. The expanded tests cover cold expired records, retained recovery, externally supervised write refusal, and expiry-versus-supersession precedence. (src/gateway/server-methods/update-status.ts:68, 8f7c4ad874c1)
  • Configuration dispatch safeguards: After refreshing update status, explicit writes still reject suspension, disposal, changed connection epochs, and insufficient current method permissions before dispatch. No credentials, dependency sources, workflows, or plugin APIs are changed. (ui/src/lib/config/config-write-coordinator.ts:362, 8f7c4ad874c1)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • fuller-stack-dev: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (8 earlier review cycles)
  • reviewed 2026-09-10T06:38:26.914Z sha 4a749c19150f83897cf673681b1092f9146befda :: blocked before merge. :: [P2] Preserve asynchronous preparation for cold history requests | [P2] Keep readable history available when reconciliation cannot write
  • reviewed 2026-09-10T06:54:22.357Z sha 4a749c19150f83897cf673681b1092f9146befda :: blocked before merge. :: [P2] Preserve asynchronous preparation for cold history requests | [P2] Keep readable history available when reconciliation cannot write
  • reviewed 2026-09-10T07:32:34.439Z sha 46cbea5adf89577fbccb7ae8f84d146ac371ab70 :: blocked before merge. :: [P2] Preserve readable history when reconciliation cannot write | [P2] Keep expired cold-history preparation asynchronous
  • reviewed 2026-09-10T07:46:48.415Z sha 46cbea5adf89577fbccb7ae8f84d146ac371ab70 :: blocked before merge. :: [P2] Preserve readable history when reconciliation cannot write | [P2] Keep expired cold-history preparation asynchronous
  • reviewed 2026-09-10T08:27:35.190Z sha 332c38995cbb67532b29b2e7241f9f19c6393594 :: blocked before merge. :: none
  • reviewed 2026-09-10T08:55:15.151Z sha 332c38995cbb67532b29b2e7241f9f19c6393594 :: blocked before merge. :: none
  • reviewed 2026-09-10T10:00:09.953Z sha 15c523bd0877bb49b63884aee2629780bc7d3229 :: blocked before merge. :: none
  • reviewed 2026-09-10T10:12:39.802Z sha 8f7c4ad :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 10, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 10, 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:

@steipete
steipete force-pushed the steipete/upd-orphan-run-reconcile branch from 332c389 to 15c523b Compare September 10, 2026 09:53
Expire untouched identityless requested admissions after 24 hours through the ledger owner, preserve recovery exclusions, and refresh Control UI write admission from authoritative update state. Retain the legacy expiry advisory in status and failure reports.

Fixes #139714
@steipete
steipete force-pushed the steipete/upd-orphan-run-reconcile branch from 15c523b to 8f7c4ad Compare September 10, 2026 10:05
@clawsweeper clawsweeper Bot removed the rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. label Sep 10, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Sep 10, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 10, 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:

@steipete
steipete merged commit ac266cd into main Sep 10, 2026
203 of 204 checks passed
@steipete
steipete deleted the steipete/upd-orphan-run-reconcile branch September 10, 2026 10:36
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

* fix(update): reconcile orphaned update runs automatically

Expire untouched identityless requested admissions after 24 hours through the ledger owner, preserve recovery exclusions, and refresh Control UI write admission from authoritative update state. Retain the legacy expiry advisory in status and failure reports.

Fixes openclaw#139714

* fix(status): omit empty update history metadata

* fix(update): preserve asynchronous history reads

* fix(update): preserve readable history during reconciliation

* test(update): preserve expiry and supersession precedence
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 commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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.

[Bug]: post-core update resume child admits an update_runs row it can never finalize — openclaw status reports "update in progress" forever

1 participant