Repository navigation
fix(storage): preserve committed facts when publication fails - #167570
Conversation
Install committed facts and projections before observers, fence failed retained comparisons, and preserve native outcomes independently of notification and worker reply delivery. Bind private receipts to operation, source, exact key coverage, postimages, and commit sequence without replacing domain owners. Synchronous APIs retain their completion contract. This shared foundation adds no schema, stored-byte, retention, or SDK deprecation change. Incomplete domain, raw-handle, and foreign-writer families retain their existing final guards.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThe branch separates SQLite fact installation from notifications, fences failed session publications, and preserves ordered commit evidence independently of reply delivery. Example: A session’s visibility changes to read-only
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR remains useful: current main still exposes committed writes to publication failures. Prior actionable findings are resolved, and the new evidence addresses the previous acceptance and CI-attribution requests. No additional patch blocker was found; CI remains failed under the documented inherited-failure exception. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherOpenClaw stores session state in SQLite and publishes committed changes into the Gateway’s retained session facts before notifying observers. This publication boundary connects durable writes to session reads, lifecycle events, and worker acknowledgments. flowchart TD
A[Session mutation] --> B[SQLite transaction]
B --> C[Committed receipt]
C --> D[Install session facts]
D --> E{Installation succeeds?}
E -->|Yes| F[Install projections]
E -->|No| G[Fence affected facts]
F --> H[Notify observers]
G --> H
Technical reviewBest possible solution: Keep commit outcome, fact completeness, notification delivery, and live authorization separate within the existing storage owners. Do we have a high-confidence way to reproduce the issue? Yes: current main directly invokes fallible callbacks after COMMIT, and the inspected regressions inject those failures through real SQLite and worker-publication boundaries. This read-only review did not execute them. Is this the best way to solve the issue? Yes: the repair belongs in the shared publication owner and preserves domain-specific supersession and live-authority checks rather than retrying committed mutations. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against fd2fa6b904a2. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +503, Tests +547, Docs +60, Other +2. Total +1112 across 26 files. Added test files: 1. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (5 earlier review cycles)
Reviewed October 9, 2026, 12:55 AM ET / 04:55 UTC (Revision 6). |
Preserve both worker-access documentation additions. Production code integrates without conflict; the receipt and completeness change retains its reviewed behavior.
Keep the trusted wrapper extraction closed over the session publication paths introduced on main. Include both receipt modules required by those paths; the wrapper inventory and extracted dependency-resolution regressions now pass.
…ettlement Keep receipt coverage separate from retained-read certainty: acknowledged identity mutations still publish while unknown native settlement fences caches and preserves the original error. Align generic observer-failure assertions with committed success, and keep cron transport tests within their real per-operation channel contract.
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…aw#167570) * fix(storage): preserve committed facts through publication failures Install committed facts and projections before observers, fence failed retained comparisons, and preserve native outcomes independently of notification and worker reply delivery. Bind private receipts to operation, source, exact key coverage, postimages, and commit sequence without replacing domain owners. Synchronous APIs retain their completion contract. This shared foundation adds no schema, stored-byte, retention, or SDK deprecation change. Incomplete domain, raw-handle, and foreign-writer families retain their existing final guards. * fix(tooling): include receipt modules in PR wrapper Keep the trusted wrapper extraction closed over the session publication paths introduced on main. Include both receipt modules required by those paths; the wrapper inventory and extracted dependency-resolution regressions now pass. * fix(storage): preserve acknowledged identity events after uncertain settlement Keep receipt coverage separate from retained-read certainty: acknowledged identity mutations still publish while unknown native settlement fences caches and preserves the original error. Align generic observer-failure assertions with committed success, and keep cron transport tests within their real per-operation channel contract.
Align with 1321ecb (openclaw#167570): fallible native-commit receipt publication is contained after commit and does not fail result delivery. Name the injected publication fault accurately and retain exact imported data, receipt, source cleanup, and native-exit recovery assertions.
What Problem This Solves
Fixes committed SQLite writes reporting failure, skipping later publications, or leaving retained session facts usable when a postcommit installer or notification throws.
Related: #166519.
User Impact
Managed synchronous writes keep their synchronous completion contract and install committed facts before observers. Failed installation fences the affected session facts; an already committed mutation is never replayed to repair notification or reply delivery. There is no schema, stored-byte, retention, configuration, SDK removal, or new deprecation change.
Why This Change Was Made
The existing postcommit pipeline now separates fact installation, projection installation, failure fencing, and notification. Private session replacement receipts identify the physical source/incarnation, operation, domain, exact affected keys, postimages, absence, and unknown coverage. Existing session owners retain responsibility for supersession, membership, generations, and pending readers.
Private worker receipts carry operation identity and commit sequence. Identical successive commits remain distinct, and duplicate or stale delivery cannot replace newer facts. Committed evidence survives a lost ordinary reply independently of native settlement.
This is S1's shared foundation only. Transcript/context, conversation/plugin-state, approval/placement/workspace, raw-handle settlement, and foreign-writer recertification retain their existing guards until their domain cutovers. A receipt grants neither current permission nor source exclusion through a cross-store commit.
Evidence
Final candidate:
15bc2abdcaa8081d3445ad67177b0b25d2841af9. Original SQL measurement candidate:fc7445e4ecef0d7e0f944058e16d83887833ddad; baseline main:c786f4d4c4ea27630466a529630e56071845a682.Final landing validation
Final reviewed head:
15bc2abdcaa8081d3445ad67177b0b25d2841af9.Main was merged without rebasing in
8c36ab414ac47; the only conflict was adjacent worker-access documentation, with both additions preserved. Integration exposed two missing receipt modules in the trusted wrapper inventory;431497ab4b9e8adds them. CI also exposed an acknowledged identity notification being suppressed by unknown native settlement.15bc2abdcaa8preserves that notification while keeping read facts fenced and the unknown-outcome error intact. Generic observer-failure expectations now preserve committed success; required completion failures still reject. The cron fixture retains real duplicate delivery and commit/reply/partition checks, with valid stale same-operation delivery covered by the existing SQLite admission regression.Fresh isolated P2 reviews are clean. The repaired candidate passed production typechecking and all 27 selected test type graphs. The five affected regression files passed 21 selected cases with
--maxWorkers=1in 413.62 seconds, including all three unchanged exactly-once identity assertions, 14 receipt-coverage cases, native/worker custody, deletion and cron publication. The Codex readiness-publication integration case also passed (31.276 seconds); its binding, readiness, link and cleanup assertions remain. No new test cases, real timers or worker boots were added in these landing repairs. The earlier wrapper regression was reproduced locally, then both inventory and extracted dependency-resolution checks passed in 118.81 seconds. The final CI's 33 selected Node/Bun test jobs used 6,167 summed job seconds, including setup and unchanged sibling coverage.Published-driver acceptance passed: the registry-verified
2026.9.8driver successfully updated to the2026.9.9candidate in the canonical Docker cell on Testbox run 37882814648. Packaging passed in 262.272 seconds; the unchanged update cell passed in 232.190 seconds, with durable statussucceeded/finished, readiness HTTP 200 and the expected running version. Candidate admission, Doctor/config/plugin/recovery and startup checks, database snapshot/migration, managed-service replacement and post-update verification completed. Durable session content survived; incognito content and artifacts did not; the seeded orphan sidecar remained byte-identical. The transport carrier's tree matches reviewed tree9c1da6074d688d6b5d0da02f52aa0713d3235384; all 52,354 product files match digest4c8a7f088f2440614feddf3b8ffe3c50d2a9760ed4a717817528ad7cbe14d1ca. Package SHA-256:aee1dfab565708f5330e4682d0fd3cfc2329880fd5cd6e972a103112656f770c. No deadline or assertion was weakened. Testbox was stopped after proof; its lifecycle status is separate from the successful command receipt. The earlier activation timeout below remains unresolved historical evidence, not a claimed fixed cause.Exact-head CI run 37882395546 completed with 67 successful jobs, 22 skipped jobs, three inherited root failures and their aggregate, and no cancellations. Native admin evidence binds its actual tested merge
9375dd75cef5ddeef0091ef39726f2a88405a32d, baseline59309cc7777e07d52ca1be94bf8c25fd685919bc, all failure inputs and the complete logs. CI remains failed; this uses the authorized inherited-failure exception.1f86b827717777114caf0184f1dfc77adf050cc6with the repository-pinned Bun fork: 1 failed, 13 passed. Read-only restoration re-enters pending writable admission. Relevant inputs match the CI baseline and tested merge.process.platform=win32but mocks only the permission inspector. Unchangedfs-safe0.25.0 selects its Windows writer and fails on missingbinding.fstatIdentitybefore reaching SQLite or receipt work. Test, writer, dependency and lockfile inputs are unchanged from the tested baseline. This is inspected source attribution, not a claimed baseline run.The earlier Madge and script-lint failures are green in this final run. ClawSweeper completed a trusted review of the final head with no actionable findings; its remaining update-proof and Windows-attribution requests are addressed above.
Released SDK reachability was checked against
v2026.9.9andv2026.10.1-beta.1, including SQLite worker-runtime exports andapi.runtimesession changes. No released synchronous/asynchronous signature, required parameter, callback contract or export was removed. Receipt metadata remains optional; no compatibility deprecation record is needed. The landing fixes do not change the existing API-diff declarations. No newOPENCLAW_*names or SQL statements were added. The valid alternating-pair SQL proof below is reused: integration had no production conflict, and the subsequent production repair affects only fault settlement/notification, not successful measured SQL paths.Original lane verification at
fc7445e4ecef:check:changedstops at an inherited dead-export failure forClientVoiceToolEffectin untouchedsrc/talk/client-voice-session-store.ts. Its definition and absence of external consumers are unchanged from the baseline. Every other selected check passed, including the guards after that scan, run separately.da3d5a16: no entrypoints, exports, or direct export declarations changed. All 131 records are reachable-declaration changes: optional receipt metadata, added helpers/types, and equivalent parameter-name/type-import syntax. No required fields or removals.Historical published-driver activation timeout
The unchanged canonical cell exited 124 after 18m 2s. Its managed updater exceeded the remaining 954,153 ms budget (status 143); it was not OOM-killed. The activation journal remained at
publishing, revision 11, with publish intent and no launcher publication receipts. Post-update acceptance was not reached. The failed fixture was reconciled and stopped; no live Gateway or operator state was used.The installed driver is the registry-integrity-verified
2026.9.8package, build commitfc23bc864e4553c2d215e479eeec47b67a0bf943. Its activation helper matches the journal's helper digest. The bounded publication path uses that old driver's native journal/currentness checks, rename/directory sync, and full package-tree integrity inspection before the first launcher receipt. It precedes candidate post-install continuation and does not use S1's worker receipt protocol. The exact operation active at termination remains unproven; no S1 causality or fixed timeout is claimed.Candidate package:
2026.9.9, sourcefc7445e4ecef0d7e0f944058e16d83887833ddad, SHA-256fad220df26ffb1d3d445d13bcc267e65f55e2a0cb7dd75c03a512e66d28e87f1. This original attempt did not establish acceptance; the final candidate passed the separate canonical cell recorded above. No timeout, source, or guard was changed to turn the failure green.SQL measurement and attribution
The qualifying series uses three alternating baseline/candidate pairs on one isolated Linux arm64 VM, Node 24.21.0 / SQLite 3.53.4, 8 CPUs and 32 GiB RAM. Source SHA/tree/product hashes match the reviewed commits. The workload and collectors are identical on both sides; databases and per-statement traces use native ext4. All six runs passed, request census has no missing context or duplicate sends, and all warmed requests completed. All native statements remain in the totals, including background and unassigned work.
Medians below are baseline → candidate; warmed counts and wall times are per turn. Every phase's candidate/baseline duration ratio is valid (0.960–1.051).
[1586, 1111, 1114]→[1603, 1118, 1104].The actual affected writer flows are neutral: explicit replacement uses 172 statements on each side in every pair. First-turn replacement, patch commit/preparation, lifecycle projection, and turn commit have identical SQL counts (51/222/36/35/49) in every pair. Across ten warmed turns, patch commit/preparation, lifecycle projection, and turn commit remain exactly 1,730/280/380/490 statements with 120/100/10/10 requests on every side/run. Full-run writer medians are neutral or lower. No PR-caused statement or request increase was identified.
Logical worker-request medians are 4,895 → 4,894. Separately counted continuation frames match each pair exactly (send/receive/reply:
164/164/159,168/168/162,168/168/162). Whole-run admission-envelope medians are unchanged: open 6, prepare 1,045, transaction 1,402, commit 540. Warmed prepare/transaction/commit envelopes remain 66/88/30 per turn. First-turn transaction admission is 114 → 115 from the same startup scheduling described above; whole-run admission does not increase. Two boot-only unknown-target/unmatched records occur on both sides forworkerEnvironments.snapshotanduserProfiles.catalog; no native SQL context is missing, and all warmed requests complete. These are message counts, not byte-volume measurements.Native standalone BEGIN/COMMIT counts are 174 → 173 each in first turn and 125.7 → 125.5 each per warmed turn. First-turn summed native elapsed medians are 1.072 → 1.119 ms for BEGIN and 5.382 → 5.144 ms for COMMIT; warmed values are 0.690 → 0.623 ms and 2.653 → 2.552 ms. No BUSY/LOCKED failures were observed. Elapsed values include execution and scheduling and only bound possible waiting; they do not establish zero lock waits. Implicit/batch transaction timing and raw/foreign-path migration savings are not claimed.
A separate macOS Node 26.10.0 series retained nine successful pairs but remained invalid for gating: connect's duration ratio was 4.740 and its raw/combined counts exceeded tolerance. Those results were not pooled with Linux or relabeled as passing. The Linux series is the qualifying comparison.
Failed measurement attempt
One macOS candidate attempt was rejected because
mentions.dismissreturnedUNAVAILABLE. Its worker request reached transaction admission, executedBEGIN IMMEDIATE, two admitted data-version probes and two configuration reads, then rolled back before any mention mutation or COMMIT. A subagent-completion write committed between the preceding mention snapshot and admission. There were no failed native SQL calls or receipt/fact-installation diagnostics. The handler suppresses the exact rejected predicate, so the underlying refusal remains unresolved; a later successful run is not claimed as a fix. This failed pair does not count toward passing coverage.Focused test cost and scope
Measured with
pnpm test <file> --maxWorkers=1:sqlite-post-commit.test.tssqlite-worker-operation-admission.test.tssession-accessor.sqlite-replacement-receipts.test.tssession-accessor.sqlite-replacement-worker.test.tsThe session suites exercise admitted SQLite workers, physical-store lifecycle, and actual committed rows. Compiled-subprocess preparation and source verification contribute to wall time; no new timers, polling, worker pins, or Gateway boots were added. Final CI timing and the additional targeted landing checks are recorded above.
Final scope: production +641/−138 (779 changed lines), tests +632/−85 (717 changed lines), documentation +60 across four pages, and two wrapper-inventory lines. No S2 domain cutover is included.