Skip to content

fix(memory): stop retained tools after memory is disabled - #125393

Merged
joshavant merged 1 commit into
mainfrom
security/enforce-memory-revocation
Aug 17, 2026
Merged

joshavant merged 1 commit into
mainfrom
security/enforce-memory-revocation

Conversation

@joshavant

Copy link
Copy Markdown
Collaborator

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

  • Added enabled-to-disabled regression coverage for memory_search and memory_get, proving no manager or file access occurs after revocation.
  • Extended LanceDB lifecycle coverage for retained memory_recall, memory_store, and memory_forget, proving no embedding, database load, write, or delete occurs after revocation.
  • Pre-fix proof: both focused regressions failed; the tools returned a real memory hit and completed recall/store/delete after disable.
  • 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.
  • Autoreview completed with no accepted or actionable findings.

@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added extensions: memory-core Extension: memory-core extensions: memory-lancedb Extension: memory-lancedb size: S maintainer Maintainer-authored PR labels Aug 17, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 17, 2026
@clawsweeper

clawsweeper Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 5:10 PM ET / 21:10 UTC.

ClawSweeper review

What this changes

The 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 readiness

⚠️ Ready for maintainer review - 2 items remain

This 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
Reviewed head: 04a2fdac55d4ecf3da7ed3d21d670f8852853dc2
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) This is a focused, well-covered owner-boundary repair with no blocking code finding; exact-head CI and protected-label review remain merge gates.
Proof confidence 🌊 off-meta tidepool Not applicable: The repository context identifies the author as a MEMBER, so the external-contributor real-behavior-proof gate does not apply; the PR body nevertheless supplies focused regression-test evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The repository context identifies the author as a MEMBER, so the external-contributor real-behavior-proof gate does not apply; the PR body nevertheless supplies focused regression-test evidence.
Evidence reviewed 7 items Current-main comparison: The main-base version keeps the captured context when refreshed lookup returns no memory configuration; this PR instead treats a live getter's missing or disabled result as revocation before the backend executes.
Live runtime boundary: The agent tool resolver supplies plugin factories a getter that re-resolves the active runtime configuration, and the plugin SDK documents it as the latest snapshot for long-lived tools.
LanceDB owner coverage: Each retained LanceDB tool checks the live getter before embedding, database reads, writes, or deletes.
Findings None None.
Security None None.

How this fits together

Agent 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]
Loading

Decision needed

Question Recommendation
Should this maintainer-labeled memory revocation fix be merged after it is refreshed against main and exact-head CI completes green? Refresh and merge: Rebase or refresh the current head, confirm its required checks are green, then merge the focused revocation fix.

Why: The source review is clean, but the protected maintainer label and incomplete current-head checks require an explicit human merge decision.

Before merge

  • Resolve merge risk (P1) - GitHub reports the branch behind main and its exact-head CI is incomplete, so merge should wait for a refreshed, green exact-head check set.
Agent review details

Security

None.

PR surface

Source +25, Tests +52. Total +77 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 27 2 +25
Tests 2 61 9 +52
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 88 11 +77

Review metrics

Metric Value Why it matters
Production versus test LOC production +27/-2 (net +25); tests +61/-9 (net +52) The production growth implements the same live-revocation boundary in two independent memory owners; the added tests exercise both before any backend I/O.

Stored data model

Persistent data-model change detected: unknown-data-model-change: extensions/memory-lancedb/index.test.ts, unknown-data-model-change: extensions/memory-lancedb/index.ts, vector/embedding metadata: extensions/memory-core/src/tools.citations.test.ts, vector/embedding metadata: extensions/memory-lancedb/index.test.ts, vector/embedding metadata: extensions/memory-lancedb/index.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    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.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best 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.

Labels

Label justifications:

  • P1: Without this fix, an active agent can continue to access memory after an operator disables it through a hot configuration update.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository context identifies the author as a MEMBER, so the external-contributor real-behavior-proof gate does not apply; the PR body nevertheless supplies focused regression-test evidence.

Evidence

What I checked:

Likely related people:

  • steipete: History shows the earlier execution-time refresh fix and substantial recent work across both affected memory surfaces. (role: historical and recent memory-area contributor; confidence: high; commits: 8a8cc8dc9fca, 95e17d6c993f; files: extensions/memory-core/src/tools.shared.ts, extensions/memory-lancedb/index.ts)
  • vincentkoc: Recent current-main history shows sustained work on memory-core and plugin runtime behavior adjacent to the live-configuration boundary. (role: recent adjacent memory/plugin contributor; confidence: medium; commits: e41c574793c4, eae846e3e550; files: extensions/memory-core/index.ts, extensions/memory-core/src/tools.shared.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Refresh the branch against current main and wait for the exact-head required checks to complete green.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-17T20:33:26.912Z sha 04a2fda :: needs maintainer review before merge. :: none

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: memory-core Extension: memory-core extensions: memory-lancedb Extension: memory-lancedb maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant