Skip to content

perf(state): carry admitted schema facts with database handles instead of re-querying per call - #164490

Merged
steipete merged 11 commits into
mainfrom
dbasync/schemafacts
Oct 4, 2026
Merged

steipete merged 11 commits into
mainfrom
dbasync/schemafacts

Conversation

@steipete

@steipete steipete commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Warm agent and shared-state reads repeatedly execute schema freshness probes through already-admitted handles. Canonical main-key admission also rereads the same policy row; SQLite data_version alone cannot invalidate that value after a same-connection write.

Why This Change Was Made

Carry the existing connection-owned schema facts through runtime checks. Read admission and transaction entry after BEGIN own freshness, inside rollback protection. Nested checks share the operation's probe; explicit fresh reads still execute. Agent open/admission verifies canonical invalidation schema before exposing the handle. Shared-state cache admission owns initial schema facts, cached refresh, and terminal failure handling; ordinary runtime checks consume those admitted facts.

The existing canonical reader admission now retains its main-key value, keyed by schema facts, observed foreign-commit version, and a connection-owned mutation revision. The native connection owner observes local mutating SQL, including raw batches, CTEs, prepared statements, and indirect triggers. Active mutations, suspended RETURNING iterators, explicit transactions, pinned snapshots, and dynamic authorizers bypass policy reuse. An explicit fresh probe that observes a foreign commit also prevents an older enclosing read scope from serving stale policy. Continuation authority stays with canonical admission.

DDL, rollback, snapshot, authorizer, close, and physical replacement invalidation remain with the existing owners. Foreign commits still compare schema and user versions: a user_version-only migration cannot be distinguished from a data commit by data_version alone. Ordinary commits retain schema facts. Boot/Doctor/migration integrity and canonical-index work remains with admission and migration owners. Unmanaged connections retain their native inspection contract.

The policy writer audit covers the startup/Doctor setter, schema bootstrap, generic STRICT migration copies, canonical-ready receipts, and backup/update replacement. Raw writes remain supported through the tracked native owner and invalidate; setter-only invalidation would have missed existing callers. The policy add-on is +86/-2 (88 changed production lines).

User Impact

The identical local workload reduces warmed main-thread SQL from 638.8 to 524.6 statements per turn (-17.9%). All seven named schema sites and the canonical projection schema probes execute zero statements during warmed turns. Main-key policy reads fall from 44 to 22 per turn, with transaction/snapshot and current-policy reads preserved.

No schema version, stored format, retention, durability, worker service, configuration option, or environment name is added. The published-driver update cell passed on prior head 395e837; proof is being refreshed for the integrated candidate below. Drifted-schema refusal remains covered by the admission and foreign-process regressions.

Evidence

At measured head 5077cb423a98b35debc2bf8b639a88f3eb42a6db, production diff against the pinned measurement baseline: +203/-77/net +126 across 14 production files; four test files and one documentation file also change. There are zero new OPENCLAW_* names.

Full identical synthetic Gateway workload: pinned origin/main at 4df9a0636badcaf63c362072a6f8d10a4a90eb6b → 5077cb423a98b35debc2bf8b639a88f3eb42a6db. Both used Node 24.21.0, SQLite 3.53.4, source-map qaRuntime builds, isolated state/ports, and byte-identical harness/observer files. Only the original harness’s temporary path and head metadata were made portable.

Warmed main-thread SQL: 638.8 → 524.6 statements/turn (-114.2; -17.9%). Whole-workload main-thread statements: 14,480 → 12,708.

Counts are successful top-level native SQLite executions, excluding prepare(). Phase totals include concurrent maintenance in that execution window; elapsed times are not a performance benchmark. Named sites follow the historical functions; the logical-owner count additionally includes semantic schema-facts probes at relocated admission/transaction callers and canonical-validation schema work. Generic SQL execution wrappers are excluded. Logical and named columns overlap and must not be added together.

Steady-turn means

Metric Before After Delta
Overall main-thread SQL 638.8 524.6 -114.2
Seven named sites 123.0 0.0 -123.0
Logical schema-facts owner 223.0 131.6 -91.4
Canonical projection/schema freshness 55.0 0.0 -55.0
Canonical main-key policy 44.0 22.0 -22.0

Per phase — before → after

Phase Overall Named sites Logical owner Canonical schema Main-key policy
Boot to ready 2,962 → 2,917 1,716 → 1,581 1,747 → 1,702 0 → 0 0 → 0
Connect / settling 46 → 42 19 → 0 19 → 19 0 → 0 0 → 0
New session + first turn 1,915 → 1,817 750 → 575 898 → 799 68 → 0 51 → 33
Ten warmed turns 6,388 → 5,246 1,230 → 0 2,230 → 1,316 550 → 0 440 → 220
Second session + parent + child 1,879 → 1,577 358 → 0 661 → 423 177 → 0 130 → 75
List / history / Inbox / dismiss 2 → 0 2 → 0 2 → 0 0 → 0 0 → 0
Scheduled cron 609 → 492 127 → 0 175 → 108 34 → 0 19 → 10
Manual compaction 351 → 340 17 → 0 29 → 21 8 → 3 5 → 2
Graceful shutdown 328 → 277 64 → 0 73 → 22 0 → 0 0 → 0
Total 14,480 → 12,708 4,283 → 2,156 5,834 → 4,410 837 → 3 645 → 340

Each warmed turn — before → after

Turn Overall Named sites Logical owner Canonical schema Main-key policy
01 637 → 526 122 → 0 222 → 133 55 → 0 44 → 22
02 639 → 526 124 → 0 224 → 133 55 → 0 44 → 22
03 637 → 524 122 → 0 222 → 131 55 → 0 44 → 22
04 637 → 524 122 → 0 222 → 131 55 → 0 44 → 22
05 637 → 524 122 → 0 222 → 131 55 → 0 44 → 22
06 639 → 524 124 → 0 224 → 131 55 → 0 44 → 22
07 647 → 524 124 → 0 224 → 131 55 → 0 44 → 22
08 637 → 526 122 → 0 222 → 133 55 → 0 44 → 22
09 639 → 524 124 → 0 224 → 131 55 → 0 44 → 22
10 639 → 524 124 → 0 224 → 131 55 → 0 44 → 22
Seven named sites: per-phase and per-turn counts
Site Historical measured owner
A openclaw-agent-db-schema-read.ts:22 — supported agent schema
B openclaw-agent-canonical-validation-schema.ts:70 — canonical validation schema
C openclaw-state-db-runtime-failure.ts:58 — former success-path runtime validation
D openclaw-state-db-schema-helpers.ts:51 — admitted table facts
E openclaw-state-db-schema-runtime.ts:159 — STRICT migration
F openclaw-state-db-schema-runtime.ts:173 — shared-state canonical indexes
G openclaw-agent-db-schema.ts:145 — agent canonical indexes

