Skip to content

fix(update): finish Control UI updates after Gateway shutdown writes - #200569

Merged
roboclaw-bot merged 1 commit into
mainfrom
roboclaw/ur-stop-receipt
Nov 17, 2026
Merged

roboclaw-bot merged 1 commit into
mainfrom
roboclaw/ur-stop-receipt

Conversation

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Fixes #198072
Fixes #200022
Related: #200556 (its initiating diagnostic remains redacted).

What Problem This Solves

A Linux npm-global update started from Control UI can fail post-update Doctor when the old Gateway writes during shutdown. Its stop receipt rejects the changed database generation, so the update reports an error and skips Doctor even when the new version subsequently serves.

User Impact

Doctor continues after those shutdown writes with a clear warning. The original backup remains preserved, but automatic restoration from that stale snapshot stays disabled so a later failure cannot overwrite newer data. Changes after maintenance admission and actual transaction failures remain errors.

Why This Change Was Made

The stop-receipt owner now uses Doctor's existing staleness admission when it acquires exclusive maintenance custody. It reconciles the captured SQLite databases before the existing receipt transaction and generation checks run. This extends the initial-staleness policy through predecessor shutdown without changing schemas, the installed-updater protocol, or stop/backup ordering.

Accepted edge case: a foreign write during the pre-custody stop interval also continues forward with the warning and stale rollback disabled. Foreign changes after that admission still refuse receipt attribution or migration. No writer provenance is inferred from a service stop.

The predecessor tests now live in one focused suite; the superseded block and its unused capture-reuse helper parameter were removed. Net change: 13 production lines and 90 test lines. The growth covers real predecessor release, warning/rollback outcomes, and both sides of the custody boundary without adding another policy owner.

Follow-up: generated failure reports still redact unrecognized stop-receipt diagnostics. The closed diagnostic cause list is unchanged here. TLS-observation and skipped service-policy warnings are also outside this fix.

Evidence

  • The final regression file fails on base 5fb231527f4f14d83bc27067879370debe4d2b7a: 2 failed / 3 passed. The failures are real predecessor owner-lease release and a foreign write before custody. With the fix, 5/5 pass: unchanged state, predecessor release, pre-custody foreign drift, refusal under custody, and refusal after receipt publication. Assertions cover the real SQLite receipt writer, forward migration, one warning for accepted drift, and permanent rollback refusal.
  • Completed focused run: 18/18 passed across src/infra/update-predecessor-stop-receipt.test.ts and src/infra/update-doctor-result.test.ts. The new file's five test bodies take about 9 seconds; the cold selected run took 43.81 seconds including shared worker preparation. CI seconds are not yet available.
  • Before extracting the predecessor cases, all 49 owning-suite cases and 13 finalization cases emitted passes. That combined command hit its 180-second limit during the larger finalization suite; it is not a completed finalization-suite pass. The unchanged migration cases retain that observed proof.
  • Exact touched-file core-leaf type-aware oxlint (--type-check --threads=1 with config/tsconfig/oxlint.core.json), touched-file oxfmt --check, one-page MDX validation, and git diff --check passed.
  • pr-simplify completed. Shared local autoreview (Codex), covering the complete candidate against the pinned base through P0–P2, returned scoped-clean with no actionable findings (confidence 0.86). The reviewed snapshot became 4d813dd2a7e; the reviewer did not independently run tests. Local ClawSweeper was unavailable.

Proof limits: owning-boundary only. Tests use real SQLite and real Gateway lease release; the native service adapter is simulated. Full Control UI/systemd/model or live upgrade proof was not run. Crabbox unavailable: provider ascii-box requires ASCII_BOX_API_KEY. PR CI is the broad proof.

Reported by @zzs12345-web, @damzaru and @Lifaguang (with sanitized Doctor diagnostics)

Work sessions

Linked for team reference; these sessions aren’t public.

@clawsweeper

