Skip to content

fix(sqlite): avoid repeated validation after session tracker setup - #166698

Merged
steipete merged 4 commits into
mainfrom
dbasync/tempreceipt
Oct 7, 2026
Merged

steipete merged 4 commits into
mainfrom
dbasync/tempreceipt

Conversation

@steipete

@steipete steipete commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes redundant schema validation after the session generation tracker initializes on an already-admitted SQLite connection.

User Impact

Cold session operations and maintenance avoid unnecessary schema work. After integration, first-turn ALL-thread statements drop by 174, warmed turns by 1.0, and focused maintenance by 173. Durable schemas, stored data, retention, permissions, and update behavior are unchanged; no migration or operator action is required.

Approved correctness exception: compaction increases by 38 statements because the candidate performs required readmission after real memory DDL. Baseline main currently skips that validation because of a preexisting host/worker schema-receipt handoff gap. The coordinator explicitly approved preserving these checks over meeting the statement estimate. The raw increase remains visible below; it is not labeled a passing numeric gate or subtracted from the measurements.

Why This Change Was Made

The tracker's connection-local TEMP DDL was revoking the schema receipt, forcing later operations to rebuild expected schema and repeat admission. The tracker now declares its counter and typed INSERT/UPDATE/DELETE triggers to the existing schema owner. That owner generates the fixed definitions and checks existing TEMP objects by name, type, target table, and normalized SQL before preserving the receipt.

Initialization stays lazy, avoiding tracker creation on connections that never need it. Unexpected TEMP/main DDL, wrong-shaped same-named objects, reentrant DDL, and partial installation failures still revoke admission. Execution and revocation remain with the existing schema observer.

Follow-up: repair schema receipt publication/adoption across host and worker replacements. Republishing a host receipt must not leave a retained worker invalidating an older validity cell. That owner-level repair needs a regression proving shared revocation across republishing.

Evidence

The real agent-database regression fails on baseline with 28 catalog inspections after first-use tracking and passes on the candidate with zero, while the original receipt remains valid. Negative cases cover ordinary TEMP/main DDL, tracker tampering, mismatched existing tables/triggers, reentrant DDL, and partial installation failure. Existing tests also cover matching reinstall, raw DML generation increments, rollback, foreign commits, and admission lifetime.

Pre-integration statement measurements and approved attribution

Counts are successful native SQL executions. MAIN is the main-thread count; ALL includes every worker and background thread. Nothing is subtracted. Values are side medians across alternating baseline/candidate pairs; warmed values are ten-turn means. All gated duration ratios are below 1.5.

Three fixed pairs ran on one dedicated AWS Linux host with Node 24.21.0, separate frozen source-mapped builds, and 99.69–100% CPU idleness before each run. All six functional workloads completed, and classification conserved every successful statement.

Ordinary phase MAIN baseline → candidate ALL baseline → candidate ALL delta Wall ratio
Boot 2,353 → 2,353 3,383 → 3,383 0 1.003
Connect 14 → 14 344 → 339 −5 0.988
First turn 308 → 126 4,737 → 4,562 −175 1.001
Warmed mean 28 → 28 1,594.6 → 1,593.2 −1.4 0.999
Second session 143 → 144 5,386 → 5,387 +1 0.998
Control plane 0 → 0 55 → 51 −4 1.000
Cron 50 → 50 1,564 → 1,568 +4 0.999
Compaction 44 → 44 820 → 858 +38, approved correctness cost 1.022
Shutdown 201 → 201 882 → 882 0 0.983

The first-turn and warmed gates pass strictly; no noise-floor qualification is used. Second-session +1 comes from unchanged session/participant timer reads and RPC timing. Cron +4 comes from existing audit retry/timeout controls and state-cache admission reads.

The real focused maintenance workload, including managed backdate/recheck assertions, ran in three local alternating pairs. Every statement count was identical across all three runs per side:

Maintenance phase MAIN baseline → candidate ALL baseline → candidate Wall ratio
Warm 21 → 21 683 → 681 1.159
Foreign cadence 22 → 22 221 → 50 0.359
Managed backdate 14 → 14 33 → 33 0.958
Recheck 22 → 22 87 → 87 1.261
Total 79 → 79 1,024 → 851 —

Maintenance drops 173 statements (16.89%), with no phase increase. On this baseline, redundant readmission occurs in foreign cadence; managed backdate and recheck remain unchanged. The new one-time TEMP shape inspection is counted, and no TEMP shape inspections occur in warmed turn windows.

Why compaction adds 38

Compaction admission component Baseline Candidate Delta
Validation after real memory DDL 3 direct schema-fact probes 40 full readmission statements +37
Exact tracker TEMP-shape inspection 0 1 +1
Total owning-path change 3 41 +38

Tracker DDL/DML spelling and qualification changes have zero net statement count. The retained primary writer shows the same sequence in every pair. Pair 1's native trace is:

Baseline main, writer thread 15 (sql-11484-15.jsonl)
  memory-publication TEMP input + main memory-index/provenance/FTS DDL
  line 11752, site 1410: DROP TABLE temp.memory_publication_input
  getAdmittedSqliteSchemaFacts: 3 probes
  session replacement / tracker reinstall
  refreshOpenClawAgentDatabaseSchema in compaction: 0 statements

Candidate, writer thread 15 (sql-12027-15.jsonl)
  same memory-publication TEMP input + main memory-index/provenance/FTS DDL
  line 11902, site 1406: DROP TABLE temp.memory_publication_input
  line 11904, site 1407: database.prepareWrite
    → openClaimedWriter(refreshSchema)
    → refreshOpenClawAgentDatabaseSchema
    → agentDatabaseIntegrityBeforeMutationSteps: 40 statements
  tracker reinstall, including 1 exact TEMP-shape inspection

All three baseline runs also execute 133 expected-agent-schema statements on the Gateway thread during the first turn under loadTranscriptHeaderSync → openOpenClawAgentDatabaseSteps → agentDatabaseIntegrityBeforeMutationSteps → buildSqliteSchemaContract; all three candidates execute zero in that path. Baseline pair 1 records this at sql-11484-0.jsonl, site 1666.

Source explains the handoff gap: the baseline TEMP revocation provokes a host reopen that takes !reusedSchema publication. publishOpenClawAgentDatabaseSchema allocates a new SharedArrayBuffer and replaces the host object's schema slot. The worker retains its structured-cloned object and older cell; its later DDL listener can revoke that cell while the host's replacement remains valid. requiresReadmission then skips baseline validation. The candidate avoids the erroneous initial republish, keeping the live cell shared until real DDL revokes it and correctly requests readmission.

The SQL branches and ordering are directly observed; SharedArrayBuffer identities/property assignments were not instrumented, so the precise stale-cell mechanism is source-traced inference. The coordinator accepted this attribution and approved the correctness cost. Compaction+shutdown still exceeds the original estimate: baseline sums [1698, 1702, 1702], candidate [1740, 1740, 1740], medians 1,702 → 1,740 (+2.23%). No alternate window is used to hide the increase, and no real-DDL checks are suppressed.

Earlier loaded-host cohort and native lock diagnostics

The initial three local ordinary pairs had invalid second-session/shutdown duration ratios, so two more pairs were added and all five retained. Final ratios were valid, but shutdown remained variable. These results motivated the separate dedicated-host cohort; they were not pooled with AWS or relabeled as a passing numeric gate.

Local ordinary phase ALL baseline → candidate Wall ratio
Boot 3,387 → 3,386 0.764
Connect 346 → 336 0.925
First turn 4,732 → 4,538 0.732
Warmed mean 1,609.4 → 1,602.0 1.163
Second session 5,572 → 5,480 1.133
Control plane 53 → 65 1.038
Cron 1,571 → 1,598 1.048
Compaction 692 → 666 1.094
Shutdown 1,008 → 1,743 1.358

Control+cron sums: baseline [1616, 1668, 1626, 1655, 1680], candidate [1580, 1863, 1880, 1663, 1651], median +0.48%, attributed to unchanged WAL maintenance, plugin-state/device inventory, and state-cache owners. Compaction+shutdown sums: baseline [1700, 1707, 2533, 1783, 1745], candidate [2399, 1740, 2427, 1752, 2391], median +37.02%, which remains a failed local count result. High-shutdown runs open a cold writer during late memory publication on both sides; its expected-schema batch costs 606 statements on baseline versus 473 on the candidate. The traces support preexisting drain ordering but do not prove why high-mode frequency differed on the loaded host.

All functional workloads completed. Native BEGIN IMMEDIATE: database is locked refusals remain separately recorded under the successful-statement counting contract:

Cohort Baseline Candidate Owner/phase
Local pair 3 3 4 Audit-retention pruning during shutdown
AWS pair 3 1 2 Restart-safe chat admission during first turn
AWS pair 2 0 1 Audit writer during cron

All other ordinary runs and all focused maintenance runs had zero native failures. There were no AWS shutdown failures. Earlier Testbox sync and AWS preflight attempts ran no measurement samples. All owned remote leases were stopped and verified released.

Tests, review, compatibility, and update proof

All 180 focused tests passed across schema facts, worker admission, session revalidation, maintenance worker, and validation-cache suites. Standalone changed-test file costs with pnpm test <file> --maxWorkers=1: schema facts 23.479 s (39 tests), worker admission 203.828 s (23 tests). The new admission regression itself took about 1.7 s. The five-file run took 1,635.86 s on the loaded host. After the final test-only binding correction, all 39 schema-facts tests passed again in 13.13 s command wall time. PR CI runtime is not yet measured.

pnpm check:changed --base 7a8e5a19b68b5f3b3f824ba4f17ac6763d1a8063 passed end to end at the final head. Madge reports zero cycles; the SQLite worker ratchet reports no T1 growth. P2 Codex reviews are clean for the production change and final test-only correction.

SDK comparison: no public entrypoints added/removed and all direct public export declarations/kinds unchanged. There are 131 reachable closure-hash changes from two internal declaration deltas: the schema-facts installer/import and new TEMP schema helper. No public barrel or exports map changed.

The published 2026.9.8 driver updated successfully to candidate a16efa57f4e63bbb12786a8f5691092522953e92: all 19 command phases exited 0, readiness returned 200, durable history survived, and incognito history cleared on managed restart. The delegated Testbox command settled successfully; the hosting Actions run ended CANCELLED during lease cleanup and is not claimed as green CI. Production source was unchanged through approved head a87e846cebcd751587b52d77deb3d4401afd5fd5; these receipts predate the main integration. Candidate tarball SHA-256: f31d6b4d6b5ea6d998dd35da15a571c1ae59ddb18d397d51c8d581a362509cad.

Runtime, package, and SDK evidence is pinned to a16efa57f4e63bbb12786a8f5691092522953e92, against baseline 7a8e5a19b68b5f3b3f824ba4f17ac6763d1a8063. Final head a87e846cebcd751587b52d77deb3d4401afd5fd5 changes only a test's native exec binding; production bytes are identical. Dedicated-cohort archive SHA-256: b87d2937348a88955cd64b5bd2c53ed9d56638d635d3c7684dd09acbd361a079.

Landing integration and review

Integrated main 94fc0814ef649e2fd630aebe9836e36dec65009e without conflicts in merge commit b6d5c68f3855b048ff0fd81aa2adc04525aa1851. Fix 0cfce3df4ed0dc9deb3b2ad85b1c6ea964084f53 adds the new TEMP helper to the compiled PR-wrapper dependency inventory. The original CI failures in compact-small-1 and changed-7 were PR-caused: extracted wrappers omitted that module; the provisioning fixture then failed before recording its private-store initialization. No assertions were weakened. The focused inventory test passes, and P2 review of the integrated change is clean. Current-head CI run 37670946776 passed. Production and all selected test typecheck lanes, Madge (zero cycles), formatting, targeted lint, wrapper/import closure, and all 23 worker-admission tests passed. The released SDK diff completed against v2026.9.8; its cross-release API changes are inherited from main, and this PR adds no public signature or export removal. Post-integration alternating-pair statement measurements passed the turn and maintenance gates; detailed values and the approved compaction exception follow below.

