Fix memory-core QMD slugified path mapping for legacy collection names#57873
Fix memory-core QMD slugified path mapping for legacy collection names#57873rrpsantos wants to merge 1 commit intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR fixes a path resolution failure in Changes:
Minor note: Confidence Score: 5/5Safe to merge; the path-resolution logic is sound, and the one remaining finding is a stats-only inconsistency in All functional path-resolution call sites have been updated to use the new
|
| Filename | Overview |
|---|---|
| extensions/memory-core/src/memory/qmd-manager.ts | Adds listCollectionLookupNames and resolveCollectionRoot helpers to handle agent-suffixed vs. base collection name mismatches, and applies them to the three path-resolution call sites; one remaining direct collectionRoots.get in readCounts() is a minor stats-only inconsistency. |
Comments Outside Diff (1)
-
extensions/memory-core/src/memory/qmd-manager.ts, line 2162-2163 (link)readCounts()still uses a direct map lookupreadCounts()still usesthis.collectionRoots.get(row.collection)directly instead of the newresolveCollectionRoothelper. In the exact scenario this PR fixes — where the DB has documents indexed under an agent-suffixed name (e.g.,workspace-main) butcollectionRootsonly holds the base name (workspace) — this lookup will returnundefined, causing every document in that collection to be bucketed under the fallback"memory"source kind rather than its real kind. The impact is limited to thestatus()reporting surface (sourceCounts), but it's the same class of mismatch the rest of the PR corrects.Prompt To Fix With AI
This is a comment left during a code review. Path: extensions/memory-core/src/memory/qmd-manager.ts Line: 2162-2163 Comment: **`readCounts()` still uses a direct map lookup** `readCounts()` still uses `this.collectionRoots.get(row.collection)` directly instead of the new `resolveCollectionRoot` helper. In the exact scenario this PR fixes — where the DB has documents indexed under an agent-suffixed name (e.g., `workspace-main`) but `collectionRoots` only holds the base name (`workspace`) — this lookup will return `undefined`, causing every document in that collection to be bucketed under the fallback `"memory"` source kind rather than its real kind. The impact is limited to the `status()` reporting surface (`sourceCounts`), but it's the same class of mismatch the rest of the PR corrects. How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/memory-core/src/memory/qmd-manager.ts
Line: 2162-2163
Comment:
**`readCounts()` still uses a direct map lookup**
`readCounts()` still uses `this.collectionRoots.get(row.collection)` directly instead of the new `resolveCollectionRoot` helper. In the exact scenario this PR fixes — where the DB has documents indexed under an agent-suffixed name (e.g., `workspace-main`) but `collectionRoots` only holds the base name (`workspace`) — this lookup will return `undefined`, causing every document in that collection to be bucketed under the fallback `"memory"` source kind rather than its real kind. The impact is limited to the `status()` reporting surface (`sourceCounts`), but it's the same class of mismatch the rest of the PR corrects.
```suggestion
const root = this.resolveCollectionRoot(row.collection);
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(memory-core): resolve qmd collection..." | Re-trigger Greptile
|
Good approach for bridging the legacy vs. slugified collection naming gap. A couple of things to consider:
|
|
Nice approach using Edge case — mutual collision: If a collection is named
No test update: The PR description mentions this fixes a legacy name mapping issue — adding a test with a slugified name that maps to a legacy root would lock in the behavior and document the intended semantics. Overall the abstraction is clean and the fix is targeted. The edge case around name collisions is the main thing worth verifying. |
|
Closing this PR. It was opened from an autonomous agent workflow without the explicit approval we now require for external OSS contributions. Preserving local evidence, but withdrawing the upstream contribution. Apologies for the noise. |
Fixes a deterministic extensions failure seen in CI (
checks-fast-extensions):extensions/memory-core/src/memory/qmd-manager.slugified-paths.test.tswas expecting slugified QMD URIs likeqmd://vault-main/...to map back to indexed paths, but results were[].Root cause:
collectionRoots. In some scenarios, the manager’s configured collections use an agent suffix (e.g.workspace-main), while search results / indexed paths can reference the legacy/alternate name.Change:
Local QA:
corepack pnpm checkcorepack pnpm vitest run --config vitest.extensions.config.ts extensions/memory-core/src/memory/qmd-manager.slugified-paths.test.ts