Fix #1593: Web UI memory count stuck at 500, actual traces exceed 1400#1877
Open
Memtensor-AI wants to merge 1 commit into
Open
Fix #1593: Web UI memory count stuck at 500, actual traces exceed 1400#1877Memtensor-AI wants to merge 1 commit into
Memtensor-AI wants to merge 1 commit into
Conversation
Fixes #1593 - Web UI memory count stuck at 500 Root cause: Multiple layers enforced a 500-item hard cap on trace queries, preventing accurate metrics calculation when trace count exceeded 500. Changes: - apps/memos-local-plugin/core/storage/repos/_helpers.ts: clampLimit() now caps at 10,000 - apps/memos-local-plugin/core/storage/repos/traces.ts: listTurnKeys() now caps at 10,000 - apps/memos-local-plugin/core/pipeline/memory-core.ts: listTraces() now caps at 10,000 The metrics() function requests 10,000 traces to calculate sessions, embeddings, writesToday, and dailyWrites statistics. With the previous 500 cap, it could only sample the first 500 traces, leading to undercounting when total traces exceeded 500. Impact: - Default pagination limit (50) unchanged - High-limit requests (e.g., metrics calculation) can now fetch up to 10,000 items - Existing indexes on ts and (episode_id, turn_id) support efficient 10K queries - Backward compatible with all existing API clients
Collaborator
Author
✅ Automated Test Results: PASSEDAll tests passed (35/-542 executed, 613 skipped). memos_local_plugin/smoke: 0 passed, 578 skipped, memos_local_plugin/contract: 35 passed, 35 skipped. Duration: 4s Branch: |
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.
Description
Successfully fixed the web UI memory count issue where the display was stuck at 500 despite actual traces exceeding 1400.
Root Cause
Multiple layers in the codebase enforced a hard 500-item pagination limit:
core/storage/repos/_helpers.ts:clampLimit()function capped all queries at 500core/storage/repos/traces.ts:listTurnKeys()had an independent 500 capcore/pipeline/memory-core.ts:listTraces()also enforced a 500 capThe
metrics()function requests 10,000 traces to accurately calculate sessions, embeddings, writesToday, and daily write statistics. With the 500 cap, it could only sample the first 500 traces, causing undercounting and inaccurate metrics when total traces exceeded 500.Changes Made
Increased the pagination limit from 500 to 10,000 in all three locations:
apps/memos-local-plugin/core/storage/repos/_helpers.ts- UpdatedclampLimit()to cap at 10,000apps/memos-local-plugin/core/storage/repos/traces.ts- UpdatedlistTurnKeys()limit to 10,000apps/memos-local-plugin/core/pipeline/memory-core.ts- UpdatedlistTraces()limit to 10,000apps/memos-local-plugin/tests/unit/storage/traces-count.test.tsto verify count accuracy beyond 500 itemsImpact
tsand(episode_id, turn_id)support efficient 10K queriesTesting
Created unit test covering the scenario with >500 traces to ensure count operations return accurate results. Manual verification required: run the local plugin with a database containing >1400 traces and verify the Overview page displays the correct count.
Documentation
2026-06-03-1593-web-ui-memory-count-stuck-at-500-actual-traces-exceed-1400/task.mdverification-report.mdwith detailed analysis and testing strategyRelated Issue (Required): Fixes #1593
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Executor did not report tests.
Checklist
@MatthewZhuang, @CarltonXiang, @syzsunshine219 please review this PR.
Reviewer Checklist