Skip to content

Commit c386669

Browse files
committed
fix(memory): align session file counter denominator with indexer filter
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 #77338
1 parent 3563850 commit c386669

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

extensions/memory-core/src/cli.runtime.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
resolveMemoryRemDreamingConfig,
1010
} from "openclaw/plugin-sdk/memory-core-host-status";
1111
import { buildAgentSessionKey } from "openclaw/plugin-sdk/routing";
12+
import { isUsageCountedSessionTranscriptFileName } from "openclaw/plugin-sdk/memory-core-host-engine-qmd";
1213
import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
1314
import {
1415
colorize,
@@ -526,7 +527,7 @@ async function scanSessionFiles(agentId: string): Promise<SourceScan> {
526527
try {
527528
const entries = await fs.readdir(sessionsDir, { withFileTypes: true });
528529
const totalFiles = entries.filter(
529-
(entry) => entry.isFile() && entry.name.endsWith(".jsonl"),
530+
(entry) => entry.isFile() && isUsageCountedSessionTranscriptFileName(entry.name),
530531
).length;
531532
return { source: "sessions", totalFiles, issues };
532533
} catch (err) {

0 commit comments

Comments
 (0)