Skip to content

[Bug]: QMD session exporter ignores reset/deleted session transcripts (.jsonl.reset.*, .jsonl.deleted.*) #30220

@TrevorHinesley

Description

@TrevorHinesley

Description

listSessionFilesForAgent() in query-expansion-*.js filters session files with .endsWith(".jsonl"), which excludes reset and deleted session transcripts that have suffixes like .jsonl.reset.<timestamp> and .jsonl.deleted.<timestamp>.

This means memory_search over session transcripts only returns results from active sessions. On a setup with daily resets, most conversation history becomes unsearchable immediately after reset.

Reproduction

  1. Configure memory.qmd.sessions.enabled: true
  2. Use daily session resets (session.reset.mode: "daily")
  3. After a few days, check the QMD sessions export directory vs the actual sessions directory:
# Files on disk (includes .reset and .deleted)
ls ~/.openclaw/agents/main/sessions/*.jsonl* | wc -l
# 39

# Files indexed by QMD (only .jsonl)
ls ~/.openclaw/agents/main/qmd/sessions/*.md | wc -l  
# 12

Root cause

query-expansion-*.js line ~257:

async function listSessionFilesForAgent(agentId) {
  const dir = resolveSessionTranscriptsDirForAgent(agentId);
  try {
    return (await fs.readdir(dir, { withFileTypes: true }))
      .filter((entry) => entry.isFile())
      .map((entry) => entry.name)
      .filter((name) => name.endsWith(".jsonl"))  // <-- excludes .jsonl.reset.* and .jsonl.deleted.*
      .map((name) => path.join(dir, name));
  } catch { return []; }
}

Expected behavior

Reset (and optionally deleted) session transcripts should be indexed by QMD and searchable via memory_search. These contain the bulk of conversation history on any setup using daily resets.

A possible fix: change the filter to match any filename containing .jsonl (e.g. /\.jsonl/ test instead of .endsWith(".jsonl")), or add a config option like memory.qmd.sessions.includeArchived: true.

resetArchiveRetention already controls how long these files live on disk, so QMD retention would naturally follow.

Environment

  • OpenClaw version: latest (installed via npm)
  • Node: v25.6.1
  • OS: Linux (Hetzner VPS)
  • QMD backend: external (memory.qmd.mcporter)
  • Session reset mode: daily

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions