Skip to content

improve: reduce SQLite work during chat turns - #167965

Merged
steipete merged 44 commits into
mainfrom
dbasync/noprobe
Oct 10, 2026
Merged

steipete merged 44 commits into
mainfrom
dbasync/noprobe

Conversation

@steipete

@steipete steipete commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #167739 (dbasync/checkonce); this PR must land after it.

What Problem This Solves

Chat turns repeatedly query SQLite freshness even though the Gateway owns the databases and their writes.

User Impact

Reduces warmed-turn all-thread SQLite statements from 1,074.6 to 867.9 (−206.7, −19.2%) and named worker requests from 386.9 to 366.5. Stored schemas, durability, retention, permissions, and live effect-boundary checks are preserved. The lane meets its ≥200-statement reduction target; the broader under-500 budget remains unfinished. Outside processes must route writes through the Gateway or run while it is stopped; remaining built-in direct writers are listed below as follow-ups.

Why This Change Was Made

The existing physical-database admission owner now publishes a shared write revision before releasing native write custody. Cached rows consume those in-process publications; an unsettled or unknown writer disables reuse. This replaces runtime data_version queries without adding a second broadcaster, persistent state, or another worker request per read. Schema admission remains once per physical database per process; migrations and explicit repair retain their checks.

Session, ACP, profile, pairing, voice, auth, and transcript-index caches retain their owning invalidation boundaries. Multi-statement reads keep consistent snapshots, single-statement reads use autocommit, and request-owned nested work reuses its existing transaction. Native/SDK nested rollback behavior remains.

Workboard can have multiple same-process stores through private runtime registries. Its retained lists and board revisions now consume the existing physical writer token through one narrow sqlite-runtime re-export. That Workboard host-facade observation adds no SQL or worker request. Reads check the token before reuse and publication; an unsettled or changed token leaves an ordinary read uncached at its original revision, without replaying a mutation, reporting a new read failure, or polling. The one-second foreign-change timer and private data-version request are removed. There is no new SDK subpath or invalidation owner.

TEMP-table DDL revokes connection-local facts while preserving physical MAIN schema admission. The classifier only treats explicit TEMP creation/qualified table deletion as local; ambiguous or mixed DDL remains conservative. This prevents local staging-table cleanup from triggering another MAIN validation while preserving rollback and custom-trigger invalidation.

Cache and statement ownership

Surface Protected facts / cutover Invalidation owner
Shared read revisions and auth rows Retained row snapshots and auth publication gaps; removes data-version/WAL freshness observations Existing physical admission's native write settlement plus local mutation/snapshot identity
Session entries, participants, canonical policy, transcript indexing Exact/list/policy facts and bounded TEMP traversal Physical sibling-write receipt plus existing local TEMP generation; undefined never certifies retention
Pairing, profile, ACP and voice Multi-row snapshots, selected identities, metadata and tool policy Same settled receipt checked before and after reads; effect authority remains current
Subagent maintenance and trajectory retention Complete protection baseline, subset rereads and run aggregates Immutable full-snapshot receipt and stable current-row checks at the existing effect boundary
Workboard Frozen card lists, board summaries and session-board revisions across sibling instances Existing physical writer token in the host facade; no timer or per-use worker request
Runtime snapshots and append kernels Single-statement reads drop BEGIN/COMMIT; composite reads share their existing snapshot; request-owned writes drop redundant savepoints Existing read/write owner, FIFO, live grant and outer rollback
TEMP DDL Local staging/tracking facts separated from MAIN format facts Existing schema mutation owner; no repeated format query

The complete task inventory combines core, sessions, ancillary state, envelope, Workboard and outside-writer audits. It distinguishes same-process writer completeness from unsupported concurrent outside-process SQLite edits.

Evidence

Three alternating pairs passed all normal workload assertions and complete SQL/thread conservation. Every phase’s SQL median decreased, and all candidate/base median duration ratios are ≤1.017. No tolerance or combined-window exception is required. Measurement base: cdb5143a0e03ac94ca9fb04982165bc792aba8a7; candidate runtime: 4f4b116ec9c8a8ce053192895af2d83297ecd90f. The later fc4469873e50 commit only annotates the Workboard promise with its existing return type; type-erased JavaScript is identical after normalizing whitespace and optional trailing commas. The shared workload is unchanged, with the same host/runtime and alternating M,C,M,C,M,C order. Earlier diagnostic runs are not used as the median gate. Runtime data_version statements are zero in every candidate phase. The workload has no independent maintenance phase; the tables identify an overlapping maintenance subset from affirmative stack provenance.

Published-driver × candidate update cell: pending (lander), per lane proof split. No persisted schema or version change.

Statement, request, envelope, maintenance, and attribution tables

Cells are base → candidate, median [min–max]. Warmed rows are medians of each run’s ten-turn mean. MAIN is Gateway thread 0. Canonical requests include resource-close; all named sends add admission metadata, stage handshakes and legacy admission requests, and do not claim to count every IPC message.

Statements

Phase All-thread SQL MAIN SQL Δ all SQL Wall C/B
01.boot 3271 [3260–3276] → 3146 [3146–3160] 2014 [1994–2016] → 1991 [1991–1992] -125 0.528
01.connect 318 [268–878] → 208 [206–238] 37 [31–100] → 20 [20–20] -110 1.017
02.first-turn 2672 [1624–2769] → 2094 [2006–2136] 132 [42–141] → 122 [116–126] -578 0.677
03.warmed-mean 1074.6 [1045.8–1171.9] → 867.9 [867.1–868.2] 8.8 [6.6–16.2] → 6.6 [6.6–6.6] -206.7 0.778
04.second-session 4284 [4040–4554] → 3375 [3308–3478] 134 [111–140] → 96 [84–105] -909 0.911
05.control-plane 31 [28–31] → 18 [18–19] 0 [0–0] → 0 [0–0] -13 0.997
06.cron 1218 [1204–1301] → 945 [926–1118] 45 [45–75] → 24 [17–46] -273 0.992
07.compaction 418 [409–563] → 336 [335–338] 25 [25–48] → 24 [24–24] -82 0.723
08.shutdown 152 [148–155] → 119 [115–122] 87 [81–87] → 66 [66–66] -33 0.841
total-workload 23320 [22602–23873] → 18960 [18854–19128] 2595 [2520–2611] → 2416 [2397–2425] -4360 0.744

Requests

Phase Canonical all Canonical MAIN All named sends MAIN named sends
01.boot 69 [66–70] → 66 [66–70] 69 [66–70] → 66 [66–70] 145 [144–150] → 143 [143–147] 69 [66–70] → 66 [66–70]
01.connect 40 [40–92] → 40 [40–40] 40 [40–92] → 40 [40–40] 75 [71–180] → 71 [68–71] 40 [40–92] → 40 [40–40]
02.first-turn 353 [265–375] → 367 [342–370] 351 [263–373] → 366 [341–369] 748 [491–787] → 716 [655–721] 351 [263–373] → 366 [341–369]
03.warmed-mean 198.9 [195–209.8] → 194.4 [194.1–194.8] 198.9 [195–209.8] → 194.4 [194.1–194.8] 386.9 [374.5–419.5] → 366.5 [366.2–366.9] 198.9 [195–209.8] → 194.4 [194.1–194.8]
04.second-session 730 [689–741] → 703 [688–729] 730 [689–741] → 703 [688–729] 1482 [1372–1552] → 1360 [1337–1425] 730 [689–741] → 703 [688–729]
05.control-plane 6 [5–6] → 5 [5–5] 6 [5–6] → 5 [5–5] 12 [11–12] → 7 [7–7] 6 [5–6] → 5 [5–5]
06.cron 179 [175–197] → 178 [171–217] 179 [175–197] → 178 [171–217] 365 [361–383] → 368 [361–452] 179 [175–197] → 178 [171–217]
07.compaction 83 [83–106] → 83 [82–83] 83 [83–106] → 83 [82–83] 130 [122–182] → 113 [112–113] 83 [83–106] → 83 [82–83]
08.shutdown 15 [15–15] → 15 [15–16] 15 [15–15] → 15 [15–16] 17 [17–17] → 19 [17–20] 15 [15–15] → 15 [15–16]
total-workload 3504 [3399–3549] → 3399 [3390–3440] 3502 [3397–3547] → 3398 [3389–3439] 6912 [6631–7092] → 6463 [6438–6548] 3502 [3397–3547] → 3398 [3389–3439]

Admission requests

Phase Metadata Stage handshake Legacy admission
01.boot 45 [44–45] → 44 [44–44] 33 [32–35] → 33 [33–33] 0 [0–0] → 0 [0–0]
01.connect 12 [11–34] → 10 [9–12] 24 [19–54] → 19 [19–21] 0 [0–0] → 0 [0–0]
02.first-turn 67 [11–77] → 22 [21–24] 318 [215–345] → 327 [292–327] 0 [0–0] → 0 [0–0]
03.warmed-mean 8.8 [5.8–17.4] → 0 [0–0] 179.2 [173.7–192.3] → 172.1 [172.1–172.1] 0 [0–0] → 0 [0–0]
04.second-session 52 [34–85] → 0 [0–0] 700 [649–726] → 657 [649–696] 0 [0–0] → 0 [0–0]
05.control-plane 4 [4–4] → 0 [0–0] 2 [2–2] → 2 [2–2] 0 [0–0] → 0 [0–0]
06.cron 6 [6–6] → 14 [14–14] 178 [178–178] → 174 [174–219] 2 [2–2] → 2 [2–2]
07.compaction 17 [9–30] → 0 [0–0] 30 [30–46] → 30 [30–30] 0 [0–0] → 0 [0–0]
08.shutdown 0 [0–0] → 2 [0–2] 2 [2–2] → 2 [2–2] 0 [0–0] → 0 [0–0]
total-workload 312 [235–376] → 91 [89–96] 3094 [2995–3165] → 2971 [2957–3010] 2 [2–2] → 2 [2–2]