Per phase, before → after:

Phase A B C D E F G
Boot to ready 0 → 0 0 → 0 91 → 0 44 → 0 850 → 850 731 → 731 0 → 0
Connect / settling 0 → 0 0 → 0 17 → 0 2 → 0 0 → 0 0 → 0 0 → 0
New session + first turn 87 → 3 25 → 0 45 → 0 27 → 6 0 → 0 0 → 0 566 → 566
Ten warmed turns 758 → 0 200 → 0 152 → 0 120 → 0 0 → 0 0 → 0 0 → 0
Second session + parent + child 222 → 0 57 → 0 50 → 0 29 → 0 0 → 0 0 → 0 0 → 0
List / history / Inbox / dismiss 0 → 0 0 → 0 1 → 0 1 → 0 0 → 0 0 → 0 0 → 0
Scheduled cron 27 → 0 16 → 0 49 → 0 35 → 0 0 → 0 0 → 0 0 → 0
Manual compaction 11 → 0 0 → 0 5 → 0 1 → 0 0 → 0 0 → 0 0 → 0
Graceful shutdown 0 → 0 0 → 0 13 → 0 51 → 0 0 → 0 0 → 0 0 → 0
Total 1,105 → 3 298 → 0 423 → 0 310 → 6 850 → 850 731 → 731 566 → 566

Each warmed turn, before → after:

Turn A B C D E F G
01 75 → 0 20 → 0 15 → 0 12 → 0 0 → 0 0 → 0 0 → 0
02 75 → 0 20 → 0 17 → 0 12 → 0 0 → 0 0 → 0 0 → 0
03 75 → 0 20 → 0 15 → 0 12 → 0 0 → 0 0 → 0 0 → 0
04 75 → 0 20 → 0 15 → 0 12 → 0 0 → 0 0 → 0 0 → 0
05 75 → 0 20 → 0 15 → 0 12 → 0 0 → 0 0 → 0 0 → 0
06 77 → 0 20 → 0 15 → 0 12 → 0 0 → 0 0 → 0 0 → 0
07 77 → 0 20 → 0 15 → 0 12 → 0 0 → 0 0 → 0 0 → 0
08 75 → 0 20 → 0 15 → 0 12 → 0 0 → 0 0 → 0 0 → 0
09 77 → 0 20 → 0 15 → 0 12 → 0 0 → 0 0 → 0 0 → 0
10 77 → 0 20 → 0 15 → 0 12 → 0 0 → 0 0 → 0 0 → 0
Mean 75.8 → 0.0 20.0 → 0.0 15.2 → 0.0 12.0 → 0.0 0.0 → 0.0 0.0 → 0.0 0.0 → 0.0

T1 inventory with the same candidate classifier: 1,198 → 1,198 sites, 316 → 316 files. check-database-worker-ratchet passed against 4df9a0636badcaf63c362072a6f8d10a4a90eb6b. T1 counts five named static primitives, so it does not measure the removed native PRAGMA executions.

Both runs completed all 13 top-level turns, the real child turn, the scheduled cron with status=ok, committed compaction, and shutdown [0, null]. All recorded RPCs succeeded; Inbox dismissal was the original empty-Inbox no-op. All resolved database paths stayed inside each synthetic fixture. Main-thread failed execution attempts: 0 → 0. All observed task-owned process IDs were checked after shutdown and had exited.

The candidate includes the pinned baseline commit, so the measured source difference is this PR. The older historical 546-statement result is not used as the comparison baseline. Full build, full changed checks, released-SDK comparison, and the published-driver update cell are separate gates and are not implied by this measurement.

Retained work and caller classification

The remaining 22 main-key policy reads per warmed turn are not claimed as removed:

Caller/path Reads/turn Retained boundary
applySessionEntryPatchInDatabase 7 Immediate write transactions; policy caching deliberately excludes transactions.
loadReplySessionInitializationEntries 3 Deferred read transactions used for reply initialization.
readSessionEntryStore during lifecycle maintenance 1 Inventory inside the lifecycle write transaction.
readSessionEntrySelectionSnapshot 3 Materialized pre-write selection/planning.
Ordinary exact-entry read-admission paths 8 One each in dispatch configuration, session-diff baseline, sandbox classification, model auto-revert guard, worker-turn admission, live-model switch, session-entry refresh, and maintenance authority.

The first three groups account for 11 transaction/snapshot reads per turn. The other 11 are observed cache fills or uncached reads in planning/read-admission paths. The original observer records SQL and stacks, not each cache-eligibility predicate, so it cannot distinguish missing policy receipts from revision invalidation for every one of those reads; they are not all labeled “unadmitted.”

The retained 131.6 logical schema-facts statements per turn are 117 data_version probes plus 7.3 schema_version and 7.3 user_version rechecks. The version pairs run in the freshness owner's changed-data_version branch. Caller totals include relocated work:

Owner/boundary data_version/turn Schema-version/turn User-version/turn Total/turn
Agent readonly acquisition/retention (withOpenClawAgentDatabaseReadOnly, retainOpenClawAgentDatabaseReadOnly) 73 3.1 3.1 79.2
Session read scopes (scanSessionEntryRows, readExactSessionEntryRow, transcript watermark/read) 21 2 2 25
Shared-state getCachedOpenClawStateDatabase 11 2.2 2.2 15.4
Agent write-transaction admission and reply-initialization transaction entry 12 0 0 12
Total 117 7.3 7.3 131.6

The three canonical-projection executions in compaction are one schema-facts rebuild: PRAGMA schema_version, PRAGMA user_version, and the table catalogue query. Their stack is acceptCompactionSuccessor → loadSessionEntry → hasCanonicalSessionValidationProjection → the !owner.facts rebuild in getAdmittedSqliteSchemaFacts. This is one rebuild, not three repeated warmed checks; the warmed canonical-projection count is zero in all ten turns. The trace does not identify which preceding invalidation condition caused that rebuild.

The remaining native transaction and selection/planning work belongs to the agenttx/sessproj owners. Further policy reuse needs a proven invalidation contract; the conservative local mutation revision preserves raw and trigger-driven policy writes.

Focused regressions and review

All commands below use --maxWorkers=1 on the local host; times are wall time.

Focused command (pnpm test … --maxWorkers=1) Result Wall time
src/infra/sqlite-schema-facts.test.ts src/config/sessions/session-canonical-key-policy.test.ts 34 passed 20.51 s
src/config/sessions/session-canonical-key.test.ts src/config/sessions/session-canonical-reader-continuation.test.ts src/infra/sqlite-transaction.test.ts src/infra/sqlite-transaction.diagnostics.test.ts 81 passed 197.07 s
src/state/openclaw-agent-db-readonly-scope.test.ts src/state/openclaw-agent-canonical-validation-schema.test.ts src/state/openclaw-state-worker-error.test.ts 98 passed 118.44 s
test/scripts/runtime-process-build-graph.test.ts src/auto-reply/reply/get-reply.imports.test.ts src/state/openclaw-state.worker.imports.test.ts 13 passed 68.77 s

