fix(qmd): include archived session transcripts in file listing#30273
fix(qmd): include archived session transcripts in file listing#30273pushkarsingh32 wants to merge 3 commits into
Conversation
listSessionFilesForAgent() filtered with .endsWith(".jsonl") which
excluded reset (.jsonl.reset.*) and deleted (.jsonl.deleted.*) session
transcripts. On setups with daily session resets, this made most
conversation history unsearchable via memory_search.
Broaden the filter to also match files containing ".jsonl." so archived
transcripts are included in QMD indexing.
Fixes openclaw#30220
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1229796061
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| .filter((entry) => entry.isFile()) | ||
| .map((entry) => entry.name) | ||
| .filter((name) => name.endsWith(".jsonl")) | ||
| .filter((name) => name.endsWith(".jsonl") || name.includes(".jsonl.")) |
There was a problem hiding this comment.
Restrict session filter to actual transcript artifacts
The new predicate name.includes(".jsonl.") also matches lock files like *.jsonl.lock, which are created in the same sessions directory (src/agents/session-write-lock.ts:429). That means listSessionFilesForAgent() now returns non-transcript artifacts, so full sync/export paths will treat lock files as session inputs and generate empty session records/markdown outputs, adding index churn and noisy artifacts. Please narrow this to known transcript/archive filename patterns instead of any .jsonl. substring.
Useful? React with 👍 / 👎.
Greptile SummaryThis PR fixes a bug where
Confidence Score: 4/5
Last reviewed commit: 1229796 |
| .filter((entry) => entry.isFile()) | ||
| .map((entry) => entry.name) | ||
| .filter((name) => name.endsWith(".jsonl")) | ||
| .filter((name) => name.endsWith(".jsonl") || name.includes(".jsonl.")) |
There was a problem hiding this comment.
No test coverage for the new filter behavior
The existing test suite covers buildSessionEntry but there are no tests for listSessionFilesForAgent — neither before nor after this change. The PR description marks the manual reset-mode verification step as unchecked, which means the new name.includes(".jsonl.") branch is untested.
Consider adding a unit test that creates mock files with archived names (e.g. session.jsonl.reset.2026-02-16T22-26-33.000Z) in a temp directory and asserts they are returned by listSessionFilesForAgent, similar to how buildSessionEntry is tested in session-files.test.ts.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/memory/session-files.ts
Line: 28
Comment:
**No test coverage for the new filter behavior**
The existing test suite covers `buildSessionEntry` but there are no tests for `listSessionFilesForAgent` — neither before nor after this change. The PR description marks the manual reset-mode verification step as unchecked, which means the new `name.includes(".jsonl.")` branch is untested.
Consider adding a unit test that creates mock files with archived names (e.g. `session.jsonl.reset.2026-02-16T22-26-33.000Z`) in a temp directory and asserts they are returned by `listSessionFilesForAgent`, similar to how `buildSessionEntry` is tested in `session-files.test.ts`.
How can I resolve this? If you propose a fix, please make it concise.Address review feedback: the previous .includes(".jsonl.") filter
would match non-transcript files like .jsonl.lock. Use the existing
isPrimarySessionTranscriptFileName and isSessionArchiveArtifactName
helpers from artifacts.ts for precise filtering.
Add unit test for listSessionFilesForAgent verifying that primary,
reset, and deleted session files are included while lock files,
sessions.json, and unrelated files are excluded.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 37f5eb487d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| .map((entry) => entry.name) | ||
| .filter((name) => name.endsWith(".jsonl")) | ||
| .filter( | ||
| (name) => isPrimarySessionTranscriptFileName(name) || isSessionArchiveArtifactName(name), |
There was a problem hiding this comment.
Restrict archive filter to transcript filenames
listSessionFilesForAgent() now accepts any isSessionArchiveArtifactName(name), but that helper explicitly matches legacy sessions.json.bak.<ts> files (src/config/sessions/artifacts.ts), and those backups are created in the same sessions directory by rotateSessionFile() (src/config/sessions/store.ts). Because buildSessionEntry() then parses them as if they were JSONL transcripts, they get indexed/exported as empty session artifacts, creating noisy memory rows/markdown files whenever store rotation happens. Limit the archive branch to JSONL transcript archives only (for example, *.jsonl.<reason>.<timestamp>).
Useful? React with 👍 / 👎.
Address review: isSessionArchiveArtifactName also matches legacy
sessions.json.bak.* store backups which are not JSONL transcripts.
Replace with a focused regex that only matches .jsonl.{reset,deleted,bak}
archives with ISO timestamps. Update test to verify sessions.json.bak.*
is excluded.
|
Thanks for the fix here. Closing this as superseded by #57446, which ports the archived-session export fix onto the current Your diagnosis was right: the suffix-only |
Summary
listSessionFilesForAgent()excluding reset and deleted session transcripts from QMD indexingRoot cause: The file filter used
.endsWith(".jsonl")which excluded archived files with suffixes like.jsonl.reset.2026-02-16T22-26-33.000Zand.jsonl.deleted.2026-02-16T22-26-33.000Z. On setups with daily session resets, most conversation history became unsearchable viamemory_search.Fix: Broaden the filter to also match filenames containing
.jsonl.so archived transcripts are included.Changes
src/memory/session-files.ts: Update filter to include.jsonl.*archived filesTest plan
session-files.test.ts— 3/3,artifacts.test.ts— 3/3)session.reset.mode: "daily"and verify archived sessions appear inmemory_searchresults after resetFixes #30220