clawsweeper Bot commented Nov 17, 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 size: M labels Nov 17, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 17, 2026
@clawsweeper

clawsweeper Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR reconciles SQLite changes after predecessor Gateway shutdown so Doctor can continue while stale-backup restoration remains disabled.

Example: A Linux npm-global Control UI update encounters a database change when the predecessor Gateway releases its lease.

  • Before: Doctor rejects the stop receipt with “SQLite receipt source changed after update capture.”
  • After: Doctor warns and continues from current state, preserving the backup while refusing automatic restoration over newer data.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation is focused and has meaningful boundary regressions, but the required shipped-entry-point proof is absent.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A Control UI update reports failure because Doctor cannot record the stopped Gateway’s receipt after shutdown changes SQLite.
Reason: The source and supplied diagnostics support the scoped defect, and the maintainer-authored direction explicitly accepts pre-custody drift without restoring over newer data.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR addresses a stop-receipt failure still present on main; no definite introduced code defect was found.

Priority: P2
Reviewed head: 4d813dd2a7e57284064460a3be2a940a708c7173

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Supply redacted logs or a recording of an isolated Control UI/systemd upgrade from v2026.11.5 exercising shutdown writes, successful Doctor completion, preserved settings/data, and stale-rollback refusal.
Agent review details

How this fits together

The candidate updater stops the predecessor Gateway, records its recovery receipt, and passes database-write evidence to Doctor and the parent updater’s rollback owner.

flowchart TD
  A[Control UI update] --> B[Candidate updater]
  B --> C[Predecessor Gateway shutdown]
  C --> D[Maintenance custody and capture admission]
  D --> E[Stop receipt and Doctor migrations]
  E --> F[Parent rollback eligibility]
Loading

Technical review

Best possible solution:

Reconcile shutdown drift once under the existing maintenance owner while preserving sticky rollback refusal and subsequent generation checks.

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

Source confirms capture admission precedes predecessor shutdown and receipt attribution subsequently checks the stale generation; reporter diagnostics match that refusal, and the PR reports two focused regressions failing on base, but this review ran no target code.

Is this the best way to solve the issue?

The patch is a focused owner-level repair: it extends the existing admission policy, retains original recovery evidence, and replaces the superseded predecessor test block with distinct lifecycle cases.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Predecessor stop receipt admission changes intended behavior with a stated reason (f8d52ec: Preserve the original parent capture, attribute the mandatory recovery receipt, and reject unrelated changes around receipt publication.)
  • Initial stale-capture policy keeps the original intent (74020ea: Permit forward migration from current state while permanently refusing restoration of a stale snapshot.)
  • Database rollback evidence keeps the original intent (d780fdc: Restore verified database backups only when recorded generation evidence permits it, preserving changed or unverifiable state.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Pinned introduced change: The introduced patch adds predecessor-stop admission inside the existing maintenance owner and extends the existing capture policy without adding a second policy owner. (src/infra/update-candidate-predecessor-stop.ts:152, 4d813dd2a7e5)
  • Current-main gap: Fetched main still admits the capture before predecessor shutdown without reconciling it at receipt custody; its capture only accepts stale generations on first admission. (src/infra/update-doctor-result.ts:332, 6a9cffa96475)
  • Rollback invariant: Accepted drift permanently clears unchanged before advancing expected generations; the existing parent receipt consumer converts that result into a sticky restoration refusal. (src/infra/update-doctor-result.ts:339, 4d813dd2a7e5)
  • Meaningful boundary coverage: The focused suite exercises real SQLite, real predecessor lease release, receipt persistence, forward migration, and writes before custody, under custody, and after receipt publication; the native service adapter is mocked. (src/infra/update-predecessor-stop-receipt.test.ts:23, 4d813dd2a7e5)
  • Reporter diagnostics and distinct follow-up: The discussion at Update failure: package-backup-retention (2026.11.4) #200022 supplies the exact stop-receipt refusal; damzaru’s later update reports a separate older-verifier/schema failure and explicitly does not confirm recurrence of that exception.
  • Direction and disclosed qualification: The collaborator-authored PR explicitly accepts foreign writes before custody while disabling stale rollback, reports base-red/head-green regressions, and discloses that full Control UI/systemd and live upgrade proof was not run. (4d813dd2a7e5)

Likely related people:

  • Dallin Romney: Raw commit f8d52ec adds src/infra/update-candidate-predecessor-stop.ts:136 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f8d52ec2b92b; files: src/infra/update-candidate-predecessor-stop.ts)