The new policy observer assertion fails against the actual pinned-base canonical reader with ten policy SELECTs versus the candidate's zero (negative control: 7.57 s). Tests cover setter/raw/CTE/prepared/trigger writes, native callbacks, suspended RETURNING iterators, partially failed batches, rollback, foreign commits, explicit fresh probes, snapshots, and authorizers. Existing continuation tests retain SQL-free capture/revalidation and current-authority revocation.

The schema observer proves ten repetitions of version, table-existence, and canonical-schema checks execute zero statements. The earlier owner negative control against the original PR base fc7e71ba produced exactly 30 PRAGMA data_version statements (10.75 s). The cold-open regression refuses a missing canonical trigger with Doctor guidance; its earlier opener negative control against that original base incorrectly admitted the database (307.86 s). Both candidate byte sets were restored before subsequent proof. The complete affected schema suite passed on the measured candidate.

Fresh isolated Codex autoreview against 4df9a0636badcaf63c362072a6f8d10a4a90eb6b: scoped-clean through P2, no accepted/actionable findings. Deslop required no change. Targeted formatting and git diff --check pass. CI seconds for newly selected tests are not available yet.

Required landing validation

Current candidate: 7a4b906b9c7696aa438bb784e785e6e3873f45d9, a clean merge with main 65829ead96bb115b69782e6357e8b619b3add8bf. It includes main's MCP capability fixture repair 42b9aee33a7b03442f4c5ce3f088fd5e7dcefaf0 and behavior-based spinner assertion from 65829ead…. Every PR-authored production, test, and documentation blob remains unchanged from 3dd800e; the wrapper inventory incorporates main's three new lifecycle helpers. The incoming lifecycle change releases opening callback captures after settlement while preserving per-operation database/caller authority and each queued writer's own async context. Fresh independent P2 review of the complete staged candidate against this main is scoped-clean. No new schema, durability, retention, permission, or environment-name policy is introduced by the schemafacts changes.

Final-head CI run 37182358825 passed: 96 successful jobs, 21 skipped, no failures or cancellations. ClawSweeper completed exact head 7a4b906b at 2026-10-04T06:23:37.338Z with no actionable code or security findings; its declared final validation is now complete. No CI rerun or inherited-failure admin exception is needed.

The exact-head Testbox campaign 37184045655 passed. Canonical full build/package completed in 467 seconds, including tarball integrity and import-graph validation. All nineteen complete regression/import files passed (266 tests across eight routed shards, --maxWorkers=1, 282.843 seconds); selected wrapper inventory passed in 3.776 seconds, and Madge found zero cycles in 28.177 seconds. The added coverage exercises incoming worker/queue lifecycle, Doctor lease/maintenance authority, and foreign-schema freshness.

The published 2026.9.8 driver updated to candidate 7a4b906b9c7696aa438bb784e785e6e3873f45d9 in 170.254 seconds, recorded durable finished/succeeded, and returned readiness HTTP 200. The connected serving Gateway and installed package both report build ID 2026.9.8-7a4b906b9c76-2026-10-04T06-54-57.874Z; matching package version alone was not used as proof. Candidate tree faaf0f7879c8ff09edfdfe14624f7cf94fb885fb was verified after a clean exact-SHA remote clone and frozen install. The immutable c13c486… bootstrap transport is separate from the tested candidate. Native execution exited 0, local cleanup settled, and the lease is stopped.

The released SDK comparison against v2026.9.8 passed on 3dd800efcbe10c585c17c1132725210c58169c6f (exit 0, 1,992.307 seconds; digest e18517df8df10249f8785d7da9f5b7bd76754c5d7eb5b05b9562b40062f78010). It reports one added/eight removed entrypoints and 2,316 affected exports, including main changes. The sole new direct-signature diagnostic versus cacd is the compatible resolveStorePath parameter-name change (options to opts) after main replaced a wrapper with an alias. The subsequent source audit through 65829ead finds no changed SDK entrypoint/public-runtime contract, manifest, lockfile, compiler config, or renderer owner, and no new released callable-contract change in the queue/lifecycle/LLM/Doctor updates. Public AsyncWorkScope, runQueuedStoreWrite, scheduler, and transcript-recorder signatures remain intact; the moved detached-context helper and async Doctor lease helper are internal. The report retains its actual 3dd head; conservative closure hashes are not claimed identical. The authored getter-only attribution and lack of a released callable removal remain unchanged.

The complete node scripts/check-changed.mjs --base 9aee9ad5… proof remains bound to e53258a (exit 0, 4,092.001 seconds). All authored production/test/docs inputs remain identical; hosted CI and focused new-head checks cover the integrated main inputs.

Historical CI run 37180677202 on 3dd800e completed with 92 successful jobs, 21 skipped jobs, two failed UI fixture jobs and their aggregate, with no cancellations. The full UI subtree and relevant harness/package inputs were identical between main dac9277… and tested merge 0fcd301…. One test pinned the old CSS animation name after main consolidated equivalent keyframes; the other passed an obsolete fourth capability-helper argument. Both main fixes are now integrated, so neither historical failure is used as an admin exception. Windows DTS passed after the earlier native import repair. The superseded 3dd update capture stopped before lease allocation or candidate execution.

Historical CI run 37176827180 on cacd9dca had two inherited failures: the preview fixture and native Node declaration-fixture import. Both full files reproduced the exact case five times on main 2e76e316… and five times on tested merge d346f7df… in paired Testbox run 37179139232. The DTS Linux replay was not Windows validation. Main's fixes 217efe0a… and 3c0f7e4c… are already integrated. No CI rerun was requested for these historical attempts.

Completed proof and failure qualification on e53258a

This section records e53258aa87414768fb7f48d481d4724273953332, a clean merge commit with main 9aee9ad5a3748836d5ffb43ab895f484b564d600. Main acquired the exact delivery-recovery fixture fix 1836ae2146443e952337bce1bccb41c524ea0639 while independent qualification was running, so that fix is integrated instead of using an inherited-failure exception. Every PR-authored production blob is unchanged by this merge. Main's wrapper inventory and table-driven schema test cleanup merged cleanly; this incidental cleanup overlap preserves the same contracts and assertions. Fresh isolated P2 review of the complete staged candidate against the merged main is scoped-clean, with no actionable findings.

