You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix memory panel pagination and skill usage analytics - #726
rerelyUsedSkills now issues two extra queries that can each pull 10k full rows (listRecallEvents uses SELECT *, so query, request_json and dropped_json are parsed for every row), and then discards everything outside the 7-day window in JS. Because LIMIT is applied before the date filter, a busy instance silently truncates the window and reports a low count.
Pass the oldest date key (dates[0]) as a SQL-level lower bound (and add created_at indexes) so the database can bound the range instead of relying on a row cap.
This read is used for an aggregate count, but SELECT * hydrates the whole RecallEventRecord (query text, request payload, dropped list) for up to 10k rows. recall_events only has idx_recall_events_session_created (leading session_id), so ORDER BY created_at DESC without a session filter requires a full scan plus sort.
For the panel path, consider a narrow aggregate read that projects only created_at and hit_memory_ids_json, plus a created_at index. If this generic method is kept, an optional since clause would let callers push the time window into SQL.
Summing both signals double-counts a single use: whenever the skill-invoke path also records a recall event (retrievalMode: "skill_invoke"), the same skill contributes once through invoked and again through recalled. It also treats a skill that merely appeared in memory_search results β never applied β as a "use".
When the label is "skill uses", consider counting skill trials only, or deduplicate per skill per turn/session instead of adding the two totals.
4. Memory/src/service/read-model/panel.ts (L103)
panelSourceForStatsRow never reads id; making it required on MemoryStatsRow forces this caller to pass a field the helper ignores. Narrowing the parameter keeps the projection honest while the aggregate read model still gets id where it is actually needed.
π‘ Suggested Change
Before:
id: memory.id,
After:
function panelSourceForStatsRow(memory: Omit<MemoryStatsRow, "id">): string {
The if (input.activeSkillIds.size === 0) return 0; guard inside panelActivatedSkillUseCount cannot save any work: both queries are evaluated as arguments before the helper is entered, so an installation with zero activated skills still pays for two 10k-row reads on every analytics refresh. Short-circuit before the calls (e.g. only build the recentlyUsedSkills input when activeSkillIds.size > 0, otherwise pass empty arrays) so the guard actually avoids the queries.
Generated by cloud-assistant via Open Code Review.
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
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.
No description provided.