Skip to content

improve(sessions): reuse compiled transcript metadata queries - #148773

Merged
vincentkoc merged 4 commits into
mainfrom
perf/session-transcript-prepared-reads-20260915
Sep 15, 2026
Merged

vincentkoc merged 4 commits into
mainfrom
perf/session-transcript-prepared-reads-20260915

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

Related: #148725

What Problem This Solves

Session-start and completion checks repeatedly rebuild the same SQLite queries, adding avoidable work after the transcript scan reduction in #148725.

User Impact

No user-visible behavior change is intended. Presence and freshness checks still read current SQLite state. There are no schema changes, migrations, configuration changes, or required user actions. At current head 7183dc46e6be6d771d29a6d9bf1cb8d62a3bce2f, the independently reviewed fixed workload has a median paired whole-workload process-CPU reduction of 29.36% across 10 AB/BA pairs, with lower CPU in 10/10 pairs. Short-window CPU regressions remain documented below; this is not a universal per-read or production-weighted claim.

Why This Change Was Made

Prepare each fixed query once per physical database handle through the existing synchronous first-row helper. Each call still binds the current session ID and executes against SQLite; rows and native statements are not retained by these caches. The hot/cold presence query stays one statement, and mutation reads keep their existing transaction boundaries.

The two existing owners gain 41 production lines for bounded, connection-owned compiled queries; five real-SQLite regression cases add 209 test lines. This follows the existing prepared-read ownership pattern without a shared framework or new API.

Current head qualification

Current head: 7183dc46e6be6d771d29a6d9bf1cb8d62a3bce2f, tree a0984ca32a41f63382aafc7527a0ca2ab19100c4. A signed additive merge includes frozen main 0945dabbe487213e95e84a72ad1aae3659e0e000, whose parent is the landed CI repair #148885. All three PR files remain byte-for-byte unchanged from the reviewed 3a7f88d head; the PR still adds 41 production lines and 209 test lines.

The refresh is necessary because GitHub retained the old merge ref after the one draft-to-ready cycle: CI 34945152541 checked out cb7ae7cedb72eba301e2e182927a4ad9199c506f (3a7 into old main 5a826), despite the repaired main. That unusable run was cancelled, and its checkout/cancellation receipts are retained. No rebase or original-commit rewrite was used.

Independent source review of the composed head found no interaction defect. All 43 current-head tests passed in one runtime shard and the requested order: 5 metadata, 4 prepared-read, 23 cold-read and 11 provenance cases. Fresh canonical P2 review was scoped clean. ClawSweeper Revision 12 reviewed this exact head with no correctness/security finding, no remaining Before merge item and no rank-up move. The one composed-head diagnostic completed and passed independent raw-result audit.

Hosted and targeted UI qualification passed: PR CI 34954423716, attempt 1, finished successfully with 123 successful and 16 skipped jobs, including openclaw/ci-gate. Its preflight physically checked out the pre-verified integration 18d65eadc9fc1f5e008e095db327439459c97384, tree 4dee44c2abcb3cbc59620e2e60c8b657c30507ed, with parents 0cd944c01416c4f9c1f6dc9d1dea9670c5b99cab and 7183dc46e6be6d771d29a6d9bf1cb8d62a3bce2f; workflow and checkout identities agree. This composition contains the corrected shard assignment and landed UI fixture. Native preparation selected successful exact-head Workflow Sanity 34954423706, attempt 1, alongside that successful CI run.

Ordinary PR CI omits the real-Gateway UI lane. A separate native Blacksmith run on that exact 18d65ead integration completed the private QA build and the complete existing automation-management file: 1 file, 1 case passed, with no unhandled test error and successful joined teardown. It used Linux x64 Node 24.20.0, pnpm 12.3.4, Vitest 5.0.0, Playwright 1.63.0 and the admitted system Chromium 144.0.7559.0. The real isolated Gateway used the real Telegram plugin with synthetic transport and a deterministic local Responses provider. Configured-owner list/get, true nonowner capability absence and unchanged job/run/audit state, and all five browser-admin actions passed, with seven management audits. Physical checkout, all 237 source/install pins, artifact-root binding and five build identities remained valid; the owned Testbox stopped after collection. Independent integrity/resource and full-file semantic reviews passed. Raw-result SHA256: cee433b1a529e0a1f6f5be528fddc39302d8d20b0dc1170d9970f0f34a9ad108; complete archive SHA256: 05e0d67c2a289692e5fb0ee298aad04ff99667bb51708fc1fb29393cace84242.

The UI raw log retains one nonfatal chat.metadata UNAVAILABLE response after the seventh audit: “Session changed while preparing its metadata. Retry the request.” The existing response-currentness guard emits that message when its captured scope is superseded; this run does not identify which predicate changed. The automation assertions and teardown passed. Controller errors: [] does not mean the Gateway log contains zero errors. Post-error metadata recovery was not exercised.

