Repository navigation
fix(storage): publish conversation and plugin-state mutation receipts - #167731
Conversation
Capture stored postimages and exact tombstones across native and worker mutations, including expiry, retention, clear, and reverse-index invalidation. Preserve valid large writes while retiring incomplete receipt coverage, and require completed native settlement before certifying worker coverage. Reject obsolete ClickClack discussion and channel routes after persisted bindings change. Retain native authority guards and document raw, foreign, and compound-receipt gaps.
Route mutation staging and observation through each domain publication owner. Remove standalone staging exports and unused event-type exports while preserving the staging functions, SQL, and receipt lifecycle.
|
🦞👀 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. |
|
Codex review: needs maintainer review before merge. What this changesSQLite storage publishes receipts—process-local records of committed changes—so consumers can identify updated conversation and plugin values or deleted keys. Review scores
ProductKind: Bug fix · Worth it: Yes Merge readiness✅ Ready for maintainer review Keep open: the central receipt work remains absent from current main and has established area-owner support. The prior conflict concern is resolved, and no actionable introduced defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Gateway stores conversation addresses and routing bindings in SQLite, while plugins store keyed values in shared state. The existing storage owners now publish committed facts through their native and worker completion paths. flowchart TD
A[Conversation and plugin mutations] --> B[Existing SQLite storage owners]
B --> C[Commit or rollback]
C --> D[Committed rows and deleted keys]
D --> E[Postcommit fact installation]
D --> F[Private worker receipts]
F --> E
E --> G[Consumer notifications]
F --> H[Native settlement and completion]
Technical reviewBest possible solution: Keep publication within the existing storage owners and retain native authority guards until the remaining writer coverage is complete. Do we have a high-confidence way to reproduce the issue? Yes at the storage boundary: current-main mutation kernels omit committed-key publication, and inspected SQLite and worker regressions exercise that contract. No failing current-main runtime run was performed during this read-only review. Is this the best way to solve the issue? Yes: capturing affected rows with RETURNING and using the existing postcommit pipeline is a focused solution that preserves persistence and authority contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3e5d536280fd. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +1030, Tests +1047, Docs +41. Total +2118 across 24 files. Added test files: 1. View PR surface stats
Review metrics
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 (4 earlier review cycles)
Reviewed October 9, 2026, 1:13 PM ET / 17:13 UTC (Revision 5). |
Preserve the worker-backed ClickClack binding owner and direct persisted discussion target checks from main. Keep S3 receipt semantics and the routing regression; regenerate the database access inventory.
|
Landed as Used the explicitly authorized REST squash fallback after native worktree/lock handling spent over 30 minutes under filesystem contention. CI run 37963878137 had only the independently attributed, unchanged restart-recovery fixture failure documented in the PR; the maintainer-approved inherited-CI exception was applied. All other selected categories passed. Independent security review passed, and ClawSweeper completed the exact head with zero findings. Published-driver update proof passed all 19 phases on the final head: service replacement/readiness, durable-data preservation, and incognito cleanup. The Testbox lease was stopped. The accepted first-turn SQL tradeoff and the bounded P2 future-composition follow-up remain recorded in the PR body. |
…openclaw#167731) Publish committed conversation and plugin-state row facts through the existing SQLite postcommit and worker receipt owners, including touches, expiry, eviction, deletion, and clear. Preserve unknown settlement, supersession, overflow handling, and existing final-authority guards. Keep main's worker-backed ClickClack store and direct persisted-target validation, with stale-route regression coverage. No stored schema, retention, permission, or released SDK contract changes. The measured first-turn +18 statements (+0.68%) is explicitly accepted because these receipts enable the follow-up removal of freshness probes. Validation: 43 focused integration/import tests plus wrapper inventory; core and extension production/test types; zero import cycles; changed-file formatting; exact-head published 2026.9.8 update cell (19 phases), preserving durable data and clearing incognito data. Landing uses the authorized inherited-CI exception: two unchanged restart-recovery fixture cases close a projection reader while holding a writer, triggering main's development cleanup guard from openclaw#167662. All other selected CI categories and independent security gates passed. ClawSweeper completed the final head with no findings. Head-pinned REST squash follows native worktree/lock contention exceeding 30 minutes.
What Problem This Solves
Conversation and plugin-state mutations did not publish the committed keys and values needed to invalidate consumers, including touch, expiry, eviction, and deletion. ClickClack routing regressions also cover obsolete routes after a binding is replaced under the same primary key.
Builds on #167570, now merged. The branch is based on its merge commit
da67a08b20eband targetsmain.Accepted performance tradeoff (maintainer decision, 2026-10-09): the final seven-pair first-turn median is 2,651 → 2,669 statements (+18, +0.679%); the combined boot/connect/first-turn window is 5,237 → 5,253. This increase is explicitly accepted for landing. These receipts provide the single-owner committed facts needed to replace freshness probes; the follow-up probe-removal work removes approximately 230 probes per turn. This is an approved exception, not a claim that the original 0.5% allowance passed. The coverage implementation and checks are detailed below.
User Impact
ClickClack refuses an obsolete discussion or channel route after its persisted binding is replaced. Storage schemas, stored bytes, retention, permissions, and public SDK contracts are unchanged. Existing native authority guards remain in place.
Why This Change Was Made
The existing mutation kernels now capture stored postimages or exact deletion tombstones using
RETURNING, and publish through S1's postcommit phases. Worker receipts cover their committed batch before reply delivery; pending and unknown outcomes remain distinct, and newer native changes supersede late receipts. Catalog batches reduce repeated addresses to their last value before writing. Oversized receipts preserve the valid mutation and retire coverage before reply. Private fact installation rejects reentrant writes; public postcommit observers remain free to mutate. A commit receipt followed by unknown native settlement retains the committed event but cannot certify coverage. Empty plugin-state confirmations travel in the existing native-settlement message; actual mutations retain immediate post-COMMIT receipt delivery. This introduces no additional SQL statement or database request in the changed kernels. No T1 reduction is claimed.conversation.registerworker receiptsRaw/unmanaged writes, unregistered trigger/cascade effects, and foreign-process recertification remain separate coverage gates. This PR does not certify global completeness, remove a final guard, or count native Promise wrappers as worker migration.
Evidence
Focused native and real-worker proof passed: 51 tests across plugin-state publication, binding workers, and the conversation registry after integration (692.73 s wall time with
--maxWorkers=1, including worker compilation). The owner API consolidation then passed 14 selected tests (457.79 s); earlier sibling coverage passed 144 tests across 11 files, including ClickClack. Both unknown-settlement regressions verify the durable write before checking retired coverage. Real 32 MiB overflow regressions failed before the fix and passed afterward. Bun 1.4.2 native proof passed for atomic claim/consume, rollback, and clear tombstones.The source-mapped qaRuntime build passed on final
db5967493a14(11,225 source maps, 210.72 s), using Node 26.10.0 and frozen pnpm 12.5.1 dependencies. Inventory generation/check passed: 619 files, 2,456 call expressions, no T1 growth. SDK exports passed. The declaration/source-root comparison againstda67a08b20ebfound no added/removed entrypoints or direct export-signature changes; 148 exports have reachable changes from four internal declaration records, including the private receipt delivery argument. Acknowledgement digest:8f78f7fb8c4ceddfb361a2de5afdc348abfcf3d6d6dcd3041cdbbef49ceb5e73.Changed checks passed formatting, core and extension production/test typechecks, plugin and graph boundaries, Doctor contracts, and the remaining repository guards. The check runner stopped on S3 lint errors; those were corrected separately, and all 22 then-changed code files passed canonical scoped type-aware lint. The three code files in the final refinement also passed that lint. Knip was run separately on the branch and reported four inherited exports in files unchanged from the measured S1 base:
bindCliQuestionAnswerAuthority,prepareSessionEventTargetForHost,readSessionEntryCreationTransition, andRESTART_CONTINUATION_CONTEXT_PREFIX. S3's unused declaration was removed; no ignore or baseline exception was added. Source inspection of currentmain(a79e29ec04fc) confirms those four inherited exports have since been removed or made private. This is not a claim that the entire check runner exited green.Fresh integrated and follow-up Codex autoreviews were scoped-clean through P2. The final empty-confirmation refinement passed 42 tests across the admission and plugin-state suites (81.63 s including worker preparation; Vitest 12.54 s). Its native MessagePort regression failed before the fix on the extra commit frame and passed afterward; the case took 321 ms. The final delta review was scoped-clean through P1. Focused command:
pnpm test src/infra/sqlite-worker-operation-admission.test.ts src/plugin-state/plugin-state-publication.test.ts --maxWorkers=1.Seven alternating ordinary-workload pairs ran on the same host with Node 26.10.0, pinned to
da67a08b20eb→ finaldb5967493a14. Every workload assertion and classifier conservation check passed. The rebuilt baseline retained the identical source-map digest. Values below are per-phase medians; warmed values are the median of each run's ten-turn average. ALL includes memory and disk SQL on every thread. All 14 successful samples in this cohort are included, with memory-validation statements counted.Accepted statement-gate exception: the +18 first-turn statements (+0.679%) exceed the original 0.5% allowance, and boot + connect + first-turn rises from 5,237 to 5,253. Duration ratios are valid. The warm +0.6 and non-turn increases fit their numeric allowances. The maintainer explicitly accepted this first-turn cost on 2026-10-09 because these receipts enable the follow-up removal of approximately 230 freshness probes per turn; the measured values are unchanged.
The largest identified first-turn difference is one 34-statement in-memory canonical-schema comparison batch in
session-entry-list; it appears in baseline too, at different phases. Its reader/schema producers are unchanged. The retained sender stack does not establish the initiating caller, so no deferred-startup exception is claimed. Across all seven pairs, each first turn has at most one plugin-state sweep, and every observed sweep is empty. There are no warmed sweeps or binding/catalog mutations. The binding reads remain non-mutating. The final empty-sweep transport regression proves no added early commit frame. Requests above are logical requests, not complete wire-frame counts.Affected-operation measurements use
4194516df62e, whose SQL and nonempty receipt paths are unchanged in the final source; they appear below. Across the seven ordinary runs per side, median BEGIN attempts were 1,711 → 1,712 and COMMIT attempts 1,703 → 1,704. Median native-call elapsed upper bounds were 15.208 → 15.073 ms for BEGIN and 480.865 → 449.142 ms for COMMIT. These measurements include failed attempts and are not isolated lock-wait time. BUSY failures were base[0,3,1,1,0,0,2], candidate[1,0,1,1,3,0,1]; no LOCKED failures. One baseline shutdown refusal was audit pruning, most others were startup lease release, and two first-turn sites remain unclassified. No restart-intent refusal was observed in this cohort.Observed ordinary-workload message counts
Ordinary census excludes native-commit/native-settlement; these are not complete wire-frame counts.
Published
2026.9.8driver × final candidatedcddc8804b56: passed in Testbox run 37964571179. All 19 phases passed (288 s cell; 413 s package preparation). The real update completed, replaced the managed process, and returned readiness 200. Durable session identity/content and orphan sidecar bytes survived; incognito content disappeared without disk artifacts. Synthetic isolated state; no external channel or inference claim. The lease was stopped and verified complete. No schema, stored-byte, or update-format change is introduced.Earlier ordinary baseline samples failed
mentions.dismisswithUNAVAILABLE. A separate diagnostic foundMention authority changed before commit; later successful samples do not prove that timing-sensitive baseline issue fixed. Failed and diagnostic samples are excluded from the paired cohort, with harness assertions unchanged. An earlier affected-flow cohort was also rejected for duration skew. An intermediate five-pair ordinary cohort at4194516df62ehad valid durations but failed the non-turn allowance (cron +243, compaction +44); its positive request groups came from unchanged owners. The final-head cohort is reported above. Run-to-run count differences are not claimed query savings.Final LOC versus integrated main: production +1,124 / -94; tests and test support +1,050 / -3; documentation +42; regenerated inventory +62 / -63. Focused local test costs and final CI outcomes are reported below.
Affected-operation measurements
Three alternating pairs on the same host, 30 samples per flow, measured
da67a08b20eb→4194516df62e. The final delta preserves these SQL paths and nonempty receipt delivery.native-clearandworker-clearinclude two registrations followed by clear; claim/consume includes both operations. Native binding expiry includes the expiry setup write plus resolution; worker binding expiry measures the lookup/removal after setup. Fractional SQL counts are scheduled WAL checkpoints, not extra logical queries. Worker flows retain zero MAIN SQL.Logical database requests are unchanged. Actual mutations add a private native-commit notification containing the facts; existing native-settlement messages remain separate. Empty plugin-state receipts in the final code use settlement only, proved by the native MessagePort regression.
Across the 11 operation phases, both sides executed 540 BEGIN and 540 COMMIT attempts per run. Median native-call elapsed upper bounds were 8.420 → 7.063 ms for BEGIN and 375.889 → 274.868 ms for COMMIT. No BUSY/LOCKED failures were observed here. These are elapsed native-call measurements, not isolated lock-wait time.
Landing integration
Main integration preserves the newer ClickClack ownership from #167571: worker-backed preparation, a channel-to-session ownership map, and direct persisted discussion-target validation. The obsolete discussion reverse index stays removed. The S3 regression still checks replacement, deletion, and clear followed by replacement through routing and tool policy. The receipt paths merged without conflicts; the existing paired SQL evidence is reused under the approved exception.
Released SDK reachability was checked against
v2026.10.1-beta.1and stablev2026.9.9: the changedupsertConversationIdentitiesreturn type, optional private receipt-delivery argument, and publication types are internal. Public plugin-state factories and session-runtime signatures remain unchanged; no deprecation adapter or public type-test change is needed.Integrated P2 autoreview raised one future-composition limitation at
src/infra/outbound/current-conversation-bindings.publication.ts:161: a capture would retain changes if a future callback caught a nested savepoint rollback. Current production callbacks (bind/remove/list-prune/resolve/touch incurrent-conversation-bindings.worker.ts) neither open nor catch a nested write transaction. Errors escape before receipt construction and roll back the outer write. This is recorded as a follow-up before adding that composition, not an observed defect in current callers; no accepted P0/P1 finding remains.Integration proof: core production types passed (34.05 s), core test types passed (457.43 s), extension production types passed (51.80 s), extension test types passed (41.56 s).
pnpm test extensions/clickclack/src/discussions/service-state-persistence.test.ts extensions/clickclack/src/discussions/tool-policy.test.ts test/scripts/runtime-process-build-graph.test.ts src/auto-reply/reply/get-reply.imports.test.ts --maxWorkers=1passed 43 tests in 593.54 s wall time, including worker compilation. PR wrapper inventory passed (1 selected test, 44.80 s wall). These are local wall times; current-head hosted CI runtime will be recorded after completion.Landing commits:
3385d4dddc6989e3f48704c3a525626f3c23204fintegrates main to resolve the ClickClack/documentation conflicts;a8f9c929f6997b7489cf0c87cb4f96f068d8ef1afixes a PR-caused type-import cycle found by the post-integration Madge check. The publisher now derives its private row alias directly from the canonical generated schema. The fix changes no runtime code or SQL. Core types and formatting pass, Madge now reports zero cycles, and the narrow P2 autoreview is scoped-clean. The earlier full-diff P2 future-composition limitation remains recorded above.CI on
a8f9c929f699failedcheck-docsandcheck-lintbecause the conflict resolution omitted one blank line between the receipt and foreign-observation documentation sections.dcddc8804b567b8b6d250d9da82143f45330dfcfadds that blank line; formatting across all 24 changed files now passes. This is a PR-caused formatting fix, not an inherited-failure exception. Runtime proof fora8f9c929f699is unchanged by this Markdown-only delta.Inherited CI exception
Final-head CI 37963878137 failed only
checks-node-changed-compact-small-5and its aggregate gate. Twosession-accessor.recovery.test.tscases close the database from inside the retained recovery writer callback; the development-only cleanup guard introduced on main by47e36b43821a(#167662) rejects that fixture context. The test, transcript-worker resource, agent resource, agent write-admission state, and shared writer-queue files are byte-identical between CI baseline3e5d536280fd, final PR headdcddc8804b56, and tested merge6b7df8a8341a. S3 leaves recovery receipt delivery on its existing default commit path. This is independently attributed to unchanged main code; the maintainer-authorized inherited-failure exception applies. No test rerun or weakened assertion is used. All other selected categories passed, including formatting, lint, types, package boundaries, and security-fast.Landing uses the explicitly authorized head-pinned REST squash fallback after native review/worktree and lock handling spent over 30 minutes under filesystem contention. The final head is
dcddc8804b567b8b6d250d9da82143f45330dfcf; ClawSweeper completed that exact head with zero findings at 2026-10-09T17:13:35Z. Security-fast, dependency review, security-sensitive review, focused proof, and the published-driver update cell passed. The sole CI exception is the independently attributed inherited recovery-fixture failure documented above.