ClawSweeper completed its latest review of 0cfce3df4ed0dc9deb3b2ad85b1c6ea964084f53 on October 7 at 19:24 UTC and found no actionable code/security defect. Its automated persisted-table checklist warning remains, while the technical review confirms the TEMP-only boundary and no durable migration contract; the maintainer assessment rejects that warning as inapplicable. Its automatic persisted-table warning is inapplicable: the generated counter and triggers are connection-local TEMP objects; durable schemas and migrations do not change. Existing published-driver command receipts provide pre-integration update proof as qualified above. Latest stable and beta SDK source inspection found no changed public signature, async/callback contract, or removed export. No new environment-variable names or worker/host-grant cutover are introduced.

Inherited local test limitation: the macOS-only pr-worktree-provision.test.ts cold/warm/sparse transition case exceeded its unchanged 120-second Vitest budget (193.061 s observed) in the combined run. The infra project had 77 passing tests and one skipped case; the original missing-module provisioning failures are fixed. Linux CI skips the macOS-specific case. The test creates six real worktrees using synchronous wrapper commands; neighboring single-worktree cases took 25–81 s. The test, fixture helpers, and worktree/provisioning implementation match baseline main, but the changed shared SQLite owner is reachable, so source equality alone does not establish attribution. Five focused --maxWorkers=1 runs on baseline and five on candidate all reproduced the same 120-second timeout, with no other failure. Command wall seconds were main [222.51, 234.24, 318.9, 473.27, 240.62] and candidate [231.03, 280.28, 373.69, 231.6, 319.67]. The precise slow inner operation is uninstrumented; this establishes an inherited local fixture deadline failure, not a repaired fixture or a passing replay. Current-head CI is green, so no admin CI exception is needed.

Post-integration statement proof

Pinned baseline 94fc0814ef649e2fd630aebe9836e36dec65009e versus integrated candidate 0cfce3df4ed0dc9deb3b2ad85b1c6ea964084f53. Three alternating pairs ran on one dedicated AWS c7a.2xlarge host with Node 24.21.0, separate frozen source-mapped qaRuntime builds, and unchanged ordinary/maintenance workload bytes. Before-run CPU idleness was 99.875–100%. All twelve workload cells passed; classification reproduced every successful phase/thread/SQL count exactly. All gated candidate/main median duration ratios are below 1.5.

Raw successful ALL-thread statements decide the gate; nothing is subtracted. Warmed values are ten-turn means. First turn falls by 174, warmed mean by 1.0, and maintenance by 173. The existing +38 compaction correctness exception remains explicit and approved; the numeric classifier continues to label that phase above its normal ceiling.

Ordinary

Phase MAIN median before → after ALL median before → after ALL delta Wall ratio
Boot 2353 → 2353 3381 → 3382 +1 0.997
Connect 0 → 0 327 → 326 -1 1.003
First turn 300 → 130 4728 → 4554 -174 0.999
Warmed mean 28 → 28 1589.8 → 1588.8 -1 0.998
Second session 143 → 143 5319 → 5316 -3 1.008
Control plane 0 → 0 55 → 55 +0 1.000
Cron 50 → 50 1487 → 1472 -15 1.001
Compaction 44 → 44 820 → 858 +38 0.979
Shutdown 201 → 201 882 → 896 +14 0.973

Maintenance

Phase MAIN median before → after ALL median before → after ALL delta Wall ratio
Foreign cadence 22 → 22 221 → 50 -171 0.398
Managed backdate 14 → 14 33 → 33 +0 1.008
Recheck 22 → 22 87 → 87 +0 1.047
Warm 21 → 21 681 → 679 -2 0.995

Maintenance totals are identical within each side: main [1022, 1022, 1022], candidate [849, 849, 849], a 173-statement (16.93%) reduction. No maintenance phase increases.

