Repository navigation
Conversation
Move saved skill, prompt-report, and diff snapshots into keyed agent-schema-24 rows. Keep full-entry compatibility through same-statement hydration, preserve revision fencing and Doctor/lifecycle ownership, and return immutable borrowed metadata without redundant clones. Metadata fixture list allocation falls about 96%; generic patch cost remains essentially unchanged.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 28, 2026, 10:36 PM ET / September 29, 2026, 02:36 UTC (Revision 15). ClawSweeper reviewWhat this changesMoves saved session snapshots into keyed SQLite rows so metadata reads avoid decoding them, and updates migration, Doctor, recovery, and tests for that storage layout. Warning SQLite table change This PR modifies persisted SQLite tables in Merge readiness⛔ Blocked before merge - 5 items remain Keep open: current main lacks the optimization, and the branch has substantial behavior proof with no discrete code defect identified. Adopting its new storage contract still requires a maintainer decision. Priority: P2 Review scores
Verification
How this fits togetherA per-agent SQLite database stores session facts and saved snapshots. Gateway metadata views need compact session facts, while full readers and Doctor need complete entries for runtime and repair. flowchart LR
A[Session updates] --> B[Agent SQLite writer]
B --> C[Hot session facts]
B --> D[Cold snapshots]
C --> E[Metadata reads]
C --> F[Full entry reads]
D --> F
E --> G[Gateway views]
F --> H[Runtime and Doctor]
Decision needed
Why: A new canonical SQLite representation and downgrade contract require recorded maintainer acceptance; the PR's own description and self-referencing documentation do not establish that choice. Before merge
Agent review detailsSecurityNone. PR surfaceSource +435, Tests +727, Docs +46, Config 0, Generated +8, Other +19. Total +1235 across 70 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Use one versioned session store that serves metadata without cold payloads and restores complete entries for runtime and Doctor, with a demonstrated reversible upgrade path. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction. The PR supplies a repeatable 128-session production-reader benchmark for the reported allocation cost. Is this the best way to solve the issue? Unclear until the storage contract is accepted. The split coherently avoids cold-payload decoding, but its downgrade path needs a matching-build restore demonstration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4187710037fc. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (14 earlier review cycles; latest 8 shown)
|
Hydrate cold snapshots when verifying historical migration artifacts, preserving recovery cleanup after schema 24. Include the current main CI matrix fix and record the accepted storage design. Validation continues on Testbox; no live state is changed.
Apply main commit 52ae7e3 unchanged to unblock the inherited ui-other root-budget failure. Session storage and the measured product code are unchanged.
Hydrate bounded full-entry summaries through the canonical snapshot query, use prepared Kysely migration DML, and avoid repeated JSON bindings in snapshot upserts. Keep allocation and consistency limits intact while moving existing fixtures to split storage. Includes the unchanged Doctor e2e mock repair from main 162dea1. Testbox tbx_01m3m1gy44kbw82fjdeb0y98fh passed architecture, focused lint and types, 242 focused tests, and the allocation benchmark. Fresh review through P2 was clean.
Hold deferred recovery repair at its scheduler boundary while the real successor claims and releases ownership. The scheduler has its own retained execution proof, so teardown no longer drains unrelated timers during native SQLite work. Wait for heartbeat delivery or its actual settlement instead of imposing a separate arrival timer. Preserve awareness/reset assertions and join admitted delivery after releasing the hook. Original constrained shard replays passed and do not establish the exact CI trigger. Candidate proof passed 572 shard tests plus both scheduler-owner cases, focused lint/types and independent review through P2.
|
Follow-up on the inherited UI E2E failure: the multiline |
…y-redesign-20260919
Resolve delivery projection and lifecycle snapshot guards together. Retain the canonical schema 24 migration and main CI planner repairs. Fresh Codex review passed through P2; focused Testbox integration proof follows from this committed head after dirty-sync timeouts.
…60358) * perf(sessions): separate hot facts from cold snapshots Move saved skill, prompt-report, and diff snapshots into keyed agent-schema-24 rows. Keep full-entry compatibility through same-statement hydration, preserve revision fencing and Doctor/lifecycle ownership, and return immutable borrowed metadata without redundant clones. Metadata fixture list allocation falls about 96%; generic patch cost remains essentially unchanged. * test(sessions): adapt storage fixtures to split snapshots * test(sessions): read split snapshots in upgrade assertions * ci: include main UI type shard rebalance Apply main commit e7f5a85 unchanged to unblock the inherited ui-other root-budget failure. Session storage and the measured product code are unchanged. * fix(sessions): complete cold snapshot reader cutover Hydrate bounded full-entry summaries through the canonical snapshot query, use prepared Kysely migration DML, and avoid repeated JSON bindings in snapshot upserts. Keep allocation and consistency limits intact while moving existing fixtures to split storage. Includes the unchanged Doctor e2e mock repair from main c4509a8. Testbox tbx_01m3m1gy44kbw82fjdeb0y98fh passed architecture, focused lint and types, 242 focused tests, and the allocation benchmark. Fresh review through P2 was clean. * test(sessions): synchronize recovery and heartbeat fixtures Hold deferred recovery repair at its scheduler boundary while the real successor claims and releases ownership. The scheduler has its own retained execution proof, so teardown no longer drains unrelated timers during native SQLite work. Wait for heartbeat delivery or its actual settlement instead of imposing a separate arrival timer. Preserve awareness/reset assertions and join admitted delivery after releasing the hook. Original constrained shard replays passed and do not establish the exact CI trigger. Candidate proof passed 572 shard tests plus both scheduler-owner cases, focused lint/types and independent review through P2. * test(ui): await startup request before coalescing assertion
Read schema 24 session snapshots from their canonical table before applying the existing upgrade assertions, matching the reader correction in #160358. Preserve prompt bytes and reject missing, malformed, orphaned, or duplicate state. Validation: 29 selected session-storage cases pass in 10.98 seconds wall time, including the regression that fails with the original reader. Scoped lint and guards pass. The root-test typecheck retains the same 19 diagnostics on the unchanged tooling baseline; independent review found no actionable issues.
What Problem This Solves
Metadata reads parsed large checkout baselines and saved prompts even when callers needed only session identity, status, titles, or model facts. A 128-session fixture with 35,054-byte entries allocated 12.45 MB for one metadata list.
User Impact
Metadata reads allocate substantially less memory. Existing stores migrate automatically to schema 24; rollback requires the verified pre-upgrade database backup and matching build.
Why This Change Was Made
Agent schema 24 separates hot facts in
session_nodes.entry_jsonfrom keyedsession_entry_snapshotsrows forsessionDiffBaseline,skillsSnapshot, andsystemPromptReport. Metadata readers select hot facts; full readers hydrate both in one statement and preserve their public shape and mutable ownership contract. The existing writer updates snapshots atomically with the entry. Snapshot changes advance the node revision, including cross-connection writes; rollback restores data and revision together. Immutable internal metadata borrowing uses the existing owner/revision lifecycle.This completes one persistence cutover across migration, startup, Doctor rewrite/repair, historical recovery verification, key relocation, import/copy, eviction, and retained-window clearing. It removes the SQL JSON-removal projection and encoding fallback, unused raw-entry accessor, and cache publication's redundant stringify/parse round trip. No config or second cache owner is added. Migration and cross-table revision/recovery handling account for the production-code growth.
Migration and update contract
This is the maintainer-requested hot/cold design and versioned migration under the storage-change checkpoint. Schema layout, version history, and downgrade recovery are documented. Existing monolithic stores migrate through the canonical startup/Doctor schema owner and update-backup flow. Older builds refuse schema 24; rollback requires the verified pre-upgrade database backup and matching build. Transcript bytes, retention, permissions, and shared-state schema are unchanged.
A copied, real-shaped 128-row v23 store preserves all three snapshots and transcript bytes, handles malformed/NUL/overdepth JSON, reopens without rewriting, and rolls back extraction and version publication together. Historical recovery proves artifact adoption; restoring only the old verifier makes the regression fail because the imported artifact remains protected instead of being retired.
Evidence
Allocation measurement
Allocation sampling includes objects collected by minor and major GC. The same opt-in storage benchmark ran before/after on provider blacksmith-testbox, profile openclaw-check, lease
tbx_01m3ksx5wavhj7r9mktf35s0qy(run). Baselinedb566b093981versus candidate003c19f6877b:Metadata-list allocation falls 96.48% and exact metadata allocation 75.04%. Full reads cost about 9 μs more in this fixture; generic patch allocation is essentially unchanged. Final repair measurements were 443,373 B / 0.7779 ms for the list and 16,069 B / 0.0299 ms for exact metadata. These are isolated owner measurements, not production latency or sustained RSS claims.
Validation
All heavy runs used blacksmith-testbox / openclaw-check. All leases listed below are stopped.
tbx_01m3ksx5wavhj7r9mktf35s0qy:node scripts/run-vitest.mjs src/state/openclaw-agent-session-snapshots-migration.test.ts src/commands/doctor-session-sqlite.recovery-generations.test.ts --maxWorkers=1— 21 passed; migration 1.52 s test time, recovery 34.07 s runner wall.node scripts/run-vitest.mjs test/scripts/upgrade-survivor-assertions.test.ts -t 'reads schema 24 session snapshots' --maxWorkers=1— 4 passed, 1.09 s wall. Missing tables/snapshots and wrong prompts remain failures.OPENCLAW_SESSION_ENTRY_SNAPSHOTS_BENCH=1 node scripts/run-vitest.mjs src/config/sessions/session-entry-snapshots.benchmark.test.ts --maxWorkers=1— baseline and candidate passed.tbx_01m3m1gy44kbw82fjdeb0y98fh(run): focused reader/migration/history/provenance/worker-creation groups — 242 passed. Core production types; agents/sessions, state/logging, Gateway, Doctor and root-other test-type graphs; scoped lint;pnpm lint:kysely; andpnpm check:architecturepassed. Provenance retained its 17,296-byte write budget and zero-host-SQL assertion. Benchmark refresh passed in 8.64 s wall. The canonical-schema lint repair additionally passed 26 tests / 3.90 s wall.tbx_01m3m5f36dawn11f0g77trmd63(run): post-integrationnode scripts/run-vitest.mjs src/state/openclaw-agent-session-snapshots-migration.test.ts src/state/openclaw-state-db-read-admission.test.ts src/config/sessions/session-accessor.readonly.test.ts src/config/sessions/session-accessor.sqlite-provenance.test.ts --maxWorkers=1— 54 passed, project groups 18.23 s and 13.63 s wall.6e58f0986088. The two conflicting fixture files now match that main commit byte-for-byte; storage production code was unchanged by this integration.Published updater proof and remaining gap
On
tbx_01m3kv1satxpywy8cxdbt9ypxe(run), the published[email protected]driver ran thebaseupgrade-survivor scenario against candidate778141029e88with manual restart mode. Candidate build, update success, installed identity, automatic migration, and preserved prompts/config/exec approvals/history assertions all passed before standalone Doctor.The broader lane failed afterward in existing plugin-native capture lifetime handling: Doctor's private SQLite inspection directory was removed while cached admission state still referenced its native companion. Four traced owners are byte-identical to the original base; execution of that separate defect on the baseline was not reproduced. The upstream lifetime repair (
7d8f806a69e6, #160291) is included in the current PR head, but this full upgrade lane has not been repeated. Later startup/status checks did not run. This proves published-driver migration, not a fully green release lane. No operator Gateway was changed.CI follow-through
CI found and this PR repaired one missed full-entry consumer: bounded recent-session summaries now hydrate snapshots with the same single statement as other full readers. Fixtures use the split representation without weaker assertions. Snapshot upserts bind saved JSON once through
excluded; migration DML uses Kysely; the database type import uses its leaf contract to avoid a cycle.Earlier full changed checks and CI exposed inherited UI type/lint limits, tooling census timeouts, and heartbeat/recovery fixture scheduling failures. No timeout, retry, assertion, or baseline was weakened. The original 29-file recovery and 18-file heartbeat CI groups passed instrumented replays (269 and 303 tests), so those exact CI triggers were not proven by replay. The fixture investigation and candidate proof used
tbx_01m3m97ss53a7sfc8ad7rs6fnw(run); the final PR keeps main's canonical fixes instead of duplicate repairs.The actual conflict-resolution merge includes main's recovery clock fix
9fe93a204e3b, heartbeat/title fixture fixd9569745764f, matched-only consumer parsingabb37032e7f7, redundant-planner-scan removal714c2c6baa8f, and leaf-config ownership fixb27c79ba1562. The required matrix-limit fix is included. An independently measured equivalent scanner change reduced the census from 60.62 s to 41.58 s; it was discarded after the upstream fix landed. Prior CI at head68bd5f1a262dea002114e61384edddb125aee098, run 36466313426, completed with 141 successful jobs, 18 skipped jobs, and two failed leaf jobs plus the aggregate gate.checks-node-compact-small-17failed the hourly/release planner assertion: 82 compact jobs exceed its 79-job limit; this remains held for the CI owner. Main now contains the owning packing repairdf582a4010d5and its hybrid-planner follow-up2e7f4f8fcd1f; both are included in the integration head36ad6154612a.checks-node-changed-compact-small-44hit the 100-second child-process guard in the routed unknown-provider JSON case insrc/cli/help-exit.process.test.ts. The inspected CLI/catalog/import owners are unchanged from the merged main parent, but a baseline reproduction has not established an inherited failure. The exact-head replay onblacksmith-testbox / openclaw-check, leasetbx_01m3n98bpve245g1nw1rhfkb73(run), passed 23 preceding-help/state-validation/JSON cases in 80.49 s runner wall (6 unrelated later cases deselected). The original routed unknown-provider case passed in 11.35 s with its 100-second guard unchanged. Command:CI=1 OPENCLAW_VITEST_MAX_WORKERS=2 node scripts/run-vitest.mjs src/cli/help-exit.process.test.ts -t 'CLI help process exit|rejected CLI process state isolation|models list JSON failure process output'. This did not reproduce or fix the original timeout. The lease was stopped. Incorporating the owning planner repair through expected-head update-branch was refused with a merge conflict; the six conflicts are now resolved and pushed at36ad6154612aagainst main4a448bdd2656. GitHub reports the resulting head mergeable. No workflow rerun, administrative landing, or auto-merge command was issued.Main integration proof
Head
36ad6154612aintegrates main4a448bdd2656, including the owning planner repairs, while preserving the delivery projection and hot-JSON plus snapshot-revision removal guards. Fresh full-candidate Codex review against that main commit was scoped-clean through P2. On blacksmith-testbox / openclaw-check, leasetbx_01m3nf9at1cpz96g7dsk14tta9(run), the four focused reader/Doctor/migration files passed 36 tests. Individual runner wall times were 32.90 s (exact reads), 7.92 s (delivery), 11.11 s (Doctor race), and 9.78 s (migration), each usingnode scripts/run-vitest.mjs <file> --maxWorkers=1. Core production types, agents/sessions/Doctor/state test-type graphs, scoped lint, line caps, complete architecture guards, generated database types, and unused exports passed. Total command: 8m40.31s, exit 0. The lease is stopped. The prior dirty-sync leasetbx_01m3ndt8nn168fekkfd9bv71wshit sync timeouts before validation and was stopped; the successful run used the reviewed committed head. CI run 36511947648 completed successfully on that exact head with no failed or pending jobs. The lead watcher merged this PR atae6a88438de3on September 29 at 02:39:22 UTC.Follow-ups
Whole-store registry-maintenance clone removal landed separately in #160510. Revision-only lifecycle-effect currency is tracked separately in #160831. The duplicate CLI-access candidate was measured and discarded because allocation and CPU regressed; no implementation remains from it. Generic full-entry patch callbacks continue to hydrate snapshots by their existing contract.
Final fixture repair
CI on
44736ed858dapassed the selected storage, type, lint, and other test lanes; onlychecks-ui-e2e (7/9)failed in run 36454894647. The mocked navigation test observed both panes loading and immediately expected onechat.startuprequest. Loading is set before full-stream subscription admission, so zero requests is valid at that point. The fixture now awaits the actual request before asserting exactly one. Both deferred responses and the final two-pane rendering assertion remain, preserving duplicate-request detection. No timer, timeout, or assertion was weakened.On provider
blacksmith-testbox, profileopenclaw-check, leasetbx_01m3mk5tsybrjj69vyr9t7gnr0(run),node scripts/run-vitest.mjs ui/src/pages/chat/chat-history-subscription-admission.test.ts ui/src/pages/chat/chat-history-warm-startup.test.ts ui/src/pages/chat/chat-history-observation.test.ts --maxWorkers=1passed 46 tests / 3 files, 18.37 s runner wall. This includes explicit proof that loading can be true with zero startup requests before subscription ACK.node scripts/check-changed.mjs --base HEAD -- ui/src/e2e/chat-flow.navigation-presentation.e2e.test.tspassed the selected guards, UI E2E types (73.8 s), export scans, formatting, and lint. Total remote command: 6m34s. Fresh Codex review was scoped-clean through P2; the lease is stopped. Browser automation was excluded from this focused proof; the normal PR CI owns the changed E2E case. Its preceding failed CI file took 25.300 s for ten cases (2.664 s for the failed case).