The previous CI attempt 37168732287 had 93 successful jobs, 21 skipped jobs, one failed delivery-recovery job, and its derived gate. In paired Testbox run 37170646089, five complete single-worker runs on its exact main parent 5a8856d4 and five on tested merge 6956d790 reproduced the same five failures with 36 other cases passing each time. All ten full assertion blocks match. The fixture omitted the explicit queue-state environment after worker-backed pending-final settlement landed; main's fix adds it to fixture creation, reads, and replacements. The three recent scheduled-main runs supplied no matching failed-node annotations, which is not treated as passing proof. The comparison lease is stopped and its wrapper is settled. This qualification is historical; it is not an exception for the new candidate.

The two SDK commands completed successfully on e53258a. The release report has digest 66254a9725dca6ee0b60019f9a3105b80d2e0ed745708652772c8002438feb01; the main-attribution report has digest 2dac8683b81885ff0b5634c1cbea60540f297af7e41a1fba501c973a8fcc1a15. The attribution again finds 128 unchanged direct public signatures and only the internal-getter whole-module fallback delta. These reports retain their original head binding. No merge request is armed before the new candidate’s required proof completes.

The e53258a CI run 37172335178 tested merge d7a6bb06c522cb4289184666850cb8c6d14c9320 over main b02aaf1e3e0725e60772da600c1773b194f8f16c. All three failures are independently inherited. In Testbox comparison 37174195890, the complete ratchet CLI and both complete failing test files each reproduced their exact CI failure five times on main b02aaf1e and five times on tested merge d7a6bb06 (30 processes total). The ratchet fails before scanning PR code because its Git-reading helper uses the default 1 MiB output buffer for main's 1,675,312-byte baseline. Main added two negative type assertions without updating the inventory; that file has one failure and three passing cases every run. The preview file has the same missing last-message field and six passing cases every run. Its key-only backfill waiter can accept empty or rejected publications; that is a source-supported diagnosis, not a claimed repair. This path reaches changed database owners, so the paired proof was required despite unchanged immediate owners and fixture. Expected/received output matches CI; preview normalization removes only the RPC UUID and timestamp. Both paired revisions used Node 24.19.0 and frozen dependencies; CI was configured for 24.21.0. No timeout, unhandled error, extra failing case, or CI rerun occurred. The comparison lease is stopped. The three recent completed scheduled-main runs predate the new scanner and marker changes, so their results are not counted as passing evidence for this baseline. ClawSweeper completed this exact head at 2026-10-04T02:59:03.857Z with no actionable findings.

Passed validation before the latest main integration

The following proof was executed on 395e837b023866e540cd2c23f79f4eb85513ce58 unless another head is explicitly named. The final test-only correction carries the real private-input recorder through the existing consumption handshake and joins its accepted completion write before reading the timeout receipt. All producer, execution, lifecycle, and outcome assertions remain intact. The three timeout variants passed (565.26 seconds in Vitest; 695.83 seconds including worker compilation/verification), and fresh isolated P2 review is scoped-clean.

The only path changed from 9bd9115a3287a88aba5db15912e1bb4f05373c11 is src/gateway/server.private-completion.test.ts (+4/-3). Production, package, SDK and import inputs are unchanged. The full changed check passed on 9bd9115a…; the incremental changed check also passed for this correction. Final-head Madge reports zero cycles (188.175 seconds); the wrapper inventory passed (24.075 seconds), and all 13 tests across the three complete import/build-graph files passed (309.576 seconds). The required full build passed in 479.6 seconds in final-head Testbox run 37169789708. Both complete gateway files passed all 32 tests (81.234 seconds including runner setup, 79.24 seconds in Vitest). The published 2026.9.8 driver updated successfully to exact candidate 395e837b023866e540cd2c23f79f4eb85513ce58, recorded its durable successful outcome, and started the candidate Gateway with readiness HTTP 200 and verified build identity. The update took 172.329 seconds; remote execution and local wrapper cleanup both exited 0, and the lease is stopped. The full build emitted a nonfatal inherited UI gzip warning (374,319 bytes versus the 373,454-byte budget).

Current CI run 37168732287 tests merge 6956d79038988695ca7d9407dda6f081910a59e5 over main 5a8856d4c2f6419c1641b2b77eaa4022420ebee9. That main parent already contains Doctor's nested-diagnostic fix 54cfa2f8647c66fa34d72ad149a316caf8b8f6e4; the earlier Doctor failure qualification is historical, not an exception for this repaired merge tree. The earlier node-placement publication fix 2e33b81f2efa7d4b2a719640b58837fb02e1d814 was integrated by merge commit 9bd9115a….

The initial remote campaign could not obtain capacity; those attempts executed no candidate checks and their leases were stopped. The later published-driver cell and full build completed successfully on exact head 9376dad14cf0e74a246c18c001341577ae6b5d8a in Testbox run 37160723484. Published 2026.9.8 updated to this candidate, recorded finished/succeeded, and started the replacement Gateway with readiness HTTP 200 and verified candidate build identity. Full build took 497 seconds; update took 171 seconds. The lease is stopped. A UI gzip budget warning (+46 bytes) and post-proof portal-sync timeout were nonfatal; the proof wrapper exited 0.

Both released SDK commands completed successfully on 9bd9115a3287a88aba5db15912e1bb4f05373c11; their production/declaration inputs are byte-identical at the final test-only head. Release comparison against v2026.9.8 reports one added and eight removed entrypoints plus 2,314 affected exports, including existing main changes (digest fef6cd9472b7ae396ec22f6bedffacba212de5f7ca5e5728a809b6f3eb2ff5c3). Main-to-candidate attribution reports zero entrypoint additions/removals and 128 unchanged direct public signatures with differing conservative closure hashes (digest 4233d3cd88f3b1defbbaddb95e3cad2b806832fb325b0383138fbbbfcb0c084a). The sole declaration delta removes an internal cache getter.

The indexed typeof import in host-capability-types.ts causes whole-module fallback traversal. Following CommandOwnerReference by its actual named type exposes only version and id, not that module's unrelated database operations or the cache. The getter has no released SDK/API-runtime export; package exports provide no internal-state subpath or wildcard. The three additional gateway-dispatch diagnostic roots likewise expose response/error envelopes, not a cache object. No released callable signature changes; no compatibility boundary is needed. The SDK reports are retained as unchanged-input proof, not relabeled as a new run.

On head 9376dad14cf0e74a246c18c001341577ae6b5d8a, node scripts/check-changed.mjs --base 88415783fb415fb9db81b1014161d023c04ad400 passed, including all 27 test-type graphs, lint, dead exports, runtime cycles, and selected architecture guards. The wrapper inventory also passed (16.447 seconds), all 13 tests in the three complete import/build-graph files passed (213.656 seconds), and fresh Madge reported zero cycles (42.182 seconds). That historical hosted CI run completed with 90 successful jobs, 20 skipped jobs, and two failing test jobs plus their aggregate gate. The paired-node lifecycle failure was inherited and its main fix is now integrated. The Doctor failure was independently reproduced on both sides; current CI incorporates its main fix. This historical failed run is not treated as green.

Coordination

The sessproj overlap is the minimal validity-token call in session-accessor.sqlite-entry-revision.ts; its explicit fresh probe now also refreshes schema ownership. The canonkey admission-probe finding is handled by the same schema-facts change. The policy optimization is folded in under the coordinator's follow-up, using existing owners and preserving raw-write invalidation. The shared transaction helper refresh covers native and worker callers without rewriting the agenttx transaction owner. No new worker grant callbacks or authority reads are introduced.

RoboClaw #162433 is incidental under the standing overlap decision. #140042 has stale, different-function changes in the agent DB module; #122008 changes the media floor/export rather than these admission operations. No competing design or unrelated restructuring is adopted.

Retained preservation-provider debt

Existing maintenance authority callbacks recapture preservation at src/config/sessions/session-accessor.sqlite-maintenance-kick.ts:415, reachable from transaction/commit grants through src/config/sessions/session-accessor.sqlite-replacement-worker.ts:138. The placement provider at src/gateway/server-worker-placement-startup.ts:376 calls the shared-state query at src/gateway/worker-environments/placement-store.ts:364; this is a scan of non-local/non-reclaimed placements, not a claimed bounded exact-key lookup. The subagent provider at src/agents/subagents/registry/subagent-registry-maintenance.ts:48 also retains a cache-miss storage path (src/agents/subagents/registry/subagent-registry-read-cache.ts:279; SQL owner src/agents/subagents/registry/subagent-registry.store.sqlite.ts:79). Its prepared path remains available; no cold read during a grant is claimed as observed proof. The failed-environment check uses the environment owner's in-memory map and is not another SQL query. These cross-owner callback/read sites are unchanged by this PR and remain follow-up work for their preservation-provider owners; no blanket zero-host-SQL or measured slowness/blocking claim is made.

The schemafacts readiness probe runs before the worker lifetime/admission boundary (src/config/sessions/session-canonical-validation-readiness.ts:61, versus :88). Metadata maintenance skips the same-owner host retention path at src/config/sessions/session-accessor.sqlite-reclamation-run.ts:246. This PR adds no grant callback or cross-owner authority read.

Landing corrections and current evidence

Commit e6aa2e609f99f89e10321c2b8d5d4c50718fc130 addresses the exact-head CI and ClawSweeper findings. Run 37152097353 failed in the Windows ownership test and five Linux maintenance-worker cases, then cancelled dependent work. These are PR-caused, not an inherited-main exception. The original ownership file reproduced the same one failure in five single-worker runs, and the original maintenance file reproduced all five CI failures; five-run baseline comparisons independently confirmed both causes.

Maintenance metadata now uses its existing worker executor and generation claim instead of retaining a host read handle. The existing zero-host-SQL assertions remain unchanged. The ownership test now checks the exact sequence of both indexed ownership reads around the required post-BEGIN freshness probe. Cache initialization, refresh, and terminal failure handling are consolidated in openclaw-state-db-cache.admission.ts, replacing the former runtime-failure module; the compiled-wrapper inventory is updated. The extraction also preserves the persisted-quarantine terminal path. No schema, durability, retention, permission, or environment-name change is introduced.

Local corrected-source proof:

Check Result Wall time
Maintenance-worker, ownership, runtime-schema, and schema-facts files, node scripts/run-vitest.mjs ... --maxWorkers=1 92 passed; unchanged maintenance SQL assertions pass 685.80 s
Runtime-schema, cache retention, worker error transport, runtime build graph, reply imports, and state-worker imports 74 passed 228.53 s
PR wrapper dependency inventory Passed
Existing async quarantine rejection cases 2 passed 321.90 s including worker compilation
Madge import graph 0 cycles
Fresh isolated Codex autoreview of corrected source Scoped-clean through P2

No new test cases were added by the landing correction. The existing ownership SQL-order assertion changed; its full-file cost on the original head was 141–258 seconds on the loaded local host, and the original Windows job completed in about 202 seconds including setup and sibling files. These numbers are test cost, not runtime performance. The performance measurements above remain bound to their original measured head; this corrective commit is not a new workload measurement.

Released SDK source and generated declaration reports were audited against v2026.9.8, as detailed above. The SDK tooling fix is integrated. Released transaction and agent-read signatures remain unchanged.

Foreign-process migration refusal is exercised by src/state/database-runtime-schema-checks.test.ts, which starts a child process that changes both warm databases' user_version and verifies refusal on their next use. Independent-connection regressions also cover committed DDL, canonical-trigger drift, and next-unpinned-read freshness.

Final correction b6796f12f8cfcd2d950e44ef8cbc0d0f21d28a2c removes the newly added probe from warm handle retention itself, covering cold restore, archive, and deletion handoffs as well as maintenance. The actual canonical-readiness decision now owns one fresh read scope. All 11 production retention callers were audited for their actual read/transaction/revision owner. A foreign-trigger regression demonstrates that removing the retention probe alone would incorrectly reuse a clean readiness receipt, and passes with the paired read-boundary correction.

The earlier integrated head 9376dad14cf0e74a246c18c001341577ae6b5d8a was a merge commit with main 88415783fb415fb9db81b1014161d023c04ad400; there was no rebase. Every authored source, test, and documentation blob was unchanged by that merge. It includes the SDK tooling fix and main's child-coordination fixture fix 31412680307a94480b812c2a39378ee87346a40d.

The final correction passed 93 tests in 797.50 seconds across readiness, cold storage, cold publication, maintenance worker, reader cache, and read-error files, all with --maxWorkers=1. The new foreign-trigger case took 0.777 seconds locally and 0.111 seconds in CI run 37160368709 (job 111312631927); its assertion passed in that otherwise-red job. Production and all 27 shared test-type graphs passed; staged correction review is scoped-clean through P2. The early-refusal tests preserve typed missing-table errors, require Doctor guidance, prove the read callback never executes, and retain native-handle cleanup assertions. The reader-cache test now requires one probe per operation and one prepared probe after eviction, while still checking foreign commits.

Exact-main board evidence: CI tested merge df1480613b9fd4ca0286f70cbf71c9b24efa3281 over main b2c392dc0961ef09cc21655c16d72ca290d000ef. On that exact main, five standalone runs of src/gateway/server-methods/board.mcp-admission.test.ts reproduced all four failures (20/20 cases). The fixture holds the writer reservation while waiting for putWidget; after #164448, the preceding source-authority read queues behind that same reservation. Board code, test, and admission owner are identical between tested main and CI's merge tree. No schemafacts source change is involved in that scheduling cycle.

The original ownership and maintenance CI failures were independently confirmed PR-caused by five-run head/base comparisons. The later cold-storage, reader-cache, and early-read-refusal failures were also PR-caused and are fixed by the final correction. Child-coordination failed five times on both CI merge and main; its existing main fix is integrated. Private-completion passed five standalone runs on each side, but the original CI group rerun reproduced the failure. The final test correction explicitly joins receipt settlement; the passing earlier replays were not treated as a fix.

Prior-head proof is historical and is reused only where inputs are unchanged. The validation in this historical section is bound to 395e837b023866e540cd2c23f79f4eb85513ce58; the current candidate is recorded in Required landing validation above. Auto-merge is not armed.

CI investigation before the final fixture correction

Run 37163584322, attempt 1, tested merge cace5c1c7a5243192607694b5de896ee88e2a6ed over protected main c13c486969497270e091759059297731a73afd48. Its node-lifecycle tests pass with the integrated main fix.

The Doctor job (111322081790) fails only refuses shared-schema before changing the malformed source: it expects the newer-schema diagnostic but receives the generic maintenance/Gateway ownership wrapper. Five single-worker full-file runs on exact main and five on the tested merge reproduce byte-identical assertion failures; the other four cases pass every time, with no timeouts. The Testbox lease is stopped. This is independently proven inherited diagnostic behavior; refusal is preserved, and the test and causal owners are unchanged by this PR.

The private-completion job (111322081635) fails preserves executing private timeout facts (abandoned) while parsing an absent completion row. The fixture reads the receipt after advancing a scheduler whose settlement callback launches detached completion; that advance does not join the recorder's pending input settlement. The test, paired incognito file, and direct completion owners are byte-identical to the prior CI-merge/main pair, where five standalone runs per side all passed. The latest three completed scheduled main runs have no matching failure annotation among their 19 failed Node jobs. A current-main replay of the original two-file group passed the target case but had preceding unrelated timeout/dispatch failures, so it provides no clean attribution. This remains a timing failure with unresolved PR attribution, not a demonstrated fix or an inherited-failure waiver. The one authorized rerun (attempt 2, job 111329844939) reproduced the same missing-receipt assertion in an otherwise-passing 32-test group (100.24 seconds). Commit 395e837b023866e540cd2c23f79f4eb85513ce58 fixes the fixture synchronization through the real recorder settlement hook; it adds no timer, retry, production seam, or weakened assertion. Current-head CI and the complete two-file Testbox group both passed this correction, with all 32 group tests passing and no filters or reruns.

Refresh freshness at read admission and after BEGIN while reusing
handle-owned facts for runtime schema checks. Validate canonical
triggers before exposing agent readers and classify shared-state
failures only after failed admission.

Focused runtime checks execute zero SQL statements, versus 30 with
the baseline owner. Preserve foreign-commit and snapshot semantics.
Full workload measurement and remote integration checks remain merge
preconditions after remote runner and fleet-capacity admission failed.
@clawsweeper

clawsweeper Bot commented Oct 3, 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 docs Improvements or additions to documentation size: M labels Oct 3, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 3, 2026
@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 4, 2026, 3:23 AM ET / 07:23 UTC (Revision 18).

ClawSweeper review

What this changes

The PR reuses validated SQLite schema and session-key policy facts through existing database handles, reducing repeated queries while preserving freshness checks.

Warning

SQLite table change

This PR modifies persisted SQLite tables in src/infra/sqlite-schema-facts.ts. Prefer a design that avoids changing persisted SQLite tables. If the change is necessary, verify migration and upgrade compatibility against an existing database before merge.

Merge readiness

⛔ Blocked before merge - 1 item remains

This remains useful, distinct performance work. No actionable introduced defect was found, and the captured body now records completion of the previous review’s validation request.

Priority: P2
Reviewed head: 7a4b906b9c7696aa438bb784e785e6e3873f45d9

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, coherent optimization with strong recorded runtime and update evidence and no remaining actionable finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The matching captured body records real Gateway/WebSocket/SQLite before/after workloads exercising schema and policy owners, plus exact-head build and published-driver update results with durable success, readiness and serving-build identity. The previous validation request is resolved. Testbox raw logs were unavailable to this reviewer; workflow cancellation after recorded lease shutdown is not treated as failed candidate execution. No stored-data model changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The matching captured body records real Gateway/WebSocket/SQLite before/after workloads exercising schema and policy owners, plus exact-head build and published-driver update results with durable success, readiness and serving-build identity. The previous validation request is resolved. Testbox raw logs were unavailable to this reviewer; workflow cancellation after recorded lease shutdown is not treated as failed candidate execution. No stored-data model changes.
Evidence reviewed 8 items Pinned introduction and clean checkout: Reviewed the introduced delta from the pinned base to the exact original head. The supplied test merge is stale and was not used to infer removal of current-main behavior. Final whitespace inspection and checkout status were clean.
Freshness and policy reuse boundaries: Read entry refreshes connection-owned facts; policy reuse excludes active mutations, transactions, pinned snapshots, dynamic authorizers, and an operation whose version differs from the latest observed foreign commit. The transaction helper performs its explicit fresh probe after BEGIN inside rollback protection.
Meaningful regression coverage: Tests exercise raw, prepared, CTE, trigger-driven and partially failed writes, rollback, suspended RETURNING iterators, foreign commits, snapshots, authorizer refusal, and drifted canonical triggers. These protect observable freshness and refusal contracts rather than merely reproducing source structure.
Findings None None.
Security None None.

How this fits together

OpenClaw’s database admission layer validates shared control-plane and per-agent session databases before runtime reads and writes consume them. This change carries those validated facts through the connection lifecycle while refreshing them at operation boundaries.

flowchart TD
  A[Session and state operations] --> B[Database admission]
  B --> C[Connection-owned schema facts]
  C --> D[Read or transaction entry]
  D --> E[Foreign commit and local mutation checks]
  E --> F[Current schema and policy facts]
  F --> G[Session reads and state writes]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +137, Tests +278, Docs +4, Other 0. Total +419 across 27 files.

View PR surface stats
Area Files Added Removed Net
Source 16 221 84 +137
Tests 9 302 24 +278
Docs 1 5 1 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 1 0
Total 27 529 110 +419

Review metrics

Metric Value Why it matters
Production versus test growth production +221/-84; tests +302/-24 Production growth implements mutation invalidation and admission ownership; tests cover the corresponding freshness and lifecycle contracts.
Recorded warmed SQL reduction 638.8 → 524.6 statements/turn; 17.9% reduction The identical synthetic Gateway workload measures fewer statements, with proof explicitly bound to its measured revision rather than presented as a latency benchmark.

Stored data model

