Skip to content

fix(update): preserve successful results during concurrent SQLite writes - #152986

Merged
fuller-stack-dev merged 7 commits into
openclaw:mainfrom
fuller-stack-dev:fix/update-terminal-owned-publication
Sep 19, 2026
Merged

fuller-stack-dev merged 7 commits into
openclaw:mainfrom
fuller-stack-dev:fix/update-terminal-owned-publication

Conversation

@fuller-stack-dev

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

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes successful updates reporting that verification failed and recovery remains pending when the Gateway keeps writing to SQLite during final result publication.

User Impact

A completed, verified update reports its matching saved outcome. Existing cleanup and recovery checks still apply. Incomplete readiness, conflicting identity, or retained recovery cannot qualify for this publication path.

Why This Change Was Made

The final report was reopening the state database through an artifact-preserving snapshot after the updater released ownership. Ordinary writes could prevent that snapshot from stabilizing even though the update had already succeeded. Keep the matching completed record inside the original updater's private publication chain and use it only after the executor settles cleanly. Future update admission and generic snapshot behavior remain strict.

Evidence

  • Updated-tree installed published 2026.9.3 → exact d785a32cf52d435913ec235fed324a4b3edbee84 qualification passed all 47/47 phases, including the full package build, tarball integrity, exact candidate build identity, final Gateway readiness/status and clean source before/after. Summary, receipt, phase observations and manifest are GET/SHA256 verified. AWS execution and capture exited 0. The current 931d43bf head changes only the test fixture, with the production-byte bridge below. This cell uses synthetic existing state and a manual Gateway restart, with no live fleet or provider credentials. Concurrent-writer behavior is proven separately.

  • The published 931d43bf correction replaces the test fixture's unsupported Promise.withResolvers with the canonical typed deferred helper. Both ordering cases and scoped review pass; all assertions and production blobs are unchanged from d785a32c. Test-only byte bridge and manifest are GET/checksum verified. The installed-driver cell remains explicitly pinned to d785a32c; exact corrected-head CI remains required.

  • Current published revision is 931d43bf7674d21ca6d8f7a4f6e98be324428e92, with canonical 82941a4a457eede1f969da384e754ee31ee13c3c integrated append-only. A matched fresh canonical red video at 7884d9a88f97f1ad87e768607df47c545ba13654 still reports false pending recovery with a durable succeeded row. The green video and six independent cases ran at c2c2790a7e4709b09ff2d2ef588e8f6ddbe22de2; the source/hash bridge binds unchanged authored modules and exercised shared-state boundaries to the published revision. Current artifact manifest. Every artifact was downloaded and checked against its local SHA256.

  • Relevant integration checks passed 135 cases: 58 terminal controls, 68 Doctor/post-core cases, one candidate-worker producer-contract case, seven worker-retirement cases and one pending-admission case. The independent busy fixtures varied from 64 to 80 MiB; wrong-target, settlement failure and missing-receipt inputs refused success. These checks do not replace the full installed-driver upgrade qualification. The historical 987a14ea qualification below remains valid for that historical tree; the updated-tree qualification now passes at d785a32c with the test-only bridge; exact published-head CI remains required.

  • Actual native executor and private 64/80 MiB SQLite WAL fixtures. Independent writes continue during capture and publication. The unchanged baseline reports false pending recovery; the candidate reports success while the durable row stays succeeded and no recovery record is created. Wrong-target, settlement-failure and missing-record cases retain their refusal behavior.

  • Baseline video, historical 987a14ea candidate video, and artifact manifest. The baseline is e1b8056605a912d45ef3329b3a70a3de81c973ed; historical candidate is 987a14ea312ad3c6be0ce4da0902738b9f533e0e. Videos show actual JSON/API output through a sanitized terminal projection. The baseline was not rerun for the final helper extraction.

  • Six independent historical 987a14ea cases passed, including durable run/build correlation, writer activity at both boundaries, executor closure and lease release. Source provenance identifies the exact candidate and files.

  • 58 affected tests and the actual candidate-worker completed-result case passed on the historical 987a14e extraction. Controls cover JSON/human output, cleanup/release failure, missing or conflicting identity, false readiness, pending reports, replaced state, malformed recovery, and reporting-state observation across asynchronous boundaries. The worker case receives the released producer's handoff shape against a newer schema; it is not a full installed-driver upgrade.

  • The line-cap, lint and formatting checks passed. Final extraction review found no remaining P0–P2 findings. The installed published-driver qualification below passed on the exact final candidate. Required hosted CI remains a landing gate.

  • Installed [email protected] successfully updated retained synthetic operator, session, plugin and config state to exact candidate 987a14ea312ad3c6be0ce4da0902738b9f533e0e. All 47 phases passed, with matching build identity and final gateway readiness/status. The canonical package build and tarball integrity checks passed, source remained clean, and execution plus complete evidence capture exited 0. This scenario uses manual gateway restart and no live provider credentials. Compatibility receipt, phase observations, artifact manifest. All six published files were downloaded and checksum-verified.

