Repository navigation
perf(sessions): avoid loading full transcripts for newest-event checks - #127162
Merged
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
steipete
marked this pull request as ready for review
August 21, 2026 11:10
Contributor
Author
|
Land-ready proof for exact head
ClawSweeper disposition: the latest comment is still the review-start placeholder and contains no AI-assisted; no agent transcript is attached. |
Contributor
Author
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Aug 22, 2026
Kimiyu-186
added a commit
that referenced
this pull request
Aug 25, 2026
Amp-Thread-ID: https://ampcode.com/threads/T-01a021f5-984a-7628-a30c-491c166ff247 Co-authored-by: Amp <[email protected]> (cherry picked from commit 096a970) Co-authored-by: Peter Steinberger <[email protected]>
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Fixes an issue where transcript existence and assistant-idempotency checks loaded every SQLite
event_jsonrow before testing the newest event, so a newest-row match still scaled with the complete transcript size.Why This Change Was Made
The canonical newest-first lookup now consumes the existing synchronous SQLite iterator directly and stops stepping rows as soon as its matcher succeeds. Ordering, malformed-row skipping, first-match behavior, transaction lifetime, schema, and public APIs are unchanged.
This is AI-assisted. No agent transcript is attached.
User Impact
Large sessions no longer incur transcript-sized CPU and heap work for newest-event checks. In a 10,002-row, approximately 40 MiB fixture, five newest-row probes improved from 50,010 rows stepped, 225.416 ms wall time, and +217.335 MiB heap to 5 rows, 5.213 ms, and +0.662 MiB heap (about 43x faster wall time).
Evidence
expected 3 rows, received 1, proving eager materialization occurred before the matcher returned.node scripts/run-vitest.mjs src/config/sessions/session-accessor.test.ts src/gateway/server-methods/chat.inject.parentid.test.ts --reporter=dotnode scripts/check-changed.mjs -- src/config/sessions/session-accessor.sqlite-read.ts src/config/sessions/session-accessor.test.tspassed formatting, core/core-test typechecks, lint, dead exports, database/schema guards, and import-cycle checks.git diff --check origin/main...HEADpassed.findTranscriptEventor lazy SQLite transcript scanning. Open PRs fix(sessions): preserve transcript idempotency keys #125221, fix(sessions): guard sync transcript rewrite against concurrent commits #124899, and fix(sessions): detect concurrent transcript conflicts in sync rewrite (#124393) #124749 touch adjacent transcript code for distinct idempotency-key or rewrite-conflict work.