Probes and transaction statements (all threads)

Phase data_version BEGIN COMMIT SAVEPOINT RELEASE
01.boot 174 [173–180] → 0 [0–0] 56 [54–56] → 54 [54–56] 51 [49–51] → 49 [49–51] 4 [4–4] → 4 [4–4] 4 [4–4] → 4 [4–4]
01.connect 67 [60–126] → 0 [0–0] 16 [14–35] → 14 [14–15] 15 [14–34] → 14 [14–15] 3 [3–5] → 3 [3–3] 3 [3–5] → 3 [3–3]
02.first-turn 459 [321–473] → 0 [0–0] 161 [126–172] → 170 [159–171] 159 [126–169] → 167 [156–168] 11 [8–12] → 5 [4–5] 11 [8–12] → 5 [4–5]
03.warmed-mean 232.4 [229.2–248.1] → 0 [0–0] 99.4 [98.7–103.1] → 96.6 [96.5–96.9] 98.6 [98.1–101.9] → 96 [95.9–96.3] 5.4 [5.3–5.6] → 0.3 [0.3–0.3] 5.4 [5.3–5.6] → 0.3 [0.3–0.3]
04.second-session 881 [851–926] → 0 [0–0] 376 [364–376] → 360 [359–372] 368 [358–368] → 354 [353–364] 28 [27–28] → 4 [4–5] 28 [27–28] → 4 [4–5]
05.control-plane 10 [9–10] → 0 [0–0] 3 [3–3] → 3 [3–3] 3 [3–3] → 3 [3–3] 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0]
06.cron 254 [250–286] → 0 [0–0] 84 [83–87] → 84 [84–100] 84 [83–87] → 84 [84–98] 10 [10–10] → 2 [2–3] 10 [10–10] → 2 [2–3]
07.compaction 78 [78–104] → 0 [0–0] 31 [31–41] → 31 [31–31] 27 [27–35] → 27 [27–27] 1 [1–1] → 0 [0–0] 1 [1–1] → 0 [0–0]
08.shutdown 27 [27–27] → 0 [0–0] 11 [10–11] → 10 [10–10] 11 [10–11] → 10 [10–10] 1 [1–1] → 1 [1–1] 1 [1–1] → 1 [1–1]
total-workload 4331 [4214–4403] → 0 [0–0] 1744 [1719–1753] → 1696 [1694–1708] 1714 [1695–1723] → 1670 [1670–1682] 112 [111–113] → 22 [22–23] 112 [111–113] → 22 [22–23]

Maintenance subset (existing phase placement)

The unchanged harness has no standalone maintenance phase. This subset counts only affirmative native/request stack provenance for scheduler, timer, checkpoint, recovery, pairing, retention, plugin cleanup, memory sync, idle close, or a named maintenance command. It excludes generic unbound/background and unassigned work. SQL-linked IDs are a lower bound on related canonical requests: zero-SQL sends are absent, and IDs are deduplicated within each window. This subset overlaps the phase totals above.

Existing phase Maintenance SQL MAIN maintenance SQL SQL-linked request IDs (lower bound)
01.boot 26 [19–27] → 13 [13–19] 5 [5–5] → 3 [3–3] 4 [3–4] → 3 [3–4]
01.connect 7 [0–64] → 0 [0–0] 6 [0–26] → 0 [0–0] 1 [0–6] → 0 [0–0]
02.first-turn 98 [49–114] → 75 [67–85] 42 [12–50] → 38 [38–38] 12 [12–13] → 11 [10–12]
03.warmed-mean 9.8 [5.8–14] → 5.2 [4.6–5.6] 3.2 [2.4–4.7] → 2.4 [2.4–2.4] 1.9 [1.2–2.8] → 1.2 [0.9–1.3]
04.second-session 44 [27–54] → 39 [25–41] 16 [8–16] → 16 [9–16] 8 [5–10] → 8 [7–9]
05.control-plane 3 [0–3] → 0 [0–0] 0 [0–0] → 0 [0–0] 1 [0–1] → 0 [0–0]
06.cron 9 [9–32] → 5 [5–24] 0 [0–7] → 0 [0–8] 4 [4–8] → 4 [4–7]
07.compaction 22 [22–53] → 19 [17–19] 8 [8–16] → 8 [8–8] 2 [2–6] → 3 [2–3]
08.shutdown 34 [30–34] → 30 [30–30] 18 [14–18] → 16 [16–16] 1 [1–1] → 1 [1–1]
total-workload 402 [270–404] → 231 [213–266] 132 [113–138] → 105 [98–113] 59 [40–68] → 43 [39–45]