PR surface

Source +13, Tests +90, Docs +4. Total +107 across 5 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 2 18 5 +13
Tests 2 189 99 +90
Docs 1 11 7 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 218 111 +107

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 P2: The scoped failure interrupts update finalization, while the original reports verified recovered service; the later offline activation failure is not established as this patch’s defect.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: The scoped failure interrupts update finalization, while the original reports verified recovered service; the later offline activation failure is not established as this patch’s defect.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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 17, 2026, 6:50 AM ET / 11:50 UTC.

@roboclaw-bot
roboclaw-bot merged commit 3447bee into main Nov 17, 2026
152 checks passed
@roboclaw-bot
roboclaw-bot deleted the roboclaw/ur-stop-receipt branch November 17, 2026 12:02
RomneyDa added a commit that referenced this pull request Nov 17, 2026
Backport-of: 3447bee

Reconcile pre-custody changes at the existing receipt owner without enabling
stale rollback. Preserve later-write rejection and original receipt identity.

Co-authored-by: steipete <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 18, 2026
…s stop (openclaw#200569)

During a Control UI update, the candidate Doctor admits its SQLite capture before stopping the supervised predecessor Gateway. The predecessor's graceful shutdown releases its gateway-owner lease in state/openclaw.sqlite, so the predecessor stop receipt then refused with "source changed after update capture". The whole update was reported as failed even though the new version served.

Writes made between capture admission and the receipt owner's exclusive maintenance custody now follow the existing initial-staleness policy: one warning, Doctor continues from current state, and automatic restoration of the stale backup stays permanently disabled. Changes made under custody or after the receipt are still refused.

Accepted edge case: a foreign write during the pre-custody stop interval also continues forward, with rollback disabled.

Fixes openclaw#198072
Fixes openclaw#200022
Reported-by: @zzs12345-web, @damzaru, @Lifaguang

Co-authored-by: steipete <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 19, 2026
* fix: continue updates when initial SQLite capture is stale

Keep stale capture detection as a permanent rollback refusal instead of blocking initial Doctor admission. Preserve post-admission checks and remove the WAL-only workaround.

Co-authored-by: RomneyDa <[email protected]>

* fix: continue updates when initial SQLite capture is stale

OpenClaw-Publication: a1906828-fd49-4cb8-a96d-00888ad71d06

* Publish openclaw/fresh-shrimp-2

OpenClaw-Publication: 0151e769-6f48-4ac9-a9dc-bd950a327d43

* Publish openclaw/fresh-shrimp-2

OpenClaw-Publication: 699b1a51-1724-47c1-9f4f-a9328ee3ea06

---------

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 74020ea)

