Repository navigation
fix(memory): stop retained tools after memory is disabled - #125393
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 5:10 PM ET / 21:10 UTC. ClawSweeper reviewWhat this changesThe PR makes retained built-in and LanceDB memory tools recheck the live agent memory setting before reading, storing, searching, or deleting memory after a hot configuration update. Merge readinessThis PR remains necessary: current main lacks execution-time revocation for retained memory tools. The patch places the check at each tool execution owner, covers both bundled implementations, and has no blocking correctness finding; the protected maintainer label and incomplete exact-head CI keep merge handling human-owned. Priority: P1 Review scores
Verification
How this fits togetherAgent runs create memory tools from the current configuration, then may invoke those retained tools later. The built-in memory plugin and the LanceDB plugin both sit between those invocations and their file, embedding, and database backends. flowchart LR
A[Agent run creates memory tools] --> B[Operator disables memory]
B --> C[Retained tool invocation]
C --> D[Live agent setting check]
D -->|enabled| E[Memory file or database backend]
D -->|disabled| F[Actionable tool error]
E --> G[Tool result]
Decision needed
Why: The source review is clean, but the protected maintainer label and incomplete current-head checks require an explicit human merge decision. Before merge
Agent review detailsSecurityNone. PR surfaceSource +25, Tests +52. Total +77 across 4 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the per-execution live-config gates in both memory owners, then rebase or refresh the branch and land after exact-head CI is green. Do we have a high-confidence way to reproduce the issue? Yes, from source: retain a tool created while memory is enabled, then make its live configuration disable memory; current-main fallback logic continues with the captured context, while the added tests encode the failing path. Is this the best way to solve the issue? Yes. Revalidating immediately before each retained tool touches its backend is the narrow owner-boundary repair; creation-time gating alone cannot enforce a later hot-config revocation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against bb03085015e9. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
What Problem This Solves
Fixes an issue where agents already using memory could keep accessing it after an operator disabled memory for that agent through a hot configuration update.
Why This Change Was Made
Retained memory tools now revalidate the current agent configuration at execution time across both the built-in memory tools and the LanceDB memory plugin. Fixed-snapshot tool callers without a live configuration getter keep their existing behavior.
User Impact
Disabling memory now takes effect for active agents before any subsequent memory read, write, or delete. Enabled agents and ordinary configuration refreshes continue to work as before.
Evidence
memory_searchandmemory_get, proving no manager or file access occurs after revocation.memory_recall,memory_store, andmemory_forget, proving no embedding, database load, write, or delete occurs after revocation.pnpm test extensions/memory-core/src/tools.test.ts extensions/memory-core/src/tools.citations.test.ts extensions/memory-lancedb/index.test.ts— 206 tests passed.pnpm check:changed— passed formatting, lint, production/test typechecks, plugin boundaries, dead-export checks, and import-cycle checks.