The following unambiguous maintenance commands also have complete canonical-send counts, including zero-SQL sends, across the full workload:

Command Canonical sends Attributed SQL Send caller
bootstrap.prune 1 [1–2] → 1 [1–1] 4 [4–8] → 2 [2–2] src/infra/device-pairing-worker.ts:208
cron.maintainHistory 2 [1–2] → 1 [1–1] 16 [8–16] → 6 [6–6] src/cron/service/runtime-mutation.ts:97
pluginState.sweep 1 [1–2] → 1 [1–1] 6 [6–12] → 4 [4–4] src/plugin-state/plugin-state-worker-client.ts:87
secrets.purge 2 [1–2] → 1 [1–1] 18 [9–18] → 7 [7–7] src/state/openclaw-state-worker-store.ts:48
trajectory.retention.begin 1 [1–1] → 1 [1–1] 1 [1–1] → 0 [0–0] src/trajectory/runtime-retention.ts:220
trajectory.retention.delete 1 [1–1] → 1 [1–1] 5 [5–5] → 2 [2–2] src/trajectory/runtime-retention.ts:244
workerEnvironments.pruneCandidates 4 [2–4] → 2 [2–2] 8 [4–8] → 2 [2–2] src/state/openclaw-state-read-worker.ts:411

Adjacent combined windows

These per-run sums are retained for timing-dependent phase movement; no combined window replaces the warmed-turn gate.

Window Pair Base SQL Candidate SQL Base canonical Candidate canonical Base named Candidate named
boot+connect 1 3578 3352 109 106 220 214
boot+connect 2 4154 3398 162 110 330 218
boot+connect 3 3539 3354 106 106 215 211
boot+connect+first-turn 1 6250 5488 462 476 968 935
boot+connect+first-turn 2 5778 5404 427 452 821 873
boot+connect+first-turn 3 6308 5448 481 473 1002 927
compaction+shutdown 1 711 457 121 98 199 132
compaction+shutdown 2 573 455 98 98 147 132
compaction+shutdown 3 561 453 98 98 139 130
control+cron 1 1329 1137 202 222 394 459
control+cron 2 1249 944 185 176 377 368
control+cron 3 1235 963 181 183 373 375
total-workload 1 23320 19128 3504 3440 6912 6548
total-workload 2 23873 18960 3549 3399 7092 6463
total-workload 3 22602 18854 3399 3390 6631 6438

Exact warmed-turn delta reconciliation

For each metric, this decomposition uses the actual middle run on each side (or the two middle runs for an even count). Independent component medians cannot be added to reconstruct the median total. The full ledger identifies every normalized SQL statement and every request type; the grouped table below sums exactly to the reported delta.

SQL component group Base contribution Candidate contribution Δ
Transaction envelopes 209.6 193.8 -15.8
Other retained SQL (full component ledger) 86.6 77.7 -8.9
Admission/schema/introspection SQL 67.4 23 -44.4
Removed data_version probes 232.4 0 -232.4
Session main-key contract 34.8 52.3 17.5
Session entries and row facts 73.6 99.2 25.6
Session participant rows 41.1 92.8 51.7
Unchanged statement components 329.1 329.1 0
TOTAL 1074.6 867.9 -206.7

Canonical request components

Component Base contribution Candidate contribution Δ
["logical", "sqlite-broker", "database.domain.execute"] 6.4 5.3 -1.1
["logical", "sqlite-broker", "database.domain.bind"] 4.8 4.1 -0.7
["logical", "sqlite-broker", "database.domain.close"] 4.8 4.1 -0.7
["logical", "task-worker", "session-row-facts"] 5.7 6.4 0.7
["logical", "sqlite-broker", "database.prepareWrite"] 0.6 0 -0.6
["logical", "task-worker", "sessionRows.sharedFacts"] 5.9 6.5 0.6
["logical", "sqlite-broker", "pluginState.compareDelete"] 1.6 1.2 -0.4
["logical", "task-worker", "session-store-target"] 12.8 12.6 -0.2
["logical", "sqlite-broker", "pluginState.compareUpdate"] 0.8 0.6 -0.2
["logical", "sqlite-broker", "pluginState.observe"] 0.8 0.6 -0.2
["logical", "task-worker", "session-corpus-inventory"] 0.8 0.6 -0.2
["logical", "task-worker", "session-tombstones"] 0.8 0.6 -0.2
["logical", "sqlite-broker", "pluginState.entries"] 0.6 0.4 -0.2
["logical", "resource-close", "closeResource"] 20.8 20.6 -0.2
["logical", "sqlite-broker", "session.entry.read"] 18.8 18.6 -0.2
["logical", "readonly-process", "auth-profile-rows"] 3.1 3 -0.1
["logical", "sqlite-broker", "session.maintenance.read"] 1.1 1 -0.1
["logical", "task-worker", "prepare"] 0.4 0.3 -0.1
["logical", "task-worker", "session-entry"] 0.4 0.3 -0.1
["logical", "readonly-process", "pluginCatalog.read"] 0.1 0 -0.1
["logical", "task-worker", "auth-refresh"] 0.2 0.1 -0.1
["logical", "task-worker", "deliveryQueue.outbound"] 0.5 0.4 -0.1

