Repository navigation
fix(infra): release completed SQLite readers and prevent cursor restarts - #190242
Conversation
Finish and return native iterators once, answer later terminal calls in the observer, and retire unused iterator capability probing and transport. Prove WAL checkpoint progress and successor-cursor preservation with real file-backed databases. Co-authored-by: ava-perry <[email protected]>
|
🦞👀 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 releases completed SQLite readers, prevents later iterator calls from restarting or rewinding queries, and removes unused capability probing. Example: On Node 24.18.0, exhaust a two-row SELECT, call next() again, insert row 3, and checkpoint the WAL.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR addresses a concrete SQLite cursor defect still present on main and completes the obsolete-probe cutover; no introduced correctness bug was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherOpenClaw's database-opening owner installs the native observer, which translates SQLite statement execution into cursor custody and schema-lifecycle updates. flowchart TD
A[Database caller] --> B[OpenClaw database owner]
B --> C[Native operation observer]
C --> D[Statement iterator]
D --> E[Node SQLite binding]
E --> F[SQLite WAL]
C --> G[Execution custody]
Technical reviewBest possible solution: Keep completion handling in the existing observer while preserving native-library admission and unfinished-cursor custody. Do we have a high-confidence way to reproduce the issue? Current-main forwarding and the native implementation establish the failure path, corroborated by reported base-failing file-backed regressions; this read-only review executed no target code. Is this the best way to solve the issue? The patch fixes completion at its existing owner, removes superseded machinery, and retains separate native-library safety and identity checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8a5b7d506413. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -48, Tests +18, Docs +4, Other +2. Total -24 across 8 files. Added test files: 0. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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 Reviewed November 1, 2026, 5:52 AM ET / 10:52 UTC. |
|
Merged via squash auto-merge.
|
#190242 left assertSafeSqliteRuntime exported with no consumer outside its module, failing the deadcode:exports gate on main. Co-authored-by: vyctorbrzezowski <[email protected]>
…CK, cron receipt) (#190276) * test(auto-reply): stop expecting the retired session channel field #190213 stopped the fast reply initializer from writing the retired channel field, but the native slash fast-path test still seeded and expected it, keeping main CI red. Assert the initialization without the retired field and that new state omits it. Co-authored-by: vyctorbrzezowski <[email protected]> * test(auto-reply): stop expecting the retired session channel field Worked on by: - @vyctorbrzezowski Co-authored-by: vyctorbrzezowski <[email protected]> OpenClaw-Publication: 3f2d12c9-3b58-4138-8561-cb7952f2cdfe * fix(infra): keep the SQLite runtime safety check module-private #190242 left assertSafeSqliteRuntime exported with no consumer outside its module, failing the deadcode:exports gate on main. Co-authored-by: vyctorbrzezowski <[email protected]> * Publish openclaw/mellow-crab Worked on by: - @vyctorbrzezowski Co-authored-by: vyctorbrzezowski <[email protected]> OpenClaw-Publication: 00c16b2f-1db1-444f-acba-f3e2049e6b05 * test(gateway): stop requiring messageSeq in the committed-mention ACK chat.send includes messageSeq only once the transcript recorder has attested placement, which can complete after the ACK. The committed mention test asserted it unconditionally and failed intermittently on main; the mention delivery and replay assertions are unchanged. Co-authored-by: vyctorbrzezowski <[email protected]> * test(cron): wait for the cancelled run receipt to settle A cancelled isolated run keeps its receipt running, with the error recorded, until execution settles (#189469). That settle write can land after waitForManualRun resolves, so poll the receipt instead of reading it once. Co-authored-by: vyctorbrzezowski <[email protected]> * Publish openclaw/mellow-crab Worked on by: - @vyctorbrzezowski Co-authored-by: vyctorbrzezowski <[email protected]> OpenClaw-Publication: f306e74f-b8fd-4268-82c9-22f5947f7610 --------- Co-authored-by: vyctorbrzezowski <[email protected]>
…rts (openclaw#190242) Finish and return native iterators once, answer later terminal calls in the observer, and retire unused iterator capability probing and transport. Prove WAL checkpoint progress and successor-cursor preservation with real file-backed databases. Co-authored-by: ava-perry <[email protected]>
…CK, cron receipt) (openclaw#190276) * test(auto-reply): stop expecting the retired session channel field openclaw#190213 stopped the fast reply initializer from writing the retired channel field, but the native slash fast-path test still seeded and expected it, keeping main CI red. Assert the initialization without the retired field and that new state omits it. Co-authored-by: vyctorbrzezowski <[email protected]> * test(auto-reply): stop expecting the retired session channel field Worked on by: - @vyctorbrzezowski Co-authored-by: vyctorbrzezowski <[email protected]> OpenClaw-Publication: 3f2d12c9-3b58-4138-8561-cb7952f2cdfe * fix(infra): keep the SQLite runtime safety check module-private openclaw#190242 left assertSafeSqliteRuntime exported with no consumer outside its module, failing the deadcode:exports gate on main. Co-authored-by: vyctorbrzezowski <[email protected]> * Publish openclaw/mellow-crab Worked on by: - @vyctorbrzezowski Co-authored-by: vyctorbrzezowski <[email protected]> OpenClaw-Publication: 00c16b2f-1db1-444f-acba-f3e2049e6b05 * test(gateway): stop requiring messageSeq in the committed-mention ACK chat.send includes messageSeq only once the transcript recorder has attested placement, which can complete after the ACK. The committed mention test asserted it unconditionally and failed intermittently on main; the mention delivery and replay assertions are unchanged. Co-authored-by: vyctorbrzezowski <[email protected]> * test(cron): wait for the cancelled run receipt to settle A cancelled isolated run keeps its receipt running, with the error recorded, until execution settles (openclaw#189469). That settle write can land after waitForManualRun resolves, so poll the receipt instead of reading it once. Co-authored-by: vyctorbrzezowski <[email protected]> * Publish openclaw/mellow-crab Worked on by: - @vyctorbrzezowski Co-authored-by: vyctorbrzezowski <[email protected]> OpenClaw-Publication: f306e74f-b8fd-4268-82c9-22f5947f7610 --------- Co-authored-by: vyctorbrzezowski <[email protected]>
…rts (#190242) Finish and return native iterators once, keep later terminal calls in the observer, and remove unused iterator capability probing and transport. Prove WAL checkpoint progress and successor-cursor preservation. Release adaptation: retain runtime admission in node-sqlite.ts instead of introducing the newer sqlite-native-runtime.ts split. Preserve release native lifecycle, safety-floor and worker contracts; adapt admission and schema fixtures. Allocate exactly 29 net regression-test lines. Companions: 1c437d1 (#190303) runtime assertion privacy is already present. 40101a9 (#190276) has no remaining applicable SQLite change. 5954594 (#193710) certificate warnings are unrelated; e333f7e (#197657) retires main-only test grants and is not needed for this fix. Proof: 91 targeted tests passed across native observer, node SQLite and schema metadata; formatting and diff checks passed. (cherry picked from commit 2c0ab86) Co-authored-by: ava-perry <[email protected]> Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vincentkoc <[email protected]>
Preserve the existing 2026.11.5 beta line and its pending test repairs. Repair transcript admission, terminal SQLite iterators, binary attachment classification, detached lifecycle calls, cron late wakes and reload handover. Carry the explicitly requested Bonjour package-integrity fix and release guidance. Selected backports: #188055, #198309, #190242, #198860, #198011, #197658, #197484, #197606. #198011 is the operator-required open PR head, not a merged-main claim. Cron tests are adapted to the existing beta runtime. (cherry picked from commit e3064bf) (cherry picked from commit afa871c) (cherry picked from commit 2c0ab86) (cherry picked from commit fee19a9) (cherry picked from commit dbb6f39) (cherry picked from commit 4d9f782) (cherry picked from commit 87c10f5) (cherry picked from commit ce76ed2) Proof: frozen parent suite passed all 7 shards (265 tests) in 274.45s. Separate unchanged-production baseline reproduced transcript/lifecycle, late-wake and live-receipt failures. SQLite already passed on Node 26.12.1. Independent review found no actionable P0/P1 defects in this snapshot. The complete beta.4 candidate and stable-profile FRV remain pending. Co-authored-by: jalehman <[email protected]> Co-authored-by: vincentkoc <[email protected]> Co-authored-by: Yun. <[email protected]> Co-authored-by: ava-perry <[email protected]> Co-authored-by: Alfred J Berchtold <[email protected]> Co-authored-by: Stronggenetics <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]> Co-authored-by: RomneyDa <[email protected]>
Supersedes #184076, thanks @ava-perry.
What Problem This Solves
Fixes WAL growth when a completed SQLite reader is stepped again on affected Node bindings; returning an old iterator can also rewind a newer reader using the same statement.
User Impact
Completed readers release their snapshots, checkpoints can finish, and later iterator calls cannot restart queries or disturb successor readers. No configuration, schema, or migration changes are required.
Why This Change Was Made
The existing SQLite observer now returns native iterators on exhaustion and remembers completion after either exhaustion or explicit return. Repeated calls receive a terminal result. Remove the superseded iterator capability experiment and its private worker-admission fields together; retain the loaded-library safety and identity query using one
get().Simplification pass: production −48 lines, tests +18 net lines against
a11289439ae9. The removed probe/transport pays for the terminal-state handling. The separate 18-line regression allocation covers real WAL checkpoint progress and preservation of a successor cursor after stale calls, after subtracting obsolete probe fixtures.Evidence
Base
a11289439ae9940e6487c82ef439af80da180571, Node 24.18.0 / SQLite 3.53.1: new real temp-directory database regressions fail. After exhaustion and anothernext(), PASSIVE checkpoints only 3 of 4 frames; after explicit return, a stale return rewinds the successor and yields row 1 twice.Fixed branch on Node 24.18.0: observer + native runtime suites 79 tests passed, 5.00s total wrapper wall time. WAL fully checkpoints and TRUNCATE returns
{busy: 0, log: 0}; the successor yields the remaining rows exactly once.Node 26.12.1:
OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs run src/infra/sqlite-native-observer.test.ts src/infra/node-sqlite.test.ts src/state/openclaw-schema-metadata.test.ts src/infra/sqlite-schema-facts.native.test.ts --maxWorkers=1— 148 passed, 44.12s wall time including the initial worker build. Test execution remains under five seconds per file. Exact-head PR CI passed, including all three PostgreSQL shards andopenclaw/ci-gate; elapsed 1460 seconds including setup and all jobs.Focused TypeScript compilation of the six changed TS files plus canonical ambient declarations, targeted oxlint, oxfmt, and
git diff --checkpass. No references to the retired probe or iterator flags remain insrc.Shared autoreview, local candidate against
a11289439ae9, Codex GPT-6.1 Sol, P0–P2: scoped-clean, no findings. It reviewed the supplied complete diff and native Node source; unchanged repository context was unavailable and it did not rerun tests. Subsequent changes only remove an unused type import and record the test allocation.Contributor source was read through
gh pr view/gh pr diff; it was never checked out or executed. This is an independently implemented, credited replacement. Production Team services were not modified.Hosted ClawSweeper review, exact head
1dd1097bd13e: complete, no actionable findings. It records the same full-Gateway proof limitation.