fix(memory): fall back to qmd get for slugified paths#44390
fix(memory): fall back to qmd get for slugified paths#44390velisiska wants to merge 2 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR adds a fallback mechanism in Key observations:
Confidence Score: 3/5
Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/memory/qmd-manager.ts
Line: 896-902
Comment:
**Pagination ignored on `getQmdDoc` fallback**
When `getQmdDoc` successfully retrieves content and `params.from` / `params.lines` are specified, the full document is returned without slicing. The normal (file-exists) code path at lines 905–923 carefully applies pagination via `readPartialText` or manual slicing, but this new early-return branch bypasses all of that logic.
The `memory_get` tool in `src/agents/tools/memory-tool.ts` passes `from` and `lines` directly to `readFile`, so a caller that requests a specific window (e.g. `from: 10, lines: 5`) on a slugified qmd path would silently receive the entire document instead of the expected slice.
```suggestion
// Fall back to `qmd get` which can resolve slugified paths.
if (relPath.startsWith("qmd/")) {
const qmdText = await this.getQmdDoc(relPath);
if (qmdText !== null) {
if (params.from !== undefined || params.lines !== undefined) {
const allLines = qmdText.split("\n");
const start = Math.max(1, params.from ?? 1);
const count = Math.max(1, params.lines ?? allLines.length);
return { text: allLines.slice(start - 1, start - 1 + count).join("\n"), path: relPath };
}
return { text: qmdText, path: relPath };
}
}
```
How can I resolve this? If you propose a fix, please make it concise.Last reviewed commit: 4ebcb5a |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4ebcb5ab09
ℹ️ 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".
Summary
My Recipe Notes.md→my-recipe-notes.md), so filesystem reads viareadFile()fail with ENOENTgetQmdDoc()fallback that retrieves document content viaqmd getusingqmd://URIs when the filesystem path doesn't existmemory_gettool calls to return full document content for qmd search resultsAI-assisted
pnpm build && pnpm check && pnpm testall passing (906 test files, 7495 tests)Test plan
qmd getresolves slugified paths in running containerreadFile()fallback returns full document contentpnpm buildpassespnpm checkpassespnpm testpasses (7495 tests, 0 failures)🤖 Generated with Claude Code