Metadata request components

Component Base contribution Candidate contribution Δ
["metadata_requests", "unspecified", "database.domain.close", "extensions/memory-core/src/memory/manager-publication.worker.ts"] 5.6 0 -5.6
["metadata_requests", "unspecified", "session-target-inventory", "src/infra/worker-task-server.ts"] 1.6 0 -1.6
["metadata_requests", "unspecified", "database.prepareWrite", "src/state/openclaw-agent-db-metadata.ts"] 0.8 0 -0.8
["metadata_requests", "unspecified", "session-exact-entries", "src/infra/worker-task-server.ts"] 0.4 0 -0.4
["metadata_requests", "unspecified", "session-row-facts", "src/infra/worker-task-server.ts"] 0.4 0 -0.4

Admission-stage components

Component Base contribution Candidate contribution Δ
["admission_stage_requests", "open", "database.prepareWrite", "unrecorded"] 1.8 0 -1.8
["admission_stage_requests", "prepare", "database.domain.execute", "unrecorded"] 6.4 5.3 -1.1
["admission_stage_requests", "prepare", "database.domain.bind", "unrecorded"] 4.8 4.1 -0.7
["admission_stage_requests", "prepare", "database.domain.close", "unrecorded"] 4.8 4.1 -0.7
["admission_stage_requests", "prepare", "database.prepareWrite", "unrecorded"] 0.6 0 -0.6
["admission_stage_requests", "commit", "pluginState.compareDelete", "unrecorded"] 1.6 1.2 -0.4
["admission_stage_requests", "transaction", "pluginState.compareDelete", "unrecorded"] 1.6 1.2 -0.4
["admission_stage_requests", "commit", "pluginState.compareUpdate", "unrecorded"] 0.8 0.6 -0.2
["admission_stage_requests", "commit", "pluginState.observe", "unrecorded"] 0.8 0.6 -0.2
["admission_stage_requests", "transaction", "pluginState.compareUpdate", "unrecorded"] 0.8 0.6 -0.2
["admission_stage_requests", "transaction", "pluginState.observe", "unrecorded"] 0.8 0.6 -0.2
["admission_stage_requests", "commit", "database.domain.execute", "unrecorded"] 2.8 2.6 -0.2
["admission_stage_requests", "transaction", "database.domain.execute", "unrecorded"] 2.8 2.6 -0.2
["admission_stage_requests", "prepare", "session.entry.read", "unrecorded"] 18.8 18.6 -0.2

Validity and scope

Every run retains normal harness assertions and complete phase/thread SQL conservation. All six runs use the same observed admission census hash. The full phase-summary.md remains the authoritative expanded table, including individual warmed turns, all MAIN transport components, and rollback statements. median-delta-reconciliation.csv provides the exact component ledger; statement-site-summary.json retains native source stacks; maintenance-subset.json records the subset arithmetic.

Positive request phases

First-turn canonical requests rise 353→367 while all named sends fall 748→716; retained memory publication/lease work shifts into that window, with lower whole-workload counts. Cron all named sends rise365→368: eight PR-caused shared-admission metadata sends replace one database.prepareWrite request and four associated stage sends. Shutdown rises17→19 from two new archive-worker admission exchanges. These are required process-authority transport, not claimed as timing noise or request savings. Every all-thread SQL phase median falls, so no non-turn SQL tolerance or combined-window exception is invoked. See positive-request-attribution.md for source paths, exact middle observations and complete component ledgers.

Remaining outside-writer follow-ups

Direct device-pairing bootstrap fallback, credential/auth commands, updater/backup coordination, Memory and Matrix CLI, native companion stores, and Workboard CLI registration/fallback need routing or exclusive offline custody. Workboard registration may prepare its database before selecting even a read subcommand. The inventory records exact call sites and preserves the task's bounded follow-up scope; no broad low-level refusal or parallel routing mechanism was added. These paths do not justify keeping runtime probes.

The remote Windows workspace lease database is a separate host lock primitive, not a writer to the Gateway's shared/agent database. The managed update helper's restart-sentinel writer does target installation shared state and remains explicitly covered by the updater follow-up and published-driver contract.

Recorded correctness proof