The earlier native exact-head CI 34950545836, attempt 1, remains failed historical evidence: 192 successful, 6 skipped and 3 failed jobs (the two test failures below plus the aggregate gate). Source and performance proof is bound to 7183dc46; integration CI and targeted UI proof is bound to 18d65ead. Subsequent cb246e917d2014608de9ebfd556293cbd7637d89 composition received a separate source-compatibility review, including the changed committed-reader disposal lifecycle; it does not acquire the earlier runtime measurements by inheritance. Native preparation passed with hosted exact-head gates, preserving the head and skipping a redundant push. The original main-side holds are resolved by the landed six-deletion Copilot syntax correction #149016 (ba441dd2d14e1d02dca72dd341cff28c360acaa2), auth correction #149004 (d872aaba81a769d76eabb1bec0b7ec4b8fc83354), and canonical fixture correction #149023 (1226eecf4ff909de172a6837422cfa64723fade8). Their ancestry in subsequently observed main is verified. Separate newer main follow-ups remain separately owned; this does not claim zero failures on every later main composition. Normal native merge guards remain mandatory.

Preserved failed-job evidence: spawn production-boundary job 104320667187 failed the first of ten cases: the admitted descendant did not call the embedded runner within the existing 15-second assertion window. The other nine cases passed. A separate, single Linux x64 Node 24.20 diagnostic at this unchanged head passed all ten cases in their original order with the same assertion window and normal compiled-worker runner. It recorded 52 paired startup spans, no unmatched spans or timeline-write warnings, and completed Testbox cleanup. The successful instrumented run does not establish the cause of the earlier CI timeout or replace hosted qualification. Independent raw-integrity, resource-cleanup and semantic reviews passed for this successful run only. No timeout, assertion, production source or CI retry changed. Raw-result SHA256: d624a83327d3ae54c2f61dc190b0a4981596b513ec265caf9d9d1799d96a2ce3.

The real-Gateway UI job 104320661041 passed 58 of 59 cases. Its automation-management fixture configures both Telegram callers as owners but expects the second owner to be denied. The configured-owner policy from #148790 is already in this frozen head; the corresponding fixture correction from #148830 landed later and is present in the corrected canonical merge. Independent source review traced the management grant separately from the transcript query caches and confirmed this fixture/policy mismatch. The landed fixture covers configured-owner access, a true non-owner's absent capability and unchanged job/run state, and all five Control UI actions. The targeted proof above executed that corrected composition. No production permission change is proposed here.

The earlier CI 34946044907, attempt 1, checked merge c8230d71969b4b4ac64ef68c923e51e6bd85a372 into main a4b601e02ddbb9c740297e935fa293f2f7fc259b. Both additional-boundaries and compact-small-30 failed because main assigned the same 83 secrets tests to agents-tools and state-logging. Canonical #148826 has now landed as 0cd944c01416c4f9c1f6dc9d1dea9670c5b99cab; the corrected merge's shard blobs are verified. One authorized close/reopen produced CI 34949964661, but its actual workflow/checkout still selected stale c8230d7 despite the updated live merge ref. Both unusable runs were cancelled, and their exact logs, source identities and cancellation receipts remain preserved. No benchmark rerun, second toggle or head rewrite was used for the native dispatch route.

Current complete-workload diagnostic and maintainer decision

The median paired process-CPU reduction is 29.364%, and paired wall-time reduction is 24.636%, each lower in 10/10 adjacent AB/BA pairs. These paired results differ from the ratios of independent medians below. All samples are retained.

Complete workload Baseline min / median / max (ms) Candidate min / median / max (ms) Reduction from independent medians
Wall time 64.676 / 76.538 / 83.597 50.218 / 55.437 / 61.011 27.57%
Process CPU 112.939 / 133.002 / 145.858 83.223 / 93.340 / 101.141 29.82%

The current run uses frozen main 0945dabbe487213e95e84a72ad1aae3659e0e000 as A and composed 7183dc46e6be6d771d29a6d9bf1cb8d62a3bce2f as B, with the same fixture, process order, warmups, measured calls and diagnostic instrumentation as the prior diagnostic. It retains 640 ordered batch measurements and 20 complete-workload envelopes, each covering 3,232 reader calls plus assertions and bookkeeping. Baseline/candidate warm compiler counts remain 8/0 for each owner, semantic checks passed, and source/input attestations remained unchanged.

Current diagnostic measured-window medians per call (10 samples per variant/cell, 100 calls per sample):

