Repository navigation
fix(memory-lancedb): prevent cross-agent memory leakage - #103799
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Codex review: needs real behavior proof before merge. Reviewed July 10, 2026, 7:27 PM ET / 23:27 UTC. Summary PR surface: Source +22, Tests +140, Docs +6. Total +168 across 3 files. Reproducibility: yes. at source level with high confidence: current main passes the resolved agent ID to both automatic hooks but does not consult the effective Review metrics: none identified. Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Land the focused automatic-hook gate after a feature owner approves the limited boundary and redacted live two-agent Gateway/LanceDB output proves that the disabled agent neither receives nor contributes memories while the enabled agent still works. Do we have a high-confidence way to reproduce the issue? Yes, at source level with high confidence: current main passes the resolved agent ID to both automatic hooks but does not consult the effective Is this the best way to solve the issue? Yes for the reported automatic-hook bypass: the patch reuses the canonical resolver, matches core precedence, and gates before memory I/O. It is not a complete cross-agent isolation solution, so the limited boundary needs explicit maintainer acceptance. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2f9cb9200669. Label changesLabel justifications:
Evidence reviewedPR surface: Source +22, Tests +140, Docs +6. Total +168 across 3 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
Review history (2 earlier review cycles)
|
|
Addressed the P1 finding in 5bd52a4ca4d: agent ids are now normalized on both sides of the per-agent lookup via the SDK Live two-agent Gateway+LanceDB proof and the isolation-scope confirmation remain with maintainers — I don't have a live LanceDB/Ollama stack in this environment. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…emorySearch.enabled (openclaw#103590) The before_prompt_build auto-recall hook only checked the plugin-level autoRecall flag, so agents configured with memorySearch.enabled: false still received <relevant-memories> injected from the shared LanceDB store - leaking one agent's private memories into another agent's prompts. Gate both recall injection and agent_end auto-capture on the current agent's memorySearch.enabled (per-agent entry wins over agents.defaults; unset means enabled), mirroring core resolveMemorySearchConfig semantics.
Review follow-up on openclaw#103799: a configured id like 'XiaoHuo' or one with surrounding whitespace missed the exact-match per-agent override and inherited the enabled default, leaving the disclosure path active. Normalize both the hook agent id and configured entry ids with the SDK normalizeAgentId before comparing.
5bd52a4 to
419f165
Compare
|
Addressed the P1 (
Live two-agent Gateway + LanceDB proof remains outstanding (flagged separately to the PR author). @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Co-authored-by: Shubhankar Tripathy <[email protected]>
Co-authored-by: Shubhankar Tripathy <[email protected]>
Security-sensitive guard clearedThis PR no longer has blocked security-sensitive file changes. A future security-sensitive change requires a fresh
|
|
Merged via squash.
|
Fixes #103590.
What Problem This Solves
Fixes an issue where agents sharing the LanceDB memory plugin could read, list, delete, or automatically recall another agent's memories. Disabling
memorySearchonly stopped automatic hooks, while the shared tools and backing table still crossed agent boundaries.Why This Change Was Made
Every LanceDB row now has a normalized owning agent ID, and all store, search, list, query, count, and delete paths require and enforce that owner. Plugin tools are registered per agent, ACP-managed MCP delegates propagate the canonical session agent, and automatic recall/capture use the same live per-agent gate.
Existing shared tables fail closed until
openclaw doctor --fixperforms the one-time migration. Because legacy rows have no trustworthy owner, the migration assigns them to the configured default agent and verifies the resulting schema and row count.User Impact
Agents can use the same LanceDB plugin without memories leaking across tool calls, prompt injection, automatic capture, CLI operations, ACP sessions, or gateway restarts. Agents with
memorySearch.enabled: falsereceive no memory tools and perform no automatic memory I/O.Evidence
pnpm check:changedpassed on the exact PR head, including all TypeScript, lint, formatting, SDK-surface, dependency, database-first, cycle, and ratchet gates: https://github.com/openclaw/openclaw/actions/runs/29484893629/tools/invoke, automatic capture, automatic recall, CLI listing, and a gateway restart. Result:LIVE_PROOF_OK agents=2 tools=isolated capture=isolated recall=isolated restart=persistent.