Regression Before repair After repair Cost / evidence
Workboard sibling-worker publication Next warmed reader list returned cached [] after sibling worker created a card: 1 failed, 5 skipped 4 focused files /71 tests pass: sibling create/update/delete, board/session revisions, overlapping reads, undefined-token uncached fallback, no probes/timer, and session-board authority/expiry cases Red Vitest 66.13s /wrapper 76.37s; green Vitest 67.56s /wrapper 81.53s. workboard-sibling-red.log, workboard-sibling-green.log
TEMP DDL vs MAIN admission 5 cases failed: local CREATE notified MAIN listeners and qualified TEMP DROP changed MAIN admission Both schema-facts suites pass, 113 tests; preserve sibling MAIN admission, local invalidation, rollback/custom-trigger guards and zero schema reread SQL Red Vitest 29.93s /wrapper 36.31s; green Vitest 65.98s /wrapper 78.01s. temp-drop-red.log, temp-drop-green.log

Post-review state verification passed all 18 metadata tests and 49/50 validation-cache tests. The remaining fixture incorrectly expected an empty BEGIN/COMMIT to expire admitted schema facts. After correcting that expectation, the exact test passed (0.588s test; 23.19s Vitest; 58.16s wrapper; 59.57s shell wall), preserving its explicit revocation assertions. Evidence: postreview-state-tests.log, postreview-admission-fixture.log. The initial combined run is not presented as fully passing, and no full-suite rerun is inferred from the focused correction.

The third/final P2 review's Workboard finding was accepted as a wrong-result correctness repair and resolved with the red/green proof above. No fourth autoreview round was started, per review convergence. Its promise type inference error was subsequently fixed with an explicit existing return type, with no runtime change. These scoped results do not substitute for the final all-thread statement/request gate or exact-head aggregate checks.

Additional owner proof: all seven legacy migration race tests passed (37.64s Vitest, 48.59s wrapper). The deferred-integrity and coalesced async-admission cases also passed. The open-timing suite's canonical-index case failed because it expects 10ms of simulated registration time but observes 80ms (total 1150ms versus 1220ms); the exact failure reproduces on the pinned cdb5143 base. The inherited ingress-listing and WAL row-decoding failures are recorded separately. None is counted as a passing suite. Local test costs are recorded; CI seconds are unmeasured.

Madge: zero cycles. Knip files/dependencies: passed. After the Workboard type correction, the full changed check passed every preceding guard and typecheck, including T1 no-growth, production core and extensions, and both test graphs. Its final production dead-export scan reports the untouched src/infra/sqlite-worker-broker-reply.ts: settleFailedSqliteWorkerJobs; the same scan fails with the same single export on the pinned cdb5143 parent. That parent-only failure is recorded under the stacked-base/inherited-failure policy; the lane does not change the file or its callers. Public SDK diff passed with digest 0add8078: zero entrypoint or top-level export/signature changes, 148 reachable-only changes. The new helper re-export belongs to the private first-party SQLite facade; no released public freshness API was removed.

Change size and remaining proof

Relative to the integrated check-once base cdb5143a0e03, candidate fc4469873e50 changes:

Scope Files Added Removed Net
Production 81 1,466 1,256 +210
Tests and support 61 1,615 1,526 +89
Documentation 8 224 157 +67

The production growth keeps receipt publication, active-writer custody, corruption revocation and accepted-work settlement with the existing admission lifecycle. It removes the old foreign-observation implementation instead of adding a parallel owner. Test growth mainly proves worker-to-reader invalidation and the native settlement/cleanup boundaries; retained compatibility and authority cases remain covered.

P2 follow-up: SDK documentation currently describes the write-token helper as request-free broadly. That statement is proven for Workboard's host facade; arbitrary worker contexts may use the helper's existing metadata exchange. Scope the wording in a follow-up; no runtime behavior or proof assertion depends on the broader wording.

The paired SQL proof, source/request attribution, inventory, focused test costs and static evidence are complete. Two unmatched startup target sends per run remain included in the request counts on both sides; their target attribution is unknown and they contribute no claimed saving. CI seconds are unmeasured. The full local check result is the inherited dead-export failure described above, not an unqualified green result. The published-driver update cell passed on the final candidate; see the landing verification below.

Focused test groups and measured local wall time
Evidence Passed / skipped Files Vitest wall time Wrapper wall time Reuse
focused-7-worker-protocol 69 3 8.81s 62.59s pre-integration reused proof
focused-7-schema-policy 45 1 35.54s 49.19s pre-integration reused proof
focused-7-archive 21 5 30.48s 36.13s pre-integration reused proof
focused-7-subagent-store 32 1 20.35s 25.63s pre-integration reused proof
focused-3-corrected-core 144 4 223.09s 354.77s pre-integration reused proof
focused-5-auth 19 2 15.29s 18.08s pre-integration reused proof
focused-5-canonical-readiness 16 1 22.42s 24.82s pre-integration reused proof
focused-4-workboard 107 2 99.22s 106.62s pre-integration reused proof
integrated-core 199 5 104.49s 129.7s post-integration proof
integrated-sessions 66 6 250.21s + 55.23s 325.32s post-integration proof
integrated-archive 12 2 47.86s 59.67s post-integration proof
integrated-state-fixed 43 3 23.64s + 46.39s 118.21s post-integration proof
test-extractions 4 / 76 skipped 2 82.37s + 49.15s 163.15s post-integration proof
workboard-sibling-green 71 4 67.56s 81.53s final scoped correction
temp-drop-green 113 2 65.98s 78.01s final scoped correction
postreview-admission-fixture 1 / 49 skipped 1 23.19s 58.16s final scoped correction

