fix(active-memory): use bundled recall tool#73584
Conversation
Greptile SummaryThis PR fixes the tool name mismatch between Active Memory's recall sub-agent and the
Confidence Score: 3/5Not safe to merge as-is: fixes LanceDB recall but introduces a regression for memory-core users whose recall will silently stop working. One P1 regression — hardcoding toolsAllow to ["memory_recall"] blocks the memory-core backend tools — prevents this from scoring higher than 3. extensions/active-memory/index.ts — specifically the toolsAllow change at line 1692 and the prompt at lines 792–793.
|
|
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Keep open. This PR is protected by cleanup policy because the author is a MEMBER and the PR has the maintainer label. It is also still a live implementation candidate: current main still wires Active Memory to memory_search/memory_get only, while bundled memory-lancedb exposes memory_recall for recall. Best possible solution: Keep this PR open for explicit maintainer review. If the approach is accepted, land this PR or an equivalent patch that lets Active Memory use both bundled memory contracts, updates the docs/tests/QA mock, and records or resolves the intended privacy scope for memory-lancedb recall. Close the linked bug only after the implementation merges. What I checked:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against dd643c82b55e. |
0596088 to
f2ed7b6
Compare
f2ed7b6 to
c997346
Compare
🔒 Aisle Security AnalysisWe found 1 potential security issue(s) in this PR:
1. 🟡 Active Memory sub-agent can request unbounded memory dump via newly-allowed memory_recall(limit)
Description
Because the recall sub-agent is driven by the current conversation context (including potentially untrusted group-chat participants), it can be prompted to call
Changed code enabling this broader retrieval path: toolsAllow: ["memory_recall", "memory_search", "memory_get"],Relevant tool behavior (existing, but newly reachable by the sub-agent):
RecommendationMitigate bulk exfiltration by enforcing a hard upper bound on recall results at the tool boundary and/or at the sub-agent boundary. Option A (tool-side clamp; recommended because it protects all callers): // in memory_recall execute
const requested = typeof limit === "number" ? limit : 5;
const safeLimit = Math.max(1, Math.min(requested, 10)); // choose a small cap
const results = await db.search(vector, safeLimit, 0.1);Option B (sub-agent-side): prevent the recall agent from requesting large limits by stripping/overriding Additionally, consider returning summaries/snippets instead of full Analyzed PR: #73584 at commit Last updated on: 2026-04-28T14:03:30Z |
Summary
Fixes #73502.
Active Memory was still wiring its hidden recall sub-agent to the legacy memory-core tools:
But the bundled
memory-lancedbbackend exposes the current recall surface as:That made the bundled Active Memory + bundled Memory LanceDB integration a plug/socket mismatch: when
memory-lancedbwas selected as the memory slot, Active Memory prompted and allowlisted only the legacy tools, so recall could fail even though LanceDB itself was configured and working.This PR aligns Active Memory with both bundled memory contracts by:
memory_recall,memory_search, ormemory_getmemory_recallwhen available, and fall back tomemory_search/memory_getwhen that is the backend surfacememory_searchtool-result tracesmemory_recallpathmemory_search/memory_getpathWhy this shape: using only
memory_recallfixes LanceDB but regressesmemory-core; using onlymemory_search/memory_getpreserves memory-core but leaves LanceDB broken. Allowing both tool families and instructing the sub-agent to prefer the available current recall tool preserves both bundled paths.I also scanned the other memory-related prompt/docs references. The remaining
memory_search/memory_getreferences are intentionally memory-core-specific docs/tests, generic tool-policy docs, or QA scenarios that explicitly exercise the legacy memory-core flow.Validation
Passed:
Also passed:
rg -n 'only calls `memory_search` and `memory_get`|The blocking memory sub-agent can use only:|Use only memory_search and memory_get|Use only memory_recall|normal `memory_search` pipeline' docs/concepts/active-memory.md extensions/active-memory extensions/qa-lab/src/providers/mock-openai/server.test.tsThe
rgcommand exits 1 because it finds no remaining stale Active Memory-only phrasing.Also run earlier:
pnpm checkcurrently fails intsgo:prodon latestorigin/mainwith unrelated broad type/dependency errors outside this patch, including TypeBox resolution from/Users/thoffman/node_modules, model compat typing errors, and missing@vincentkoc/qrcode-tui. The focused changed-surface tests above pass.Manual testing: none; covered by focused automated tests.