Repository navigation
fix(sqlite): preserve settlement after writer admission errors - #169113
Conversation
Use the existing current-preimage actor contract for input and terminal bookkeeping while retaining domain predicates and live authority. Prevent rejected writer preparation from leaking mutation depth. Preserve concurrent input, lifecycle, writer, and model-selection guards with regression coverage.
|
🦞👀 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 changesThis PR increments native mutation depth only after SQLite writer discovery succeeds. Example: Writer discovery rejects INSERT INTO proof VALUES (1), then INSERT INTO proof VALUES (2) succeeds.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it repairs a current-main settlement defect with a focused regression, and no actionable correctness or security findings remain; current-head CI still requires native landing handling. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe native SQLite observer brackets database statements and publishes settled write revisions that invalidate reader caches. flowchart TD
A[Database caller] --> B[Native statement observer]
B --> C[Writer discovery]
C --> D[Mutation accounting]
D --> E[SQLite execution]
E --> F[Statement settlement]
F --> G[Reader cache receipts]
Technical reviewBest possible solution: Retain the exception-safe ordering repair and cold-discovery regression within the existing receipt owner. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the leaked increment, and the revised native regression reaches that boundary with reported before-and-after failure evidence. Is this the best way to solve the issue? Moving the increment after discovery restores exception-safe accounting at its producer without additional coordination or changes to transaction and cursor settlement. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4f4741bfe2b6. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +1, Tests +29, Docs +2. Total +32 across 3 files. Added test files: 0. 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 11, 2026, 10:57 AM ET / 14:57 UTC (Revision 5). |
Merge current main and retain its actor admission recovery. Narrow this lane to the independent native mutation-depth leak, its regression and documentation.
Merge current main. Replace the retired registration-failure fixture with cold-handle discovery through the existing admission exchange. Verify the rejected insert has no effect and the next committed write advances its sibling receipt.
Merge the landed Solid export cleanup required by the static gate. The native settlement fix and its regression are unchanged.
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…claw#169113) Use the existing current-preimage actor contract for input and terminal bookkeeping while retaining domain predicates and live authority. Prevent rejected writer preparation from leaking mutation depth. Preserve concurrent input, lifecycle, writer, and model-selection guards with regression coverage.
First-parent upstream 19fe879..0bc7491 (100 commits, including openclaw#169090 entry-writer postimages, openclaw#169201 transcript projection facts, openclaw#169113/openclaw#169107/openclaw#169125 session-actor admission, openclaw#169110 bounded worker heaps, openclaw#169130 inter-session provenance, openclaw#168931 Solid session UI). Conflicts: - session-accessor.sqlite-entry-mutation.ts: openclaw#169090 moved postimage publication into writeSessionEntry and replaced the revision-equality no-op check with postimages.changed. Took upstream's form; kept our recipient-authority advance on visibility narrowing (same transaction, after the write, before the no-op return). - session-accessor.sqlite-entry-store.ts: import union (upstream dropped withProjectedParticipants/SessionEntryWindowFacts imports; ours adds the recipient-authority advance). Overlay vs upstream is now 2 lines. - openclaw-tools.types.ts: import union (our RequestCompactionToolOpts, upstream's SessionsYieldRuntimeClaim). - plugin-sdk-surface-report.mts: upstream raised the budgets to 3672/2133; ours stays +11/+4 on top (3683/2137). - worker-access-inventory.md: regenerated on the merged tree. Auto-merged files that carry continuation overlay (21) keep the overlay byte-for-byte (interdiff of the +/- lines vs upstream before and after). Refs #1475 Co-Authored-By: Claude Opus 5.5 <[email protected]>
What Problem This Solves
A cold writable connection can throw while discovering its physical database admission. Native mutation depth was incremented before that fallible step, leaving no native operation to decrement it. Later writes commit without publishing their receipt revision, leaving cached rows stale.
User Impact
A rejected writer discovery no longer prevents subsequent committed writes from invalidating cached rows. Active native writes and explicit transactions retain their settlement behavior.
Why This Change Was Made
Increment mutation depth only after writer discovery succeeds. Production TypeScript: +1 net line, the ordering comment; three changed files. No schema, protocol, configuration, dependency, or update migration change.
Main removed writer registration in #168859, so the original test's registration-publication fault stopped being reachable. The revised regression opens a cold writable handle before a sibling admits the file, refuses discovery through the existing exchange hook, proves the rejected insert had no effect, then requires the next committed insert to advance the sibling receipt.
The separate actor stale-version repair from #169107 is included through main; this PR does not replace it.
Evidence
loadSubagentMaintenanceCandidatesInDatabase (store)namespace export on current main (4f4741bfe2b6); no suppression added.Release-note context: preserve database receipt invalidation after writer discovery fails before native execution.
Post-merge live verification
The exact landed revision
5da9eae07c5a6c79eac2ccf0e930c18cd3052d3fran six concurrent local sessions for 902.7 seconds: 935/936 exact replies with successful completion. One turn failed withSession actor changed while hydrating; the next turn and all later cycles recovered. The earlierAgent database execution admission is closedfailure did not recur. The actor owner follow-up is recorded separately; the 30-minute three-route soak was skipped because the accelerated run was not clean.