fix(memory): include archived session transcripts in QMD export#43947
fix(memory): include archived session transcripts in QMD export#43947holgergruenhagen wants to merge 2 commits into
Conversation
Greptile SummaryThis PR fixes a silent data-loss path in the QMD session export by extending Key observations:
Confidence Score: 5/5
Last reviewed commit: 4d4ebb4 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4d4ebb4f53
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| .filter((entry) => entry.isFile()) | ||
| .map((entry) => entry.name) | ||
| .filter((name) => name.endsWith(".jsonl")) | ||
| .filter((name) => SESSION_EXPORT_FILE_RE.test(name)) |
There was a problem hiding this comment.
Exclude archived transcripts from shared session file listing
listSessionFilesForAgent() is now returning *.jsonl.reset.* and *.jsonl.deleted.*, but that helper is also used by syncSessionFiles (src/memory/manager-sync-ops.ts) to build the searchable sessions index, not just by QMD export. In environments with sessions indexing enabled, reset/deleted transcripts are re-indexed as active docs, so content users explicitly reset/delete can still be recalled and index size grows with archive retention; this should be scoped to QMD export or gated behind a separate archive-aware path.
Useful? React with 👍 / 👎.
|
Follow-up after opening this PR: I found related existing threads that I should have linked up front. Related:
So for maintainers: this PR should be read as a minimal alternative to the broader variants, not as the first report/fix for the problem. What is intentionally different here:
Also, the follow-up push fixes the Windows CI failure from the first version of the new test by making the test state-dir-aware ( If maintainers prefer consolidating on #30273 or #20183 instead of keeping this smaller variant, I'm happy to close this PR. |
|
Thanks for the fix here. Closing this as superseded by #57446, which carries the archived-session export fix onto the current I kept the same small scope: include reset/deleted transcript history without widening into unrelated archive traversal behavior. |
|
Thanks for picking this up and porting it to the current code path, @vincentkoc! Glad the fix made it into #57446 — happy to see the archived transcript coverage land properly on top of the new |
Summary
listSessionFilesForAgent().jsonl.reset.*and.jsonl.deleted.*in the agent sessions rootProblem
The QMD session export currently only picks up live
*.jsonltranscript files.When a session is reset, OpenClaw renames the transcript to something like:
session-id.jsonl.reset.<timestamp>session-id.jsonl.deleted.<timestamp>After that rename, the transcript disappears from the QMD session export because
listSessionFilesForAgent()filters strictly onname.endsWith(".jsonl").In practice this means older sessions can silently drop out of
qmd/sessions/*.mdeven though the transcript still exists locally.Why this change
This is the smallest safe fix for the observed data-loss path:
sessions/archive/...files are still out of scope for this PR on purposeThat broader archive behavior likely deserves a separate product decision around retention/deduplication.
Test
pnpm exec vitest run --config vitest.unit.config.ts src/memory/session-files.test.ts