The focused API fixture supplies synthetic verified history and does not start a real Gateway. Human-text output is covered by focused tests. The local type wrapper rejects borrowed compiler dependencies; required hosted CI supplies exact-lock type proof. An earlier combined local run crashed in Node's V8 collector; its failed result and subsequent controls are retained rather than counted as a pass.

@clawsweeper

clawsweeper Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: L maintainer Maintainer-authored PR labels Sep 19, 2026
@fuller-stack-dev fuller-stack-dev changed the title fix(update): successful updates report recovery failure during live writes fix(update): preserve successful results during concurrent SQLite writes Sep 19, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 19, 2026
@clawsweeper

clawsweeper Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 19, 2026, 1:19 PM ET / 17:19 UTC (Revision 5).

ClawSweeper review

What this changes

The updater carries its verified saved outcome through cleanup so concurrent SQLite writes cannot turn successful completion into a reporting failure.

Merge readiness

✅ Ready for maintainer review

This remains a useful fix absent from fetched main. No blocking introduced defect was found, and the captured evidence addresses the prior upgrade-qualification follow-up.

Priority: P2
Reviewed head: 931d43bf7674d21ca6d8f7a4f6e98be324428e92

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent fix with substantial regression coverage and supplied runtime and upgrade evidence; no blocking patch defect was identified.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): Preserved the supplied production-owner WAL proof showing successful publication after real executor settlement, with refusal controls. The body now records the required 47-phase published-driver upgrade qualification, and GitHub verifies the final commit is test-only. External receipts and videos could not be independently opened on this reviewer host.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): Preserved the supplied production-owner WAL proof showing successful publication after real executor settlement, with refusal controls. The body now records the required 47-phase published-driver upgrade qualification, and GitHub verifies the final commit is test-only. External receipts and videos could not be independently opened on this reviewer host.
Evidence reviewed 9 items Current main still performs the vulnerable reads: After executor settlement, current main calls recovery admission and getUpdateRun; failures become UpdateCommandPendingRecoveryFailure. The proposed captured-record path is absent.
Capture retains existing ownership and verification checks: Capture requires the original executor, matching state selectors, confirmed readiness and candidate identity. The storage owner rejects retained recovery and returns only a succeeded, finished row through its existing coordinated transaction.
Publication does not restore mutation authority: Only settlement without failure can consume the captured outcome. Publication rechecks identity after asynchronous notification, avoids terminal-row writes, and passes the saved record to CLI rendering and the candidate worker. Future admission keeps its ordinary recovery checks.
Findings None None.
Security None None.

How this fits together

OpenClaw’s updater records installation and Gateway verification results in SQLite. Its final reporting path converts those results into CLI output and a response to the installed updater.

flowchart TD
  A[Update and Gateway verification] --> B[Saved update outcome]
  B --> C[Validate and capture completed record]
  C --> D[Executor cleanup and release]
  D --> E{Clean settlement and matching identity}
  E -->|Yes| F[Publish saved success]
  E -->|No| G[Existing failure and recovery reporting]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +327, Tests +537. Total +864 across 15 files.

View PR surface stats
Area Files Added Removed Net
Source 10 461 134 +327
Tests 5 538 1 +537
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 15 999 135 +864

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +327 net lines; tests and test support +537 net lines Production growth implements private outcome capture and publication checks; most net growth covers regression and refusal behavior.

Technical review

Best possible solution:

Keep final reporting observational after executor release while preserving authoritative cleanup, recovery admission, and candidate-identity checks.

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

Yes, at source level: complete verification, release the executor, then let concurrent SQLite writes prevent the final snapshot read. Current main still exposes this path; this review did not execute it.

Is this the best way to solve the issue?