Read Events Baseline wall / CPU (µs) Candidate wall / CPU (µs)
presence 0 23.489 / 50.035 14.749 / 14.875
freshness 0 18.078 / 18.955 13.413 / 13.865
presence 1 18.741 / 19.310 14.218 / 14.245
freshness 1 14.975 / 16.690 12.410 / 14.865
presence 10 23.100 / 29.885 13.768 / 17.620
freshness 10 14.399 / 42.535 37.461 / 98.935
presence 4096 16.658 / 16.705 12.779 / 20.650
freshness 4096 14.180 / 23.015 12.200 / 12.235

Accepted costs and limits: ten-event freshness still increases 160.165% wall time / 132.597% process CPU in the measured window; 4096-event presence CPU increases 23.616%. The third warmup batch for one-event presence increases from 18.185 to 31.005 µs CPU per call (70.498%). Median peak RSS increases 4.957 MiB, from 372.180 to 377.137 MiB, with overlapping ranges (363.996–380.918 versus 365.789–380.578 MiB); this is not retained-memory proof. The complete workload captures the fixed workload's net CPU cost; it does not make every individual read faster.

Short-window thread attribution remains unreliable: 329/640 batches report zero current-thread CPU, and thread residuals exceed corresponding wall-time gaps. Raw process-minus-thread system components include negative estimates (−17 µs in an A batch, −8 µs in an A envelope, and −323 µs in a B envelope); these non-atomic estimates are retained without clamping. No kernel, GC or JIT cause is asserted.

Current maintainer decision: retain both existing-owner compiled-query caches for the independently verified fixed-workload benefit, explicitly accepting the costs above. Source, focused proof, canonical review, ClawSweeper and current measurement are qualified. Current integration CI and the targeted corrected UI proof have passed independent qualification. Native preparation has passed at the unchanged head, and the original main-side holds above are resolved. The prepared optimization is admitted to the normal native merge checks with its stated proof boundaries. No universal per-read, production-weighted, first-use, cold-archive, retained-memory or whole-Gateway benefit is claimed.

Controller SHA256: 0109d47d32b400542ab850e05cf8738db7ea9f3576810f988e17bb83ff1626ec; complete raw-result SHA256: 79bfa3a7a856d36313314b3434cd3486dcc563226f86b533d858a1b934a49ecd. Native execution exited 0 and the exact Testbox lease is completed. All three earlier studies below remain separate historical evidence; none is relabeled as a measurement of the current head.

Historical evidence

  • Five metadata-reader cases pass at 3a7f88d547d886dbb6b6a3e44890a07b8234d1c7: fresh bindings and rows without warm recompilation, strict fence advances and rollback, WAL snapshots, and distinct/closed/reopened handles.
  • All 63 existing sibling tests passed in the preceding four-file run: 36 Kysely helper, 23 cold-read, and 4 prepared-read cases. The only subsequent production change renames a callback parameter to satisfy no-shadow. The original run exposed two test defects, now corrected: an empty session entry records its initial observation timestamp, and the identity assertion must avoid Vitest inspecting a closed SQLite handle. Null and lifecycle assertions remain intact.
  • Frozen installation, formatting, normal signed-commit hooks, targeted repository syntax lint on both owners and the test, and git diff --check passed. All three prior canonical P2 reviews were scoped clean, including signed head 3a7f88d. Its ClawSweeper review found no correctness or security defect and requested resolution of the measured performance tradeoff. The completed diagnostic and maintainer decision below address that request on the unchanged head. CI run 34942170879, attempt 1, failed the services typecheck-root headroom test: the integration main tree already contains 702 roots against the 700-root limit. None of this PR's paths belongs to that shard. The failure is retained; unchanged CI has not been retried.
  • The first native Testbox comparison completed at 8b37f332784420bbfb6677495c1069583a3aea90 against narrow-reader baseline 6563535db1d377e6c82cc55103dd8f5d1d36530e. Both owners compiled 8 queries for 8 warm reads on the baseline and 0 on the candidate. All semantic checks passed. Seven timing cells improved, but ten-event freshness regressed by 114% wall time and 166% process CPU at the median. That result is retained and unexplained; it is not treated as noise. The historical 3a7f88d repeat used the identical workload and schedule. Its eight wall-time medians were lower; seven process-CPU medians were lower, but 4096-event presence CPU increased 21.7%. The first adverse cell did not repeat in the final uninstrumented run, but remains evidence. Neither result is attributed to GC, JIT, or noise. The separate diagnostic below measures the complete ordered workload and retains the short-window regressions.

Historical first-run medians per call (10 samples per variant/cell, 100 calls per sample):

