refactor(core): fix sameModel tautology, add query limits, deduplicate agent name lookup#31436
Open
Sylchi wants to merge 2 commits into
Open
refactor(core): fix sameModel tautology, add query limits, deduplicate agent name lookup#31436Sylchi wants to merge 2 commits into
Sylchi wants to merge 2 commits into
Conversation
added 2 commits
June 9, 2026 06:26
…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
…e agent name lookup
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate Found:
Recommendation: Check PR #31432 to see if there are conflicting or overlapping changes to the same query limits. If that PR is already addressing some of the same performance optimizations, coordinate to avoid duplicate work. |
This was referenced Jun 9, 2026
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 — compounding performance issues discovered during code analysis.
Type of change
What does this PR do?
Fixes four compounding performance issues:
Bug fix (llm.ts):
sameModel(session.model, session.model)comparedsession.modelto itself — always true, making the model inconsistency check dead code. Removed the tautology.Query limits: Added
.limit()to four unbounded queries that grow over time —messageRowsin history (500),getAllSessionsin stats (1000),Project.list(200),SessionTodo.get(200).Deduplicated agent name lookup (prompt.ts): The
(yield* agents.list()).filter(!hidden).map(name)pattern was copied 5 times. Extracted into avisibleAgentNameshelper.Doom-loop JSON serialization (processor.ts):
JSON.stringify(input)was called per-part (3x) instead of once. Pre-computed before the.every()check.How did you verify your code works?
Screenshots / recordings
N/A
Checklist