Earlier groups are reused proof for unchanged behavior, not relabeled as final-head whole-suite runs. Successful owner files within failed aggregates and every original failure remain recorded in the local proof ledger. CI seconds are unmeasured; no combined grand total is claimed across overlapping suites.

Landing verification (reviewed head b67d735)

Merged main without conflicts and repaired its new migration-witness caller to use the existing read-snapshot owner after removal of the old pinned helper. The two-line repair received a clean focused P0/P1 review. Final-candidate Testbox proof: migration preservation and canonical validation passed (43.83s), and the formerly timing-out stale-geometry E2E passed (19.39s) after incorporating main's session metadata fixture repair.

The published-driver update cell passed on Testbox run 38047927911: published 2026.9.9 → candidate 2026.9.9, update exit 0, readiness 200, running version, durable state and incognito checks passed. Candidate package SHA256: e9345b4ef2a1cc59d285e4d7303b33855ca9d6ef9488701000764c6b1a507cd9. The source receipt binds the tested tree to this head.

CI for b67d735fd606, run 38048756808 completed with seven inherited failing test jobs; it is not green. The concurrent main run 38048680925, at b0e5f302dd8d, independently shows the same cold-recall error (job 114203388563), scoped-discovery call count (114203388137), worker-placement evidence mismatch (114203388385), collaborator scroll (114203387187), position rail in both themes (114203387147), and native navigation geometry (114203387133). All failing test inputs are unchanged; the entire UI tree matches the tested main baseline.

The seventh failure, package-openclaw-for-docker / “loads from a trusted harness checkout without installed dependencies,” independently reproduces on current main c03681e7460c7: the copied fixture omits scripts/lib/managed-cleanup-handoff.mts, producing the same ERR_MODULE_NOT_FOUND before argument validation or database code. Command: pnpm test test/e2e/qa-lab/runtime/package-openclaw-for-docker.e2e.test.ts --maxWorkers=1 -t 'loads from a trusted harness checkout without installed dependencies' (66.50s Vitest / 73.41s wrapper). The fixture and direct script inputs match the CI baseline. No jobs were cancelled. These failures use the explicitly authorized native inherited-failure admin exception; required security and review gates remain enforced.

Main integration (head 6ac9f28)

Merged main e3415ea8c554 by merge commit faa09b825b293, resolving the admission-relay extraction without restoring freshness probes. The five-file integration passed focused P0/P1 review. Blacksmith Testbox lease tbx_01m4jv5kbxjtgh573e98z54kcj verified source tree 0745a5c648a4a42516812b002097c06f463847ad: 88 tests across six admission, timeout, attachment, lease-heartbeat, and archive files passed in 81.13s across two shards. The lease is stopped. The earlier published-driver update pass is reused for this conflict-only integration.

Commit 6ac9f2841de4 applies the formatter-required import order in the archive worker; the single-file format check and focused P0/P1 review passed. CI run 38051402056 completed with 123 successful jobs, 21 skipped jobs, six failing test jobs and the downstream aggregate failure; no jobs were cancelled. The six failures are the cold-recall error, scoped-discovery call count, worker-placement evidence mismatch, collaborator scroll, position rail and native navigation geometry independently observed in main run 38048680925. The failing test inputs match the tested main baseline. The prior packaging-fixture failure is fixed by the incorporated main changes and absent from this run. Current-head CI remains red under the explicitly authorized inherited-failure exception.

Native admin admission accepted the recorded CI attribution and enforced review/security evidence, then GitHub rejected the squash request with HTTP 405: “Base branch was modified. Review and try the merge again.” The documented same-head recovery is currently blocked by Prior-CI admin admission: provider rejection requires exactly the expected captures: the preserved capture from the retired auto-merge attempt is not included in the validator's expected set. Both captures and the retained outcome are preserved; no direct merge or capture removal was used. GitHub now also reports a conflict in src/gateway/server-worker-placement-session-target.test.ts. The PR remains open at 6ac9f2841de4; no further branch changes have been made while native recovery is blocked.

Final landing (head 379de23)

Landed as 1d76f57, verified on origin/main, from head 379de23edd800bb6bbf19d298aa6965852c174df.

The final push only resolved the test-file conflict while merging main: it kept the incognito-placement case and the receipt-aware writer. All 55 focused tests across three files passed (234.53s wrapper time), and the conflict resolution received a clean P0/P1 review. The published-driver update cell remains valid and was reused for this test-only integration.