Growth attribution. Boot +1 is one additional execution of the existing deliveryQueue.outbound pending-delivery scan (src/state/openclaw-state-read.worker.ts:259, src/infra/outbound/delivery-queue-storage.kernel.ts:88). Four shared-state schema-admission statements change their requesting path from mentions.mutate to audit.writer.prune, with net zero statements. Shutdown +14 (+1.59%) is one existing session-row-facts batch (+11 statements, including two watermark reads) and its ACP/shared-state metadata read (+3). The owning dispatch/read implementations are byte-identical between baseline and candidate; this PR adds no request in these owners. These unchanged-owner variations pass the non-turn tolerance. Twelve of the thirteen positive shutdown SQL+full-stack groups also occur in baseline traces. The remaining +1 participant query uses the same unchanged readParticipantRows SQL/owner, observed on baseline through the membership-read path rather than this exact row-facts stack. This passes the individual +1.59% unchanged-owner tolerance; it does not use the stricter adjacent-window rule requiring every full-stack group to recur. The native observer loses the original sender across the asynchronous worker boundary, so this establishes the read owners rather than claiming direct timer provenance for every statement.

Compaction remains 820 → 858: required real-DDL readmission (40 statements) replaces three direct schema-fact probes, and exact TEMP shape inspection adds one. Keep the coordinator-approved correctness cost and the existing host/worker receipt publication/adoption follow-up; do not suppress the readmission. Combined compaction+shutdown sums are main [1696, 1702, 1702], candidate [1754, 1740, 1754], medians 1702 → 1754 (+3.06%). No combined window hides the exception.

Native diagnostics. Ordinary main/candidate native failures are both [0, 0, 0]; maintenance main/candidate are both [0, 0, 0]. All twelve calibration traces (main thread and worker on each ordinary run) independently show 8 native calls, 2 prepares, 7 successful statements, zero failures. All harness children settled; maintenance instrumentation restored the exact tracked source after every run.

ALL-thread samples in alternating-pair order
Phase Main runs Candidate runs
ordinary: Boot [3385, 3381, 3381] [3381, 3382, 3382]
ordinary: Connect [365, 324, 327] [329, 323, 326]
ordinary: First turn [4657, 4731, 4728] [4554, 4558, 4541]
ordinary: Warmed mean [1590.1, 1589.8, 1588.8] [1587.8, 1588.8, 1590.9]
ordinary: Second session [5319, 5320, 5318] [5316, 5311, 5430]
ordinary: Control plane [53, 55, 57] [51, 55, 55]
ordinary: Cron [1517, 1470, 1487] [1468, 1472, 1489]
ordinary: Compaction [812, 820, 820] [858, 858, 858]
ordinary: Shutdown [884, 882, 882] [896, 882, 896]
maintenance: Foreign cadence [221, 221, 221] [50, 50, 50]
maintenance: Managed backdate [33, 33, 33] [33, 33, 33]
maintenance: Recheck [87, 87, 87] [87, 87, 87]
maintenance: Warm [681, 681, 681] [679, 679, 679]

The dedicated AWS lease was released immediately after archive verification; its final state was verified as released. The 145,843,959-byte archive matches its remote SHA-256: de49e1355524d4f4dcf74bd66931203dc81c690110079db854bb02d38d061846.

Keep first-use session generation tracking from revoking shared schema admission. Install typed TEMP counter and trigger definitions through the existing schema observer, verify any existing matching names, and retain ordinary revocation for drift, reentrant DDL, and partial batches. No persistent schema, stored bytes, or update behavior changes.
Bind the preserved native method to the fixture database before injecting reentrant DDL, keeping the callback receiver explicit.
@clawsweeper

clawsweeper Bot commented Oct 7, 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 7, 2026
@steipete

steipete commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 7, 2026, 3:24 PM ET / 19:24 UTC (Revision 4).

ClawSweeper review

What this changes

The PR preserves SQLite validation when installing the session cache’s temporary change counter and triggers, with regression coverage, documentation, and wrapper packaging updates.

Warning

SQLite table change

This PR modifies persisted SQLite tables in src/infra/sqlite-schema-facts.ts, src/infra/sqlite-temp-generation-schema.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 PR remains useful: current main still revokes schema admission during first-use tracker setup. No introduced correctness or security defect was found, and the runtime evidence supports the focused repair without an additional review blocker.

Priority: P2
Reviewed head: 0cfce3df4ed0dc9deb3b2ad85b1c6ea964084f53

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable repair with strong native runtime evidence and no blocking findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): Native baseline/candidate traces exercise the changed SQLite schema owner through real session, maintenance, and compaction workloads on Linux, showing reduced redundant validation while real DDL still requests readmission. Changed production bytes match the measured candidate at the integrated head. TEMP-only objects introduce no stored-data migration contract; update receipts are explicitly pre-integration evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): Native baseline/candidate traces exercise the changed SQLite schema owner through real session, maintenance, and compaction workloads on Linux, showing reduced redundant validation while real DDL still requests readmission. Changed production bytes match the measured candidate at the integrated head. TEMP-only objects introduce no stored-data migration contract; update receipts are explicitly pre-integration evidence.
Evidence reviewed 8 items Pinned introduced change: Reviewed the complete merge-base-to-head diff. The production change routes tracker installation through the existing schema observer; the final tooling commit includes the helper in the extracted wrapper inventory.
Current main still needs the repair: At fetched main, tracker setup still executes ordinary CREATE/DROP TEMP DDL through database.exec, whose schema observer invalidates facts and notifies receipt listeners. The relevant production owners are unchanged between the pinned base and fetched main. No verified merged replacement was established.
Conservative schema invalidation: The helper checks existing TEMP object names, types, target tables, and normalized definitions. Installation retains ordinary observer execution, including reentrant DDL, and explicitly invalidates facts after a failed batch. Regression cases cover unexpected DDL, tampering, mismatched objects, partial failure, and matching reinstall.
Findings None None.
Security None None.

How this fits together

Session caches use SQLite change counters to detect stale session data. The database schema owner installs those counters and controls whether validated database facts can be reused or must be checked again.

flowchart TD
  A[Session reads and maintenance] --> B[Session change tracker]
  B --> C[SQLite schema owner]
  C --> D{Declared TEMP shapes match?}
  D -->|Yes| E[Preserve validation receipt]
  D -->|No or installation fails| F[Revoke validation receipt]
  E --> G[Reuse admitted database facts]
  F --> H[Readmit database schema]
Loading

Before merge

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

Security

None.

PR surface

Source +100, Tests +87, Docs +4, Other +1. Total +192 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 3 124 24 +100
Tests 2 87 0 +87
Docs 1 5 1 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 0 +1
Total 7 217 25 +192

Review metrics

Metric Value Why it matters
Production versus regression growth production +100 net lines; tests +87 lines Production growth provides typed TEMP generation and exact-shape validation within the existing schema owner; tests protect receipt retention and conservative invalidation.

Stored data model

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

Technical review

Best possible solution:

Keep lazy tracker installation under the existing schema owner, preserving admission only for verified TEMP shapes while retaining invalidation for real schema changes and failures.

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

Yes, source establishes the path: first-use session tracking executes TEMP DDL through the ordinary schema observer and revokes admission on current main. The submitted baseline regression and native traces corroborate it; this review did not execute the path.

Is this the best way to solve the issue?

Yes, the patch gives the existing schema owner a narrow typed installation path instead of suppressing DDL observation broadly or introducing another validation owner.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded SQLite performance and admission-correctness repair with measured first-turn and maintenance benefits.
  • 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): Native baseline/candidate traces exercise the changed SQLite schema owner through real session, maintenance, and compaction workloads on Linux, showing reduced redundant validation while real DDL still requests readmission. Changed production bytes match the measured candidate at the integrated head. TEMP-only objects introduce no stored-data migration contract; update receipts are explicitly pre-integration evidence.
  • proof: sufficient: Contributor real behavior proof is sufficient. Native baseline/candidate traces exercise the changed SQLite schema owner through real session, maintenance, and compaction workloads on Linux, showing reduced redundant validation while real DDL still requests readmission. Changed production bytes match the measured candidate at the integrated head. TEMP-only objects introduce no stored-data migration contract; update receipts are explicitly pre-integration evidence.

Evidence

What I checked:

  • Pinned introduced change: Reviewed the complete merge-base-to-head diff. The production change routes tracker installation through the existing schema observer; the final tooling commit includes the helper in the extracted wrapper inventory. (src/infra/sqlite-schema-facts.ts:302, 0cfce3df4ed0)
  • Current main still needs the repair: At fetched main, tracker setup still executes ordinary CREATE/DROP TEMP DDL through database.exec, whose schema observer invalidates facts and notifies receipt listeners. The relevant production owners are unchanged between the pinned base and fetched main. No verified merged replacement was established. (src/config/sessions/session-accessor.sqlite-entry-revision.ts:50, cbfbdc8ddb95)
  • Conservative schema invalidation: The helper checks existing TEMP object names, types, target tables, and normalized definitions. Installation retains ordinary observer execution, including reentrant DDL, and explicitly invalidates facts after a failed batch. Regression cases cover unexpected DDL, tampering, mismatched objects, partial failure, and matching reinstall. (src/infra/sqlite-temp-generation-schema.ts:43, 0cfce3df4ed0)
  • Runtime proof and captured body identity: Read the complete live body and verified it matches captured SHA-256 441e999118eced08326d7d4aa62c7544bd5104b7e0ed1eab5319cc5e803e170a, with 15,036 UTF-16 units. Its native Linux baseline/candidate traces exercise real first-turn, maintenance, and compaction paths: first-turn statements decrease by 175 and maintenance by 173. The three changed production files have no diff between measured candidate a16efa5 and the reviewed head. (a16efa57f4e6)
  • Recorded correctness tradeoff: The maintainer-authored body records coordinator acceptance of 38 additional compaction statements for required readmission after real memory DDL. It distinguishes observed SQL ordering from the source-inferred preexisting receipt handoff gap and records that gap as separate follow-up work. This accepted cost does not require renewed acceptance. (0cfce3df4ed0)
  • No durable data-model change: Generated storage consists solely of a TEMP counter and TEMP triggers; no persistent schema, version marker, migration, retention, or public SDK signature changes. The body also records a published 2026.9.8-driver update to the measured candidate with readiness and retained-history checks, explicitly qualified as pre-integration proof. (src/infra/sqlite-temp-generation-schema.ts:60, 0cfce3df4ed0)

Likely related people:

  • steipete: 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 (3 earlier review cycles)
  • reviewed 2026-10-07T18:49:00.194Z sha a87e846 :: blocked before merge. :: none
  • reviewed 2026-10-07T18:54:44.846Z sha a87e846 :: blocked before merge. :: none
  • reviewed 2026-10-07T19:03:45.511Z sha 0cfce3d :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added 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. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 7, 2026
@steipete

steipete commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Oct 7, 2026
@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete merged commit 653294c into main Oct 7, 2026
156 checks passed
@steipete
steipete deleted the dbasync/tempreceipt branch October 7, 2026 19:39
@steipete

steipete commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Oct 7, 2026
Merge main at e1dbb59 after #166698 landed. Keep the selected session execution and foreground fact implementation, and its freshness-fixture correction, unchanged while incorporating the canonical TEMP generation admission fix.

The integration required no conflict resolution or additional product changes. Fresh P2 review is clean; affected checks and alternating statement measurements remain required before landing.
steipete added a commit that referenced this pull request Oct 8, 2026
* fix(sqlite): preserve admission during transcript tracker setup

Extend the checked TEMP tracking owner introduced in #166698 to the fixed
transcript-index status table, pending queue, index and enqueue triggers.
Installing these connection-local objects must not revoke the agent database's
main-schema admission receipt. Ordinary DDL, unexpected object shapes,
reentrant mutations and partial installation failures still revoke it.

Move the existing SQL into the typed builder and migrate both tracking callers
to its shared operation. Preserve local read revisions, rollback staging and
INSERT OR REPLACE behavior. No persisted schema, stored bytes, migration,
public SDK contract, retry or timeout changes.

The existing status-owner regression fails on the parent at first tracker
installation. All six owner cases pass after the repair (1.78s invocation),
including drift, rollback, foreign writes and bounded cleanup. P2 review is
clean. The broader restart investigation and Linux gates remain recorded in
the task evidence; this commit alone is not a claim that the QA race is fixed.

* fix(state): retain valid admission across concurrent opens

A startup reader can publish canonical proof before native admission starts.
A concurrent fully checked host open then registered the same database by
revoking that proof, rejecting the pending native receipt and failing the
post-restart turn before a provider request could begin.

Publish the checked opener's registration through the validation owner and
promote live proof without retiring its pending handoff. Keep physical-file
replacement and explicit lifecycle revocation strict. Reject stale required
schema receipts before they can replace newer facts, and retain the shared
schema revocation cell for matching live schemas. Accepted schema changes
and schema-optional revocation reports retire the displaced borrowers.

Regressions cover canonical and empty promotion, physical replacement,
revocation, delayed publication, and borrowed-schema retirement. All 36
receipt-owner cases pass (30.60s Vitest, 34.03s wrapper); the corresponding
negative controls failed before their repairs. P2 review is clean. Linux
pressure, owner-suite, and static gates are tracked separately before landing.
No stored data, schema version, public SDK, retry, or timeout changes.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 8, 2026
…penclaw#166698)

* fix(sqlite): retain admission during generation tracker setup

Keep first-use session generation tracking from revoking shared schema admission. Install typed TEMP counter and trigger definitions through the existing schema observer, verify any existing matching names, and retain ordinary revocation for drift, reentrant DDL, and partial batches. No persistent schema, stored bytes, or update behavior changes.

* test(sqlite): bind native exec in DDL observation proof

Bind the preserved native method to the fixture database before injecting reentrant DDL, keeping the callback receiver explicit.

* fix(tooling): include TEMP generation schema in PR wrappers
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 8, 2026
)

* fix(sqlite): preserve admission during transcript tracker setup

Extend the checked TEMP tracking owner introduced in openclaw#166698 to the fixed
transcript-index status table, pending queue, index and enqueue triggers.
Installing these connection-local objects must not revoke the agent database's
main-schema admission receipt. Ordinary DDL, unexpected object shapes,
reentrant mutations and partial installation failures still revoke it.

Move the existing SQL into the typed builder and migrate both tracking callers
to its shared operation. Preserve local read revisions, rollback staging and
INSERT OR REPLACE behavior. No persisted schema, stored bytes, migration,
public SDK contract, retry or timeout changes.

The existing status-owner regression fails on the parent at first tracker
installation. All six owner cases pass after the repair (1.78s invocation),
including drift, rollback, foreign writes and bounded cleanup. P2 review is
clean. The broader restart investigation and Linux gates remain recorded in
the task evidence; this commit alone is not a claim that the QA race is fixed.

* fix(state): retain valid admission across concurrent opens

A startup reader can publish canonical proof before native admission starts.
A concurrent fully checked host open then registered the same database by
revoking that proof, rejecting the pending native receipt and failing the
post-restart turn before a provider request could begin.

Publish the checked opener's registration through the validation owner and
promote live proof without retiring its pending handoff. Keep physical-file
replacement and explicit lifecycle revocation strict. Reject stale required
schema receipts before they can replace newer facts, and retain the shared
schema revocation cell for matching live schemas. Accepted schema changes
and schema-optional revocation reports retire the displaced borrowers.

Regressions cover canonical and empty promotion, physical replacement,
revocation, delayed publication, and borrowed-schema retirement. All 36
receipt-owner cases pass (30.60s Vitest, 34.03s wrapper); the corresponding
negative controls failed before their repairs. P2 review is clean. Linux
pressure, owner-suite, and static gates are tracked separately before landing.
No stored data, schema version, public SDK, retry, or timeout changes.
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 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: M 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