Read Events Baseline wall / CPU (µs) Candidate wall / CPU (µs)
presence 0 19.952 / 46.045 14.326 / 14.350
freshness 0 15.246 / 15.700 12.958 / 13.325
presence 1 18.095 / 18.700 13.740 / 13.970
freshness 1 14.170 / 15.660 11.878 / 12.910
presence 10 18.884 / 22.675 13.684 / 16.825
freshness 10 13.858 / 29.795 29.662 / 79.270
presence 4096 16.482 / 16.490 12.386 / 12.520
freshness 4096 14.300 / 26.875 11.156 / 16.605

Historical final-repeat medians at 3a7f88d547d886dbb6b6a3e44890a07b8234d1c7 (same baseline, 10 samples per variant/cell, 100 calls per sample):

Read Events Baseline wall / CPU (µs) Candidate wall / CPU (µs)
presence 0 24.913 / 59.435 16.512 / 16.555
freshness 0 18.063 / 19.100 15.352 / 15.905
presence 1 20.258 / 20.300 15.055 / 17.115
freshness 1 16.287 / 18.525 13.799 / 15.345
presence 10 19.567 / 26.325 15.476 / 19.335
freshness 10 15.773 / 39.485 14.247 / 36.680
presence 4096 18.138 / 18.160 14.606 / 22.100
freshness 4096 16.292 / 37.875 13.134 / 22.735

Both native runs completed with semantic parity, baseline 8/candidate 0 warm compiler calls per owner, all 160 timing samples, unchanged source/input attestations, and completed lease cleanup. No samples were dropped or retuned. First raw-result SHA256: 94bf3cc293821edaf4d24f99cc3101ce973afe15091f126fae18579b96baf72a; final: f297d700c88de498fcd11c91a1f04b395f4d24f1bd645d4609c407e9cab5e419. Final controller SHA256: f9bc6fac30cbc5fba8d4f3397ba9750d138b27ce9dfd790f5a7c42d3377d97d8.

Historical complete-workload diagnostic and maintainer decision

The median paired process-CPU reduction is 23.70% across 10 adjacent AB/BA pairs, lower in 9/10 pairs; one pair increased 1.33%. Median paired wall-time reduction is 19.18%, lower in 8/10 pairs. These paired results are distinct from ratios of the independent medians below.

Complete workload Baseline min / median / max (ms) Candidate min / median / max (ms) Reduction from independent medians
Wall time 61.450 / 81.515 / 88.387 48.100 / 57.450 / 85.714 29.52%
Process CPU 99.590 / 139.601 / 150.335 74.663 / 93.372 / 133.446 33.11%

This separately instrumented diagnostic retains all 640 ordered batch measurements and 20 complete-workload envelopes. Each envelope spans the same 3,232 reader calls: 2,400 warmup calls, 800 measured calls, and 32 existing semantic-validation reads, plus assertions and intervening bookkeeping. Imports, fixture creation, compiler guards, output, and cleanup are outside that envelope. Both guards and all semantic checks passed; source and input hashes remained unchanged.

The distributions overlap. Diagnostic measured-window CPU still increased 29.81% for ten-event freshness and 14.27% for 4096-event presence. Current-thread counters are unsuitable for precise short-window attribution here: 314 of 640 batches report zero thread CPU, and thread residuals exceed the corresponding wall-time gaps. Process-wide complete-workload CPU includes the work omitted by isolated windows. No kernel, GC, or JIT cause is claimed. Instrumented results do not replace either retained uninstrumented study.

Historical 3a maintainer decision: retain both existing-owner compiled-query caches for the demonstrated fixed-workload reduction, explicitly accepting the documented short-window CPU costs and variance. This resolves the unchanged-head ClawSweeper rank-up request through complete measurement and an accepted tradeoff. No universal per-read, production-weighted, retained-memory, or whole-Gateway benefit is claimed. Fresh integration CI remains a landing requirement.

Diagnostic source: 3a7f88d547d886dbb6b6a3e44890a07b8234d1c7, same baseline 6563535db1d377e6c82cc55103dd8f5d1d36530e. Controller SHA256: ee74b7189fb984d3a66a3dd3e9bd4b8713f0608c323f75e934114f26c22ed870; complete raw-result SHA256: 56224714f5da446e6fa9dbcd7089830d0bb09397084512fe3747df3a97b76b01. The native run exited successfully and stopped its one-shot Testbox lease.

Method: Node 24.19.0, Linux x64, Kysely 0.29.5; 20 balanced fresh timing processes, 8 cases each, 3 batches of 100 warmup calls per case. Compiler instrumentation runs in two separate untimed processes. This measures warm public reads on one canonical four-session SQLite database; it does not establish first-use, cold-archive restoration, retained-memory, or whole-Gateway improvement.