Persistent data-model change detected: database schema: src/state/openclaw-state-db-cache.ts, unknown-data-model-change: src/infra/sqlite-schema-facts.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Retain one connection-owned freshness mechanism, with admission and transaction boundaries refreshing facts before existing runtime owners consume them.

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

Not applicable as a bug reproduction: source and the recorded before/after Gateway workload establish repeated-query overhead and its reduction; this review executed no target code.

Is this the best way to solve the issue?

Yes. Reusing facts through existing connection and admission owners avoids a competing cache while retaining explicit fresh reads and conservative policy invalidation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 3f6c1d3a23b9.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded runtime database performance improvement with preserved user-facing contracts.
  • 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 (terminal): The matching captured body records real Gateway/WebSocket/SQLite before/after workloads exercising schema and policy owners, plus exact-head build and published-driver update results with durable success, readiness and serving-build identity. The previous validation request is resolved. Testbox raw logs were unavailable to this reviewer; workflow cancellation after recorded lease shutdown is not treated as failed candidate execution. No stored-data model changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The matching captured body records real Gateway/WebSocket/SQLite before/after workloads exercising schema and policy owners, plus exact-head build and published-driver update results with durable success, readiness and serving-build identity. The previous validation request is resolved. Testbox raw logs were unavailable to this reviewer; workflow cancellation after recorded lease shutdown is not treated as failed candidate execution. No stored-data model changes.

Evidence

