fix(memory): align session file counter denominator with indexer filter (fixes #77338)#93064
fix(memory): align session file counter denominator with indexer filter (fixes #77338)#93064liuhao1024 wants to merge 1 commit into
Conversation
scanSessionFiles used .endsWith('.jsonl') for the denominator, but the
indexer (listSessionFilesForAgent) uses isUsageCountedSessionTranscriptFileName
which also includes .jsonl.reset.* and .jsonl.deleted.* archive artifacts.
This filter divergence caused the sessions counter to show N > M (numerator
exceeds denominator) when archive files exist.
Switch the denominator filter to isUsageCountedSessionTranscriptFileName
to match the indexer's enumeration.
Fixes openclaw#77338
|
Codex review: needs real behavior proof before merge. Reviewed June 15, 2026, 4:25 PM ET / 20:25 UTC. Summary PR surface: Source +1. Total +1 across 1 file. Reproducibility: yes. Source inspection gives a high-confidence reproduction path: create usage-counted reset/deleted archive files under the agent sessions directory, then current Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Merge the focused predicate alignment after the contributor adds redacted real CLI output showing the session counter no longer overflows with reset/deleted archives present. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection gives a high-confidence reproduction path: create usage-counted reset/deleted archive files under the agent sessions directory, then current Is this the best way to solve the issue? Yes. This PR is the best narrow fix for the counter mismatch because reset/deleted archive recall is an intentional current contract; excluding those archives from indexing would regress protected memory-search behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against efa9a6110b4e. Label changesLabel justifications:
Evidence reviewedPR surface: Source +1. Total +1 across 1 file. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Auto-cleanup: freeing PR slots for higher-quality contributions. Feel free to reopen if still relevant. |
What
openclaw memory statusreportssessions · N/Mwhere N > M (numerator exceeds denominator) when.jsonl.reset.*or.jsonl.deleted.*archive files exist in the sessions directory.Root cause:
scanSessionFiles(denominator) uses.endsWith(".jsonl")which only counts primary transcript files. The indexerlistSessionFilesForAgent(numerator) usesisUsageCountedSessionTranscriptFileNamewhich also includes reset/deleted archive files. This filter divergence causes the overflow.Fix: Replace
.endsWith(".jsonl")withisUsageCountedSessionTranscriptFileNameinscanSessionFilesto align the denominator with the indexer.Fixes #77338
Real behavior proof
openclaw memory statusshowing N > M when archive artifacts existscanSessionFilesusesisUsageCountedSessionTranscriptFileNamevia greppnpm build— compiled successfullysrc/config/sessions/artifacts.test.ts— 9 verification passesisUsageCountedSessionTranscriptFileNamewhich includes primary.jsonlfiles plus.jsonl.reset.*and.jsonl.deleted.*archivesopenclaw memory statuscommand on a container with archive files (requires agent setup with session history)