refactor(core): add query limits, context caching, indexed queries, and tool message fix#31432
Open
Sylchi wants to merge 1 commit into
Open
refactor(core): add query limits, context caching, indexed queries, and tool message fix#31432Sylchi wants to merge 1 commit into
Sylchi wants to merge 1 commit into
Conversation
…ool message fix - Add default limits to session listing (50), messages (200), shell messages (200), steer promotion (100), and parts query - Cache context history in llm runner to only fetch deltas between turns - Switch to selective column queries in history loading - Add composite indexes for session sort/list queries - Optimize token estimation to avoid JSON.stringify overhead - Fix tool result ordering and deduplication in to-llm-message - Replace structuredClone with JSON.parse/stringify for compat - Add bench:session script and stale_tomas migration
Contributor
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
This was referenced Jun 8, 2026
Open
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.
Issue for this PR
N/A — performance improvements discovered during code analysis.
Type of change
What does this PR do?
Adds query limits across session listing, messages, shell messages, steer promotion, and parts to prevent unbounded queries on large sessions. Adds a context cache in the LLM runner so only delta history entries are fetched between turns instead of re-loading everything. Switches to selective column queries in history loading and adds composite indexes for common session sort/list patterns. Fixes tool result ordering and deduplication in
to-llm-message.ts. See commit diff for full list.How did you verify your code works?
Screenshots / recordings
N/A
Checklist