What I checked:

  • Pinned introduction and clean checkout: Reviewed the introduced delta from the pinned base to the exact original head. The supplied test merge is stale and was not used to infer removal of current-main behavior. Final whitespace inspection and checkout status were clean. (7a4b906b9c76)
  • Freshness and policy reuse boundaries: Read entry refreshes connection-owned facts; policy reuse excludes active mutations, transactions, pinned snapshots, dynamic authorizers, and an operation whose version differs from the latest observed foreign commit. The transaction helper performs its explicit fresh probe after BEGIN inside rollback protection. (src/infra/sqlite-schema-facts.ts:308, 7a4b906b9c76)
  • Meaningful regression coverage: Tests exercise raw, prepared, CTE, trigger-driven and partially failed writes, rollback, suspended RETURNING iterators, foreign commits, snapshots, authorizer refusal, and drifted canonical triggers. These protect observable freshness and refusal contracts rather than merely reproducing source structure. (src/config/sessions/session-canonical-key-policy.test.ts:41, 7a4b906b9c76)
  • Complete captured proof body and review continuity: Read the complete body through GitHub and verified SHA-256 989892b9e6eb2789d209f876b78b051231131d4c78da019e479d3bf0575d287d, matching the captured 40,484-unit snapshot. Its Required landing validation section records the exact-head full build/package, nineteen complete files with 266 passing tests, wrapper inventory, zero import cycles, and the v2026.9.8 published-driver update. Update observations include durable finished/succeeded, readiness HTTP 200, and matching installed/serving candidate build identity. This resolves the previous review’s concrete rank-up request. (7a4b906b9c76)
  • Exact-head CI and Testbox identity distinction: Hosted CI run https://github.com/openclaw/openclaw/actions/runs/37182358825 completed successfully on the exact reviewed head. The separately linked Testbox campaign https://github.com/openclaw/openclaw/actions/runs/37184045655 has a cancelled terminal workflow status and a different transport head; the body separately binds execution to candidate tree faaf0f7879c8ff09edfdfe14624f7cf94fb885fb and records successful execution followed by lease shutdown. Raw job-log inspection was blocked by the network allowlist, so those execution observations are assessed from the matching captured body, not independently verified logs. (7a4b906b9c76)
  • Current main still needs this optimization: Fetched main still probes freshness inside getAdmittedSqliteSchemaFacts and lacks the introduced operation mutation revision and retained policy value. The central optimization is therefore distinct from the already-merged board-worker work and the adjacent open reader cutovers. (src/infra/sqlite-schema-facts.ts:354, 3f6c1d3a23b9)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: 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 (17 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-04T01:01:27.629Z sha 9bd9115 :: blocked before merge. :: none
  • reviewed 2026-10-04T01:47:07.836Z sha 395e837 :: blocked before merge. :: none
  • reviewed 2026-10-04T01:56:18.784Z sha 395e837 :: blocked before merge. :: none
  • reviewed 2026-10-04T02:59:03.857Z sha e53258a :: blocked before merge. :: none
  • reviewed 2026-10-04T04:31:51.248Z sha cacd9dc :: blocked before merge. :: none
  • reviewed 2026-10-04T05:49:25.017Z sha 3dd800e :: blocked before merge. :: none
  • reviewed 2026-10-04T06:15:50.481Z sha 3dd800e :: blocked before merge. :: none
  • reviewed 2026-10-04T06:23:37.338Z sha 7a4b906 :: blocked before merge. :: none

Integrate the pinned measurement baseline and retain main-key facts through the existing connection and reader-admission owners. Preserve raw writes, foreign commits, transaction snapshots, authorizers, and continuation authority.
@steipete

steipete commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 3, 2026
Use the existing worker generation claim for maintenance metadata instead of
retaining a host read handle. Keep both live ownership checks around the
required transaction-entry freshness probe.

Consolidate shared-state cache initialization, refresh, and terminal failures
in its admission sibling and update the compiled-wrapper inventory. This
keeps the cache within the existing module-size limit without changing stored
schema or quarantine semantics.

Focused maintenance, ownership, schema, worker, wrapper, and quarantine proof
passed. Independent Codex review is clean through P2. Full landing validation
remains required before merge.
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Oct 3, 2026
@steipete

steipete commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

Refresh canonical readiness when it consumes schema facts. Retention only
holds native lifetime, so cold restore and other worker handoffs no longer
execute host SQLite before dispatch.

Protect foreign schema invalidation at the warm readiness fast path. Tighten
retained-reader budgets to the optimized counts, and require early missing-table
diagnosis before callbacks while preserving handle-cleanup assertions.

Validation: 93 focused tests, production types, state/config test types, and
independent review clean through P2.
Integrate the released-SDK diff tooling fix and the inherited child-coordination fixture correction. The merge preserves every authored source, test, and documentation blob; the wrapper inventory combines both branches.
@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 3, 2026
@steipete

steipete commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

Integrate the current main fixes for oversized Git baseline reads and the malformed-plugin-config assertion inventory. Preserve all schemafacts production, test, and documentation changes; incorporate the current wrapper dependency inventory.
Integrate main's canonical transcript notification and exact-owner preview
fixture repair, plus the native Node duration-helper import correction.
Preserve all schemafacts production, test, and documentation changes and
incorporate the current wrapper dependency inventory.

Fresh independent P2 review of the combined candidate found no actionable
findings. Final-head update, SDK, focused validation, and hosted CI follow.
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

Integrate main's MCP capability fixture repair and behavior-based spinner
assertion, together with its lifecycle-context ownership changes. Preserve
all schemafacts production, test, and documentation changes and retain the
current wrapper inventory alongside the cache-admission module.

Fresh independent P2 review found no actionable findings in the combined
candidate. Final-head CI, lifecycle boundary checks, and the published-driver
update cell remain required before landing.
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete merged commit c828f7e into main Oct 4, 2026
186 checks passed
@steipete
steipete deleted the dbasync/schemafacts branch October 4, 2026 07:37
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Oct 4, 2026
Merge main d2a9f9a after the
schema-facts prerequisite #164490 landed. Retain main's archive-runtime
cleanup and incorporate the native duration-import and preview fixes.
No conflicts or new lane signature changes were introduced.

The complete integrated delta has a clean P2 review. Eleven import/runtime
build-graph tests and the staged mock-export ratchet pass. Local Gateway
proof recorded a WebSocket response timeout in reclamation concurrency
under heavy startup load; its authority-revocation sibling passed. The
remaining local run was interrupted and is not passing coverage. Exact
candidate/main attribution, fresh released-SDK diff, and final CI follow.
steipete added a commit that referenced this pull request Oct 4, 2026
Use the existing read-operation admission owner before raw schema and
launch-receipt reads. Main's schema-facts change in #164490 moved foreign
commit freshness to operation admission, leaving three fixtures reading
stale facts or skipping a required freshness probe.

Preserve same-handle rollback/retry, table visibility, reopen durability,
and the exact nine-probe assertion. Each original failure reproduced five
out of five times on unchanged main. The three repaired files pass all
89 tests (544.71s wrapper wall on the loaded local host), and P2 review is
clean. Found while landing #164805.
steipete added a commit that referenced this pull request Oct 4, 2026
Refresh retained schema facts at the connection-bound factory admission
boundary, before factories inspect optional tables. The freshness move in
c828f7e (#164490) omitted this boundary,
so a retained worker could skip existing first-use tombstone creation after
foreign DDL and make memory forget fail before recording the deletion.

Also join canonical asynchronous database retirement before the stale-borrow
fixture reopens its successor. Preserve every existing assertion and all
schema, migration, transaction-authority, and deletion contracts.

Bisect: the focused forget.mark regression passes on 3e8edff and fails
on c828f7e. Current main reproduced all ten tombstone failures; the fixed
recovery and settlement suites pass 12/12.

Validation: 441 passing memory, forget, tombstone, schema, and worker tests
across 25 files (four existing skips); production and extension-test types;
both import-cycle checks report zero cycles. The changed fixture passes
11/11 with one worker in 309.16s (344.91s wrapper wall time) on the loaded
local host. No tests or runtime assertions were removed or weakened.

The broader changed gate was stopped during all-core test typechecks after
production types and static ratchets passed. Testbox remained queued and
was stopped without check execution; verification was local.

Formatting and the native schema-version guard pass. Lint could not start:
its plugin-sdk boundary declaration prerequisite timed out after 300000ms
on the loaded host. This is recorded as an unrun lint check, not a pass.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
…d of re-querying per call (openclaw#164490)

* perf(state): carry admitted schema facts with database handles

Refresh freshness at read admission and after BEGIN while reusing
handle-owned facts for runtime schema checks. Validate canonical
triggers before exposing agent readers and classify shared-state
failures only after failed admission.

Focused runtime checks execute zero SQL statements, versus 30 with
the baseline owner. Preserve foreign-commit and snapshot semantics.
Full workload measurement and remote integration checks remain merge
preconditions after remote runner and fleet-capacity admission failed.

* fix(state): preserve worker handoffs during schema admission

Use the existing worker generation claim for maintenance metadata instead of
retaining a host read handle. Keep both live ownership checks around the
required transaction-entry freshness probe.

Consolidate shared-state cache initialization, refresh, and terminal failures
in its admission sibling and update the compiled-wrapper inventory. This
keeps the cache within the existing module-size limit without changing stored
schema or quarantine semantics.

Focused maintenance, ownership, schema, worker, wrapper, and quarantine proof
passed. Independent Codex review is clean through P2. Full landing validation
remains required before merge.

* fix(state): keep retained handles free of schema probes

Refresh canonical readiness when it consumes schema facts. Retention only
holds native lifetime, so cold restore and other worker handoffs no longer
execute host SQLite before dispatch.

Protect foreign schema invalidation at the warm readiness fast path. Tighten
retained-reader budgets to the optimized counts, and require early missing-table
diagnosis before callbacks while preserving handle-cleanup assertions.

Validation: 93 focused tests, production types, state/config test types, and
independent review clean through P2.

* test(gateway): await private timeout receipt settlement

The maintenance scheduler starts worker-backed completion without joining it. Wait for the real recorder's accepted write before reading its receipt, while preserving the held producer and lifecycle writes and all timeout outcome assertions.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
Use the existing read-operation admission owner before raw schema and
launch-receipt reads. Main's schema-facts change in openclaw#164490 moved foreign
commit freshness to operation admission, leaving three fixtures reading
stale facts or skipping a required freshness probe.

Preserve same-handle rollback/retry, table visibility, reopen durability,
and the exact nine-probe assertion. Each original failure reproduced five
out of five times on unchanged main. The three repaired files pass all
89 tests (544.71s wrapper wall on the loaded local host), and P2 review is
clean. Found while landing openclaw#164805.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
Refresh retained schema facts at the connection-bound factory admission
boundary, before factories inspect optional tables. The freshness move in
06566ec (openclaw#164490) omitted this boundary,
so a retained worker could skip existing first-use tombstone creation after
foreign DDL and make memory forget fail before recording the deletion.

Also join canonical asynchronous database retirement before the stale-borrow
fixture reopens its successor. Preserve every existing assertion and all
schema, migration, transaction-authority, and deletion contracts.

Bisect: the focused forget.mark regression passes on 60de457 and fails
on 06566ec. Current main reproduced all ten tombstone failures; the fixed
recovery and settlement suites pass 12/12.

Validation: 441 passing memory, forget, tombstone, schema, and worker tests
across 25 files (four existing skips); production and extension-test types;
both import-cycle checks report zero cycles. The changed fixture passes
11/11 with one worker in 309.16s (344.91s wrapper wall time) on the loaded
local host. No tests or runtime assertions were removed or weakened.

The broader changed gate was stopped during all-core test typechecks after
production types and static ratchets passed. Testbox remained queued and
was stopped without check execution; verification was local.

Formatting and the native schema-version guard pass. Lint could not start:
its plugin-sdk boundary declaration prerequisite timed out after 300000ms
on the loaded host. This is recorded as an unrun lint check, not a pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime 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. scripts Repository scripts size: L 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