Prepare presence and mutation queries per native database handle while keeping fresh bindings and SQLite transaction visibility. Add focused real-SQLite compilation, mutation, snapshot, and handle-lifetime regressions.
@vincentkoc vincentkoc self-assigned this Sep 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 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 size: M maintainer Maintainer-authored PR labels Sep 15, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 Sep 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 15, 2026, 7:08 AM ET / 11:08 UTC (Revision 12).

ClawSweeper review

What this changes

Reuse compiled SQLite queries for transcript presence and freshness checks, with regression coverage for current bindings, transaction visibility, and database-handle lifetimes.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused optimization that current main does not implement. No blocking correctness or security defect was found, and the recorded performance tradeoff has already been accepted.

Priority: P2
Reviewed head: 7183dc46e6be6d771d29a6d9bf1cb8d62a3bce2f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused implementation with meaningful lifecycle coverage and strong, carefully bounded performance evidence has no remaining actionable review defect.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The matching captured body records native Linux/Node execution of both changed public readers against real SQLite at the pinned head, with semantic parity, zero warm recompilation, and lower complete-workload CPU; slower individual windows are retained and accepted.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The matching captured body records native Linux/Node execution of both changed public readers against real SQLite at the pinned head, with semantic parity, zero warm recompilation, and lower complete-workload CPU; slower individual windows are retained and accepted.
Evidence reviewed 8 items Introduced scope and review continuity: The verified merge-base delta contains only the two metadata owners and their new test file. Comparing the earlier reviewed 3a7f88d head with HEAD produced no differences in those three files; the previous completed review reported no findings.
Fresh execution through the existing owner: The prepared first-row helper retains compiled SQL and creates invocation-local bindings, then calls the existing synchronous executor on every read. Native statement invalidation, authorizer handling, and disposal remain with the shared SQLite owner; the PR adds no stored results or authority-bearing values.
Optimization remains absent from main: Fetched main still builds and compiles the presence query per invocation, and its mutation reader has not adopted this cache. The latest supplied release tag has no metadata-reader file at this path. The merged #148725 explicitly names compiled-query reuse as separate follow-up work.
Findings None None.
Security None None.

How this fits together

Session metadata readers supply transcript-presence and mutation timestamps to recovery, cron, and session-completion checks. They resolve the session’s database and read authoritative SQLite state before those callers decide whether to reuse or refresh a session.

flowchart TD
  A[Session recovery and completion checks] --> B[Resolve session and database]
  B --> C{Compiled query available?}
  C -->|No| D[Compile query for database handle]
  C -->|Yes| E[Bind current session ID]
  D --> E
  E --> F[Read current SQLite snapshot]
  F --> G[Return presence or mutation timestamps]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +41, Tests +209. Total +250 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 62 21 +41
Tests 1 209 0 +209
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 271 21 +250

Review metrics

Metric Value Why it matters
Warm query compilation 8 → 0 compiler calls per reader The recorded diagnostic directly measures elimination of the repeated work targeted by this patch.
Complete-workload CPU 29.364% median paired reduction; lower in 10/10 pairs This supports the accepted aggregate benefit while individual slower read windows remain documented.

Technical review

Best possible solution:

Keep compilation reuse within the existing readers while preserving fresh SQLite execution and the explicitly accepted workload-specific performance tradeoff.

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

Not applicable to a functional bug: this is a performance optimization, and current source plus the recorded native comparison establish repeated query compilation.

Is this the best way to solve the issue?

Yes. Reusing the existing prepared-query helper avoids a competing metadata cache and preserves current bindings, snapshots, and native statement ownership.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded session-performance improvement with measured benefit and no intended behavior change.
  • 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 (live_output): The matching captured body records native Linux/Node execution of both changed public readers against real SQLite at the pinned head, with semantic parity, zero warm recompilation, and lower complete-workload CPU; slower individual windows are retained and accepted.
  • proof: sufficient: Contributor real behavior proof is sufficient. The matching captured body records native Linux/Node execution of both changed public readers against real SQLite at the pinned head, with semantic parity, zero warm recompilation, and lower complete-workload CPU; slower individual windows are retained and accepted.

Evidence

What I checked:

  • Introduced scope and review continuity: The verified merge-base delta contains only the two metadata owners and their new test file. Comparing the earlier reviewed 3a7f88d head with HEAD produced no differences in those three files; the previous completed review reported no findings. (src/config/sessions/session-accessor.sqlite-metadata-read.ts:15, 7183dc46e6be)
  • Fresh execution through the existing owner: The prepared first-row helper retains compiled SQL and creates invocation-local bindings, then calls the existing synchronous executor on every read. Native statement invalidation, authorizer handling, and disposal remain with the shared SQLite owner; the PR adds no stored results or authority-bearing values. (src/infra/kysely-sync.ts:195, 7183dc46e6be)
  • Optimization remains absent from main: Fetched main still builds and compiles the presence query per invocation, and its mutation reader has not adopted this cache. The latest supplied release tag has no metadata-reader file at this path. The merged improve(sessions): avoid full transcript scans during session checks #148725 explicitly names compiled-query reuse as separate follow-up work. (src/config/sessions/session-accessor.sqlite-metadata-read.ts:20, d872aaba81a7)
  • Focused regression coverage: The five real-SQLite cases check warm compilation avoidance together with fresh bindings and rows, strict mutation advancement, rollback, WAL snapshot visibility, separate handles, and close/reopen behavior. Existing prepared-entry coverage exercises a different reader. Tests were inspected, not executed during this read-only review. (src/config/sessions/session-accessor.sqlite-metadata-read.test.ts:51, 7183dc46e6be)
  • Captured proof and accepted performance limits: The retrieved full PR body matches captured SHA256 33a30a996170dbca7d282f17ef09d1d7119d5440a87e94fc63d7c29bb520d5dc. Its native Linux/Node diagnostic compares baseline 0945dab with this head through warm public SQLite readers: compiler counts fall from 8 to 0 per owner, semantic checks pass, and median paired complete-workload CPU falls 29.364% across 10 AB/BA pairs. The body explicitly accepts slower ten-event freshness and 4096-event presence CPU windows, without claiming universal or whole-Gateway improvement. The recorded raw-result identity is 79bfa3a7a856d36313314b3434cd3486dcc563226f86b533d858a1b934a49ecd. (7183dc46e6be)
  • Supplemental integration qualification: GitHub confirms https://github.com/openclaw/openclaw/actions/runs/34954423716 completed successfully for the pinned PR head. The body separately identifies its tested integration as 18d65ead and preserves historical failures. Its automation-management UI run is supplemental, not the performance proof. The four prepared screenshots were inspected and depict the related update-badge repair, not this query optimization. (7183dc46e6be)

