fix(stats): distinguish configured scopes from observed DB scopes#468
Open
Garyko0730 wants to merge 1 commit intoCortexReach:masterfrom
Open
fix(stats): distinguish configured scopes from observed DB scopes#468Garyko0730 wants to merge 1 commit intoCortexReach:masterfrom
Garyko0730 wants to merge 1 commit intoCortexReach:masterfrom
Conversation
AliceLJY
approved these changes
Apr 3, 2026
Collaborator
AliceLJY
left a comment
There was a problem hiding this comment.
The configured-vs-observed scope split is the right fix here. I re-ran node --test test/scope-stats-regression.test.mjs and node test/cli-smoke.mjs on the PR branch; both passed.
Collaborator
|
LGTM on the code. This PR currently has merge conflicts, so please rebase onto |
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.
Summary
This PR fixes a confusing scope stats mismatch in
memory-pro stats/ memory stats tool output.Previously, the plugin mixed two different scope views:
ScopeManager.getStats()store.stats().scopeCountsThis could produce misleading output such as:
memory.scopeCounts.agent:main = 225scopes.totalScopes = 1which looks like a broken memory system even when the database is healthy.
What changed
1. Separate configured vs observed scope stats
summarizeScopesByType(scopes: string[])insrc/scopes.tsScopeManager.getStats()focused on configured scopesObject.keys(stats.scopeCounts)2. Improve CLI stats output
Updated
memory-pro statsto show:3. Improve tool/API stats output
Updated memory stats tool output/details to expose both:
configuredobservedwhile preserving top-level compatibility fields.
4. Add regression coverage
Added:
test/scope-stats-regression.test.mjsUpdated:
test/cli-smoke.mjsWhy this matters
Users can now distinguish:
This makes debugging much easier after migrations, imports, or historical scope writes.
Validation
Ran locally:
node --test test/scope-stats-regression.test.mjsnode test/cli-smoke.mjsBoth passed.
Notes
This PR intentionally does not include local memory data cleanup.
Only reusable plugin code + regression tests are included.