Yes. Retaining a matching completed record inside the existing publication owner avoids weakening generic snapshot or recovery admission rules.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This fixes misleading failure reporting after an otherwise successful update under concurrent SQLite writes.
  • 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 (linked_artifact): Preserved the supplied production-owner WAL proof showing successful publication after real executor settlement, with refusal controls. The body now records the required 47-phase published-driver upgrade qualification, and GitHub verifies the final commit is test-only. External receipts and videos could not be independently opened on this reviewer host.
  • proof: sufficient: Contributor real behavior proof is sufficient. Preserved the supplied production-owner WAL proof showing successful publication after real executor settlement, with refusal controls. The body now records the required 47-phase published-driver upgrade qualification, and GitHub verifies the final commit is test-only. External receipts and videos could not be independently opened on this reviewer host.

Evidence

What I checked:

  • Current main still performs the vulnerable reads: After executor settlement, current main calls recovery admission and getUpdateRun; failures become UpdateCommandPendingRecoveryFailure. The proposed captured-record path is absent. (src/cli/update-cli/update-command-terminal.ts:176, 24a03acf58c4)
  • Capture retains existing ownership and verification checks: Capture requires the original executor, matching state selectors, confirmed readiness and candidate identity. The storage owner rejects retained recovery and returns only a succeeded, finished row through its existing coordinated transaction. (src/cli/update-cli/update-command-terminal-record.ts:67, 931d43bf7674)
  • Publication does not restore mutation authority: Only settlement without failure can consume the captured outcome. Publication rechecks identity after asynchronous notification, avoids terminal-row writes, and passes the saved record to CLI rendering and the candidate worker. Future admission keeps its ordinary recovery checks. (src/cli/update-cli/update-command-terminal.ts:192, 931d43bf7674)
  • Regression and refusal coverage: Read the complete added record/publication tests and composed terminal/legacy-worker tests. They cover JSON and human output, real executor release, mismatched or missing identity, incomplete readiness, retained or malformed recovery, replaced databases, and cleanup failures. Tests were not executed during this read-only review. (src/cli/update-cli/update-command-terminal-record.test.ts:245, 931d43bf7674)
  • Captured proof and previous-review disposition: Recovered the complete PR body through GitHub and verified SHA256 a8cfd4f2738abf458df7fc1c9e1488d0162162eb2339dce88196850464ef1220, matching the supplied snapshot. It now reports all 47 published-2026.9.3-to-d785a32c upgrade phases passing, including retained synthetic state and final Gateway readiness. Separate production-owner WAL cases report baseline false failure versus candidate success, plus wrong-target, settlement-failure and missing-record controls. The upgrade uses manual Gateway restart; the concurrent-writer fixture supplies synthetic verified history. (d785a32cf52d)
  • Latest commit preserves production bytes: GitHub’s exact commit response records d785a32 as the parent and only one changed test file: Promise.withResolvers is replaced by the repository’s typed deferred helper. This supports carrying the preceding production qualification forward. (src/cli/update-cli/update-command-terminal-publication.test.ts:26, 931d43bf7674)

Likely related people:

  • fuller-stack-dev: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • steipete: 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 (4 earlier review cycles)
  • reviewed 2026-09-19T15:31:25.596Z sha aaa5661 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-19T15:44:51.589Z sha 987a14e :: blocked before merge. :: none
  • reviewed 2026-09-19T16:12:11.637Z sha 987a14e :: needs maintainer review before merge. :: none
  • reviewed 2026-09-19T16:59:47.250Z sha d785a32 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. and removed merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Sep 19, 2026
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

The corrected head 931d43bf7674d21ca6d8f7a4f6e98be324428e92 passes the full build and all production/test type checks. The required security-fast audit has not cleared: its four bulk-advisory attempts returned npm HTTP 503 maintenance responses. Failed job.

npm scheduled maintenance runs from 17:00 to 19:00 UTC. A later availability-only request to the same endpoint still returned 503. I am retaining the failed gate and will rerun only that job after the service recovers; this is not dependency clearance or a gate waiver.

@fuller-stack-dev
fuller-stack-dev merged commit 0335033 into openclaw:main Sep 19, 2026
394 of 399 checks passed
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

@fuller-stack-dev
fuller-stack-dev deleted the fix/update-terminal-owned-publication branch September 19, 2026 18:02
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 20, 2026
…tes (openclaw#152986)

* fix(update): preserve completed results during live state writes

* refactor(update): separate terminal publication helpers

* test(update): use the typed deferred helper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. 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.

1 participant