Likely related people:

  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • 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 (11 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-15T07:51:41.901Z sha 3a7f88d :: blocked before merge. :: none
  • reviewed 2026-09-15T08:11:59.284Z sha 3a7f88d :: needs maintainer review before merge. :: none
  • reviewed 2026-09-15T08:22:44.353Z sha 7183dc4 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-15T08:43:18.582Z sha 7183dc4 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-15T09:05:05.136Z sha 7183dc4 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-15T09:15:10.191Z sha 7183dc4 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-15T09:57:24.364Z sha 7183dc4 :: blocked before merge. :: none
  • reviewed 2026-09-15T10:08:27.411Z sha 7183dc4 :: needs maintainer review before merge. :: none

@vincentkoc
vincentkoc marked this pull request as ready for review September 15, 2026 07:20
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review exact head 8b37f332784420bbfb6677495c1069583a3aea90. The five metadata-reader tests now pass; the two test fixture corrections preserve the lifecycle assertions. The PR body records all focused evidence and the clean fresh P2 review. Balanced before/after measurement remains pending and will be added to the body.

@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review exact head 3a7f88d547d886dbb6b6a3e44890a07b8234d1c7. The only new production change renames the shadowed callback parameter; targeted syntax lint and all five metadata tests pass. The PR body now retains all first-run timing medians and explicitly flags the unresolved ten-event freshness regression. An identical-schedule final-head repeat and fresh CI/review are in progress; no broad performance benefit or merge readiness is claimed.

@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. proof: sufficient ClawSweeper judged the real behavior proof convincing. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 15, 2026
@vincentkoc
vincentkoc marked this pull request as draft September 15, 2026 08:06
@vincentkoc
vincentkoc marked this pull request as ready for review September 15, 2026 08:06
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Sep 15, 2026
* commit '0945dabbe487213e95e84a72ad1aae3659e0e000': (115 commits)
  fix: omit automation service aliases from squash coauthors (#148883)
  test: restore services typecheck shard headroom (#148885)
  perf(trajectory): avoid native probes for truncation records (#148870)
  improve(gateway): load cron only when reload requests it (#143500)
  fix: resolve issue #146088 — [Bug]: The most recent Linux AppImage does not ship with the correct versions of libs needed to run (#148174)
  refactor(theme): share nonvirtual ANSI color lookup (#148717)
  perf(gateway): scope exact session row topology reads (#148836)
  improve(memory): reduce vector replacement overhead (#148201)
  fix(i18n): keep HTTP headers out of native translations (#147119)
  refactor(plugins): share source-root display formatting (#148646)
  fix(cron): reject blank script paths before mutations (#148787)
  refactor(config): share audit positional scanning (#148643)
  fix(test): restore infrastructure typecheck shard headroom (#148861)
  fix(release): harden package validation fallbacks (#148729)
  refactor(config): share leaf and descendant unset pruning (#148216)
  test: reuse prepared runtime for pristine preflight (#148858)
  fix(ui): settle global model drafts across agent switches (#148843)
  fix(queue): avoid repeated scans when cancelling backlogs (#148754)
  fix(logging): orphaned \\\\?\\ path markers corrupt redacted Windows diagnostics (#147542)
  refactor(hooks): share optional reply metadata projection (#148641)
  ...
@vincentkoc vincentkoc closed this Sep 15, 2026
@vincentkoc vincentkoc reopened this Sep 15, 2026
@vincentkoc vincentkoc closed this Sep 15, 2026
@vincentkoc vincentkoc reopened this Sep 15, 2026
@vincentkoc
vincentkoc merged commit 84114b5 into main Sep 15, 2026
675 of 815 checks passed
@vincentkoc
vincentkoc deleted the perf/session-transcript-prepared-reads-20260915 branch September 15, 2026 11:31
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 15, 2026
* commit '84114b5a2711764e2ca333e327e808fd88316063': (40 commits)
  improve(sessions): reuse compiled transcript metadata queries (#148773)
  fix(ci): repair Copilot contracts and config failure diagnostics (#149001)
  test: align model auth and setup fixtures with current behavior (#149023)
  refactor: reuse web search request context (#148949)
  fix(ci): remove duplicate Copilot auth metadata (#149016)
  test(agents): align auth fixtures with runtime store reads (#149004)
  improve: reduce data fetched during reminder maintenance (#148996)
  fix(cron): skip availability checks when session pruning is idle (#148920)
  fix(auth): guard GitHub Copilot device flow authority (#148999)
  fix(agents): prevent early recovery aborts of foreground exec (#148959)
  fix(github-copilot): remove retired Raptor mini (#116505)
  improve(feishu): reduce preparation work for documents with tables (#148997)
  improve: reduce database work when recording participants (#148841)
  test: accept Bun error labels in plugin assertions (#148955)
  fix(models): clarify saved account health and catalog status (#148987)
  test(plugins): align Copilot auth-choice registry expectations (#148981)
  fix(channels): reject blank integer channel add options (#145534)
  fix(ui): preserve archive undo after chat navigation (#148831)
  feat: show cited source previews in macOS and iOS chat (#148906)
  fix: avoid redundant tab updates while chats stream (#148865)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 16, 2026
…aw#148773)

* improve(sessions): reuse compiled transcript metadata queries

Prepare presence and mutation queries per native database handle while keeping fresh bindings and SQLite transaction visibility. Add focused real-SQLite compilation, mutation, snapshot, and handle-lifetime regressions.

* test(sessions): correct prepared metadata reader fixtures

* fix(sessions): avoid shadowing the prepared query binding
vincentkoc added a commit that referenced this pull request Sep 24, 2026
* refactor(agents): centralize tool description exclusions

* Merge main into refactor/tool-description-exclusions-20260915

* commit '84114b5a2711764e2ca333e327e808fd88316063': (40 commits)
  improve(sessions): reuse compiled transcript metadata queries (#148773)
  fix(ci): repair Copilot contracts and config failure diagnostics (#149001)
  test: align model auth and setup fixtures with current behavior (#149023)
  refactor: reuse web search request context (#148949)
  fix(ci): remove duplicate Copilot auth metadata (#149016)
  test(agents): align auth fixtures with runtime store reads (#149004)
  improve: reduce data fetched during reminder maintenance (#148996)
  fix(cron): skip availability checks when session pruning is idle (#148920)
  fix(auth): guard GitHub Copilot device flow authority (#148999)
  fix(agents): prevent early recovery aborts of foreground exec (#148959)
  fix(github-copilot): remove retired Raptor mini (#116505)
  improve(feishu): reduce preparation work for documents with tables (#148997)
  improve: reduce database work when recording participants (#148841)
  test: accept Bun error labels in plugin assertions (#148955)
  fix(models): clarify saved account health and catalog status (#148987)
  test(plugins): align Copilot auth-choice registry expectations (#148981)
  fix(channels): reject blank integer channel add options (#145534)
  fix(ui): preserve archive undo after chat navigation (#148831)
  feat: show cited source previews in macOS and iOS chat (#148906)
  fix: avoid redundant tab updates while chats stream (#148865)
  ...

* refactor(agents): consolidate tool description exclusions

* chore: merge main for tool summary validation

* commit '926bb1e1d75c6b102bcbf93114c690312c23cf18': (1903 commits)
  refactor(matrix): reuse startup verification account key (#157310)
  perf(config): avoid repeated environment scans during publication (#156457)
  chore(i18n): refresh native locales (#157495)
  fix(update): show quiet step progress and date recorded outcomes (#153407)
  feat(gateway): preserve browser sign-in requirements before connecting (#157454)
  test(scripts): await CLI admission fixture lifetimes (#157424)
  fix(ci): preserve consumer selection across core type stripes (#157373)
  fix(wizard): preserve typed plugin enum values (#127577) (#138090)
  fix(qa): title mock Code Mode fixture calls
  refactor: simplify SQLite worker lifecycle and test fixtures (#157458)
  test: prebuild run-node signal fixture (#157478)
  refactor(exec): reuse approval policy rule keys (#157198)
  fix(ci): reuse prepared runtime for changed-target E2E shards (#157365)
  fix(config): apply Gateway writes without waiting for file events (#157372)
  fix: count recorded nested tool operations once (#157438)
  fix(telegram): stop leaking raw file:// markdown links in messages (#137810)
  refactor(claws): share resource capability changes (#154680)
  improve(channels): reduce redundant preparation for button messages (#157050)
  fix(build): package preparation fails on unrelated test types (#157318)
  refactor(claws): share bounded document reading (#157436)
  ...

Co-authored-by: Vincent Koc <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 25, 2026
…8966)

* refactor(agents): centralize tool description exclusions

* Merge main into refactor/tool-description-exclusions-20260915

* commit '4a994031abb1b54d51b76755a55ac8f6e918162d': (40 commits)
  improve(sessions): reuse compiled transcript metadata queries (openclaw#148773)
  fix(ci): repair Copilot contracts and config failure diagnostics (openclaw#149001)
  test: align model auth and setup fixtures with current behavior (openclaw#149023)
  refactor: reuse web search request context (openclaw#148949)
  fix(ci): remove duplicate Copilot auth metadata (openclaw#149016)
  test(agents): align auth fixtures with runtime store reads (openclaw#149004)
  improve: reduce data fetched during reminder maintenance (openclaw#148996)
  fix(cron): skip availability checks when session pruning is idle (openclaw#148920)
  fix(auth): guard GitHub Copilot device flow authority (openclaw#148999)
  fix(agents): prevent early recovery aborts of foreground exec (openclaw#148959)
  fix(github-copilot): remove retired Raptor mini (openclaw#116505)
  improve(feishu): reduce preparation work for documents with tables (openclaw#148997)
  improve: reduce database work when recording participants (openclaw#148841)
  test: accept Bun error labels in plugin assertions (openclaw#148955)
  fix(models): clarify saved account health and catalog status (openclaw#148987)
  test(plugins): align Copilot auth-choice registry expectations (openclaw#148981)
  fix(channels): reject blank integer channel add options (openclaw#145534)
  fix(ui): preserve archive undo after chat navigation (openclaw#148831)
  feat: show cited source previews in macOS and iOS chat (openclaw#148906)
  fix: avoid redundant tab updates while chats stream (openclaw#148865)
  ...

* refactor(agents): consolidate tool description exclusions

* chore: merge main for tool summary validation

* commit 'e0f58a77476acbe382bff5e55cd520e9d228d478': (1903 commits)
  refactor(matrix): reuse startup verification account key (openclaw#157310)
  perf(config): avoid repeated environment scans during publication (openclaw#156457)
  chore(i18n): refresh native locales (openclaw#157495)
  fix(update): show quiet step progress and date recorded outcomes (openclaw#153407)
  feat(gateway): preserve browser sign-in requirements before connecting (openclaw#157454)
  test(scripts): await CLI admission fixture lifetimes (openclaw#157424)
  fix(ci): preserve consumer selection across core type stripes (openclaw#157373)
  fix(wizard): preserve typed plugin enum values (openclaw#127577) (openclaw#138090)
  fix(qa): title mock Code Mode fixture calls
  refactor: simplify SQLite worker lifecycle and test fixtures (openclaw#157458)
  test: prebuild run-node signal fixture (openclaw#157478)
  refactor(exec): reuse approval policy rule keys (openclaw#157198)
  fix(ci): reuse prepared runtime for changed-target E2E shards (openclaw#157365)
  fix(config): apply Gateway writes without waiting for file events (openclaw#157372)
  fix: count recorded nested tool operations once (openclaw#157438)
  fix(telegram): stop leaking raw file:// markdown links in messages (openclaw#137810)
  refactor(claws): share resource capability changes (openclaw#154680)
  improve(channels): reduce redundant preparation for button messages (openclaw#157050)
  fix(build): package preparation fails on unrelated test types (openclaw#157318)
  refactor(claws): share bounded document reading (openclaw#157436)
  ...

Co-authored-by: Vincent Koc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR 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. 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