Release adaptation: omit session identity allowlist bookkeeping, since that later ratchet file does not exist on the release baseline. Production and regression tests unchanged. Companion #200569 follows for predecessor-stop admission.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit b5c3ee23034ad6814af021acac13587af731708e)
RomneyDa added a commit that referenced this pull request Nov 19, 2026
…s stop (#200569)

During a Control UI update, the candidate Doctor admits its SQLite capture before stopping the supervised predecessor Gateway. The predecessor's graceful shutdown releases its gateway-owner lease in state/openclaw.sqlite, so the predecessor stop receipt then refused with "source changed after update capture". The whole update was reported as failed even though the new version served.

Writes made between capture admission and the receipt owner's exclusive maintenance custody now follow the existing initial-staleness policy: one warning, Doctor continues from current state, and automatic restoration of the stale backup stays permanently disabled. Changes made under custody or after the receipt are still refused.

Accepted edge case: a foreign write during the pre-custody stop interval also continues forward, with rollback disabled.

Fixes #198072
Fixes #200022
Reported-by: @zzs12345-web, @damzaru, @Lifaguang

Co-authored-by: steipete <[email protected]>
(cherry picked from commit 3447bee)

Release adaptation: none. Companion disposition: update publication, custody, Doctor and best-effort maintenance fixes are ported together in dependency order; #200331 supplies the owed-step owner required by #200507/#200579.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 79efce43c9d1b2e3e4ee0e0781d360238a89a293)
maplel pushed a commit to maplel/openclaw that referenced this pull request Nov 24, 2026
…aw#194058)

Failed-update triage now captures the operator's environment before managed candidate admission, so a coding agent installed only on the operator's PATH is still offered when the Gateway service's PATH differs. Restores the operator-environment contract from openclaw#134490 and keeps the launch confirmation from openclaw#143139.

Proof: shipped CLI on isolated Linux (Crabbox) with a running systemd Gateway: accept launches the operator-only agent, decline starts nothing, base 18bee8e reports no agent found; published 2026.11.1 upgrades to the fix with settings intact.

Co-authored-by: TorstenW <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: steipete <[email protected]>

(cherry picked from commit 7c702c3)

Release adaptation: Capture invoking operator env before candidate admission, forward to interactive triage only; preserve latest target selectors, confirmation and lease cleanup ordering. Exact three authorized production paths plus real lifecycle regression.

Follow-up dispositions: ad4863d fix: preserve the running installation when an agent updates its Gateway (openclaw#201570); dc73ec0 fix: let updates finish when another tool briefly reads OpenClaw's databases (openclaw#202541); d07b530 fix: clarify PostgreSQL schema upgrades for Git installs (openclaw#202098); e60ea9f test(update): add a Git release upgrade-survivor scenario (openclaw#201956); 2ef6f7b fix(update): build and serve Git releases outside node_modules (openclaw#201917); dbc1aa0 fix: keep the openclaw command and Gateway working after updating a pnpm install (openclaw#201735); f5e7641 fix: Git checkout updates across a schema change no longer end as post-update-failed after the new release starts (openclaw#201600); 2183caf fix: Git checkout updates no longer fail before the new release starts on a schema change or a busy database (openclaw#201463); 47e8649 fix: explain why Doctor cannot restore a scheduled job’s account (openclaw#201550); 8f2cfd4 fix: remove updater-only restrictions from agent maintenance guidance; cb5cfb2 fix: keep a doubtful killed-update recovery on the repair path (openclaw#201361); 24cb734 fix: keep carried-over scheduled jobs running after updates (openclaw#200653); d1276e1 feat(doctor): check OpenClaw ID member roles and honor an optional roles default (openclaw#197785); 0a39956 fix: finish updates when another tool reads OpenClaw's databases during the update (openclaw#201330); ea1c9d5 fix(update): settle remounted package publications before admission (openclaw#201336); 66b5212 fix(update): isolate malformed retained-install markers (openclaw#201199); 7e79c83 fix: let the next update finish a killed source checkout update (openclaw#201009); d905d8a fix: let the next update finish a killed update after the machine restarted (openclaw#200994); fdf0c95 fix: let the next update finish a killed update that had already installed the new version (openclaw#200866); 0c19bcd chore(release): close out 2026.11.5 on main (openclaw#200577); a1940e0 fix(matrix): keep explicit recovery available during deferred migration (openclaw#200805); 18b4776 improve: explain package baseline drift during updates (openclaw#200802); 1ad4cad fix(doctor): reclaim macOS updater runtimes blocked by non-updater processes (openclaw#200732); 427c857 fix: keep one missing archived transcript from blocking every update (openclaw#200733); 802e3f7 fix(update): keep valid cold archives from blocking updates (openclaw#200659); 23fca1a fix: let the next update continue after a killed update when nothing is left to repair (openclaw#200680); 3afe212 fix: let Doctor publish unchanged plugin migrations in any order (openclaw#200658); f65e4db fix(doctor): reclaim runtimes blocked by unrelated Linux processes (openclaw#200657); dab086c fix(update): let candidate Doctor read plugin dependencies from the staged package (openclaw#200595); 3447bee fix(update): keep updates going when the predecessor writes during its stop (openclaw#200569); 0ce9c77 fix: let the next update settle a package publication that a killed update left behind (openclaw#200550); ae31ea3 fix(update): repair handoffs in the journal-pinned lease store (openclaw#200532); 74020ea fix: continue updates when initial SQLite capture is stale (openclaw#200328); 6747b1e feat(update): run Git checkout installs from releases behind the release link (openclaw#199706); e3f8a67 fix(state): keep completed retained agent stores out of startup upgrade (openclaw#200284); 3c512c5 fix(gateway): move managed update lease operations off the main thread (openclaw#200169); ea69fcb chore(release): close out 2026.11.4 on main (openclaw#199956); 618bf31 fix(state): bound startup upgrade copies and pruning to owned state (openclaw#199929); e4a3093 perf(update): replace the candidate canary with a runtime contract check (openclaw#198268); 5dbf569 fix(update): plugin failures never fail an update or Gateway health; 764761e fix(update): refuse missing host prerequisites in one line and record a cause per attempt; 4c4fef4 fix(ui): update dialog claims installation before progress is confirmed (openclaw#199254); 136e1f6 fix(update): retrying an update from a dev checkout is refused after a killed update (openclaw#198673); 3bd03da fix(update): avoid duplicate database copies while the Gateway is stopped (openclaw#198148); 68a839b fix: isolate held agent databases until explicit restoration (openclaw#198180); e333f7e chore(ci): drop retired test-lines allocation records (3/3) (openclaw#197657); fd6fa47 fix: converge Gateway updates with environment-only service overrides (openclaw#196371); 7cf5e75 fix: clarify split-install updates and blocked Doctor repairs (openclaw#196342); 6ff8c86 fix(update): retain lazy sqlite catalog generation (openclaw#197095); 930e1f7 fix: keep stable updates and recovery free of premature migrations (openclaw#196474); a15f737 fix: preserve external plugin data during update rehearsal (openclaw#196301); 92798ae fix: updates survive interrupted heartbeat runs (openclaw#195656); c1e55e2 fix(update): restore LaunchAgent registration after repair contention (openclaw#195406); 715c610 fix(doctor): repair retained ISO session end timestamps (openclaw#194685); 689cfc8 fix(update): reclaim dead closing triage repair leases (openclaw#194503); 86bc89e fix(doctor): keep standing Codex parameter advice out of retirement blockers (openclaw#193650); 691bc8d fix(backup): read the backup engine without copying the live database (openclaw#194234); 000542f fix(backup): backups and updates fail on slow storage when a header probe batch misses its deadline (openclaw#194239); 31a65d5 fix(update): skip --no-lazy-fetch on Git versions without it (openclaw#194198); e45e99d fix(update): preserve dev update sources in tag-only Git clones (openclaw#193109)

Validation: Baseline2 intended operator-agent failures/32 controls passed; candidate34/34passed (194058-green.log). Accept launches synthetic operator-only CLI with expected env, decline starts nothing. Isolated updater flow, not live systemd/upgrade qualification.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 6689fd575ada8fe40a9593784deac18ec73041cd)
(cherry picked from commit 92e7a9fa223b0dc35801f25f70be90b472d9a6b7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M 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.

Update failure: package-backup-retention (2026.11.4) Update failure: package-backup-retention (2026.11.3)

1 participant