Repository navigation
Conversation
Retain ACP metadata and board membership on resident archived rows using existing worker batch acceptance and row/database revision invalidation. Keep archived display rows cold and preserve durable facts across catalog demotion, so repeated searches no longer reread SQLite on the Gateway thread. Cover RPC result equality, ACP publications, board filtering, and lifecycle replacement without main-thread session metadata reads.
|
🦞👀 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 23, 2026, 1:19 PM ET / 17:19 UTC. ClawSweeper reviewWhat this changesThe PR retains worker-prepared runtime metadata and board membership for archived sessions, avoiding repeated database reads while preserving search results and bounded display-row caching. Merge readiness⛔ Blocked before merge - 1 item remains This remains a useful, focused performance fix: current main still rereads metadata for cold archived searches. No actionable correctness or security defect was found in the introduced changes. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway session-row projection turns stored session metadata into searchable session lists. Database workers prepare facts, while the Gateway filters and presents rows using current configuration and sharing rules. flowchart LR
A[Stored sessions and runtime metadata] --> B[Existing database workers]
B --> C[Revision and lifecycle checks]
C --> D[Resident search facts]
E[Committed changes] --> C
D --> F[Search and visibility filters]
F --> G[Selected session results]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +13, Tests +144. Total +157 across 8 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep search facts under the existing projection's revision and lifecycle owner while materializing only selected archived display rows. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the path: searching cold archived rows on current main omits prepared ACP metadata and reaches synchronous reads. The contributor reports a failing baseline RPC control; this review did not execute it. Is this the best way to solve the issue? Yes. Reusing already acquired worker facts within the existing projection avoids a competing cache and preserves archive residency, invalidation, and lifecycle ownership. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c7bab50e6ed7. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Retain ACP metadata and board membership on cold resident rows through the existing worker batch and revision lifecycle. Preserve cold display-row retention, catalog demotion, and lifecycle replacement semantics. A 5,000-session Testbox fixture reduced filterSetup from 811 ms to 371 ms and main-thread read statements from 56,700 to zero with identical results. RPC regression, worker/archival coverage, typechecks, scoped lint, and repository guards validated. Full core lint has two documented, unmodified baseline line-cap violations. Related: openclaw#151574, openclaw#155740. PR openclaw#156665 contains historical measurements, Testbox evidence, and remaining production-attribution limits.
What Problem This Solves
Searching archived sessions repeats synchronous SQLite reads for every cold row. A 5,000-session fixture reproduced 56,700 Gateway-thread reads per
sessions.listcall and roughly 0.8 seconds in filtering.User Impact
Cold archived searches use about 54% less handler-thread CPU in the measured fixture and execute no main-thread SQL. Results are unchanged. No configuration or migration is required; archived display rows and transcript backfills remain bounded by the existing projection owner.
Why This Change Was Made
Retain ACP metadata and board membership from the existing worker batch instead of falling back to synchronous reads when an archived row has no materialized display data. Exact durable publications and config/store changes refresh the facts under the existing row/database revision checks. Catalog-only demotion preserves them, and lifecycle replacement drops the previous ACP binding.
The tradeoff is one worker metadata pass over cold rows at admission and after config/store invalidation. This does not materialize archived display rows. Net production growth: 13 lines.
Stored-data compatibility:
preparedAcpMetais an in-memory property of the residentRow, not a field added to persistedSessionEntryor a write payload. The patch changes no SQLite schema, schema version, migration, serialization format, config format, or persistence writer. The existing read-only worker acquires the same stored ACP/board facts; the acceptance owner retains them in memory. Upgrade and rollback therefore read the same database bytes with no migration or backfill. Hydration, archive demotion, exact publications, and lifecycle replacement are exercised by the passing tests below; the native state schema guard passed at unchanged version 18. The automatedmigration/backfill/repairpath classification does not describe a persisted-data change in this diff.Evidence
Synthetic rig: 5,000 sessions, including 2,700 cold archives; registered
sessions.listhandler; three warmups and ten timed calls. Before/after ran on the same Blacksmith Testbox against basea1107a5217b67fbb2e4ecb27d7bc458cc3713a9c. Timings exclude the SQLite counting hook; statement counts come from a separate call. A fixed clock and normalized fixture paths make complete response hashes comparable.filterSetupmedianacp_sessionsreads/callconfig_machine_statereads/callboard_tabs/ participant reads/callNormal-list and people-list RPC medians were 5.0 → 3.9 ms and 7.1 → 5.0 ms. Active-only was 32.8 → 40.0 ms in this sample; this change targets archived search. Complete result hashes match for all four request shapes.
The RPC regression covers matching runtime searches, full result equality after catalog demotion, config refresh, ACP publications, board filtering, and lifecycle replacement. It fails on the original base with 12 ACP and six config-state reads over two cold rows. Its native board write requires the existing
gateway-database-workersgroup; no new pool, serial configuration, or worker limit is introduced.Validation uses provider
blacksmith-testbox, profileopenclaw-check, leasetbx_01m37dwe677tdfke8853asgxgh(run):pnpm test src/gateway/session-row-projection.search-facts.test.ts --maxWorkers=1: passed; 3.80 s test time, 51.97 s wrapper wall including cold worker compilation.pnpm test src/gateway/session-row-projection.archived.test.ts --maxWorkers=1: eight passed; 15.16 s test time, 44.80 s wrapper wall.node scripts/run-vitest.mjs src/gateway/session-row-projection.archived.test.ts src/gateway/session-row-projection.accepted-facts.test.ts src/gateway/session-row-projection.worker-read.test.ts: 46 sibling tests passed in the combined run.node scripts/run-vitest.mjs: nine historical snapshots and the candidate passed; benchmark scratch was removed from the deliverable.node scripts/check-changed.mjs --base HEAD -- <changed files>: core typechecking, all 25 test-type shards, formatting, boundaries, and earlier guards passed. The dead-export guard identified the retired board helper export; it is now private and its test counts actual SQL. Affected type/runtime checks and the remaining planned gate components passed separately, reusing the passing proof. The earlier moving-origin/maincomparison reported unrelated Zalo line-cap growth already present in this task's base; no ratchet exemption was added.blacksmith-testbox/openclaw-check, leasetbx_01m37k0rqvf0hyph7w00n2mgzf(run): nine affected runtime tests passed (new RPC case 2.31 s; archived cases 11.15 s; combined wrapper wall 58.10 s). Core and both affected Gateway test-type graphs, dead-export scans, task-file lint, script lint, schema/storage/media/sidecar/import-cycle/webhook/pairing guards passed.pnpm lint:corefound two unmodified baseline violations, also byte-identical on current main:src/cron/service/timer.test.ts(1,022 counted lines; limit 1,000) andsrc/gateway/server-methods/sessions.abort-agent-scope.test.ts(1,002; limit 1,000). All other stripes passed; direct lint of every changed TypeScript file passed with zero warnings/errors. These failures were not suppressed.Historical phase measurements and attribution
The same instrumented rig was run at both supplied builds and all six proposed candidates. These timings include the statement counter and vary with host load; every historical snapshot executed the same 56,700 reads and returned the same response hashes.
filterSetupmediana2e79767baf6(earlier build)b981f930dc2(#156014)3ab93b4ea59(#156286)383730e5682(#156268)7c9f2723d63(#156338)a9c4ff712b5(#154965)e77e2791e07(#156462)4663b6e4041366(later build)a1107a5217b6(task base)The cold
modelFactsfallback originated inb3fdf20e631(#151574).b7f616e4326(#155740) later prepared ACP metadata only for materialized rows, leaving this path synchronous. Both precede the supplied earlier build. The list/filter callees are unchanged across the supplied interval, so this evidence does not establish a new culprit within that interval.Initial provisioning needed dependencies installed in the synchronized checkout. Lease
tbx_01m37d65vvdrxayam7cs256p8zwas stopped after native sync timeouts. Fixture failures uncovered missing prepared plugin metadata, a moving response timestamp, and native board host-thread requirements; these were corrected without relaxing the zero-query or equality assertions. The archived-lineage suite also caught an early candidate's board-fact lifetime error, which is fixed.No live Gateway deployment or production remeasurement was performed. This proves the cold archived search path; the cause of the reported production jump between the two builds remains unestablished. Exact-head CI passed in 982 seconds elapsed (17:12:39–17:29:01 UTC, including parallel jobs). Per-file CI timing was not collected; the Testbox test budgets above are the measured per-file evidence. GitHub squash auto-merge, enabled through GraphQL, completed as
fe5005f85f1065f04b1b0d99ed6fc68b70d59b7d.