Final-head CI finished with 124 successful jobs, 21 skipped jobs, four independently inherited failures, and the downstream aggregate failure. It was not green:

Failed PR job Independent main evidence
Session-accessor boundary: six legacy call sites, baseline zero Current main reports the identical diagnostic.
Sandbox SDK process ownership: directory snapshot sees new Bun compiler-cache files Reproduced the same test and assertion on clean main 7b125134f3860743c55696b3f273ed82abe535dc, using OPENCLAW_VITEST_RUNTIME=bun node scripts/run-vitest.mjs src/agents/sandbox/sdk-state-owner.process.test.ts --maxWorkers=1. It failed on new .pile compiler-cache entries; macOS uses Library/Caches/bun, while Linux uses .bun/install/cache. Test 3.251s; wrapper 45.21s.
Damaged-archive cold recall: SessionTranscriptColdError Same case on main; prior validated attribution reused.
Worker-placement evidence: all unknown instead of unknown/current/absent Same assertion on main; prior validated attribution reused.

The relevant failing inputs are unchanged by the PR; security-fast, Security High checks and security-sensitive review succeeded. No failed job was rerun. Used the explicitly approved inherited-CI exception and head-pinned REST squash fallback after native merge returned HTTP 405 and native recovery rejected its preserved historical capture. The squash preserves the native title/body and human attribution, with no agent trailers.

…odules

Merge current main while preserving shared physical admission, cancellation, reader validation birthtime, and live deletion authority. Split worker usage, pool construction, failure settlement, and schema owner types to keep the existing line caps.
Checkpoint the single-owner cutover, cache invalidation regressions, and request-owned read transactions. Keep explicit migration verification. Paired measurement and final validation are still in progress.
Route retained existing-state writer coverage through the host-owned worker project, preserve first-admission incompatibility refusal, and match the final deletion-authority contract. Keep the gateway test under its inherited line count by moving existing pure fixture helpers. Regenerate assertion allowances without adding production assertions.
Include the thirteen transitive admission modules required by the native wrapper import-closure proof. Carry the existing birthtime through the worker validation fixture to preserve its physical-file identity.
Merge current main and preserve its optional settlement-only receipt delivery through the extracted owner. Keep the worker refusal error with the leaf contract to stay within the existing admission line cap. End the marker-free read-only fixture transaction normally; dedicated rollback and explicit revocation coverage remains unchanged.
Preserve snapshot-local reuse without freshness queries, publish dedicated archive writes, and remove Workboard polling. Retain native authority and settlement boundaries. Checkpoint reviewed corrections and focused regression repairs; final integrated proof remains in progress.
@clawsweeper

clawsweeper Bot commented Oct 9, 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 gateway Gateway runtime agents Agent runtime and tooling plugin: file-transfer plugin: workboard size: XL labels Oct 9, 2026
@steipete
steipete enabled auto-merge (squash) October 10, 2026 12:27
@steipete

Copy link
Copy Markdown
Contributor Author

Landed as 1d76f57, verified on origin/main, from head 379de23edd800bb6bbf19d298aa6965852c174df.

The final push only resolved the test-file conflict while merging main: it kept the incognito-placement case and the receipt-aware writer. All 55 focused tests across three files passed (234.53s wrapper time), and the conflict resolution received a clean P0/P1 review. The published-driver update cell remains valid and was reused for this test-only integration.

Final-head CI finished with 124 successful jobs, 21 skipped jobs, four independently inherited failures, and the downstream aggregate failure. It was not green:

Failed PR job Independent main evidence
Session-accessor boundary: six legacy call sites, baseline zero Current main reports the identical diagnostic.
Sandbox SDK process ownership: directory snapshot sees new Bun compiler-cache files Reproduced the same test and assertion on clean main 7b125134f3860743c55696b3f273ed82abe535dc, using OPENCLAW_VITEST_RUNTIME=bun node scripts/run-vitest.mjs src/agents/sandbox/sdk-state-owner.process.test.ts --maxWorkers=1. It failed on new .pile compiler-cache entries; macOS uses Library/Caches/bun, while Linux uses .bun/install/cache. Test 3.251s; wrapper 45.21s.
Damaged-archive cold recall: SessionTranscriptColdError Same case on main; prior validated attribution reused.
Worker-placement evidence: all unknown instead of unknown/current/absent Same assertion on main; prior validated attribution reused.

The relevant failing inputs are unchanged by the PR; security-fast, Security High checks and security-sensitive review succeeded. No failed job was rerun. Used the explicitly approved inherited-CI exception and head-pinned REST squash fallback after native merge returned HTTP 405 and native recovery rejected its preserved historical capture. The squash preserves the native title/body and human attribution, with no agent trailers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. plugin: file-transfer plugin: workboard rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. security-sensitive-changed size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant