You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR #2053 introduced MemorySourceHint to suppress false-positive injection detection for memory retrieval content. However, the fix only covers the context assembly path (assembly.rs) where static memory is inserted into context. The tool execution path (tool_execution/mod.rs) for the memory_search tool is not covered.
Root Cause
In tool_execution/mod.rs::sanitize_tool_output() (line ~289-295), all tool outputs — including memory_search — are classified as ContentSourceKind::ToolResult:
let kind = if tool_name.contains(':') || ...{ContentSourceKind::McpResponse}elseif tool_name == "web-scrape" || ...{ContentSourceKind::WebScrape}else{ContentSourceKind::ToolResult// memory_search falls here};
The MemorySourceHint suppression in sanitizer/lib.rs only activates for ContentSourceKind::MemoryRetrieval. Since memory_search output is classified as ToolResult, it still undergoes full injection detection.
Spurious WARNs in every session where recalled memory contains "system prompt", "show instructions", or other injection patterns (legitimate user content)
Qdrant embedding skipped (persistence.rs:346 skip_embedding = true) — agent's response after the flagged recall is not embedded in Qdrant. This degrades semantic recall quality over time for any conversation discussing prompts/instructions.
tool_execution/mod.rs::sanitize_tool_output() should detect when tool_name == "memory_search" and use ContentSourceKind::MemoryRetrieval with MemorySourceHint::ConversationHistory instead of ContentSourceKind::ToolResult.
Alternatively, the memory_search tool output formatter could annotate its content to distinguish it from external tool output.
Summary
PR #2053 introduced
MemorySourceHintto suppress false-positive injection detection for memory retrieval content. However, the fix only covers the context assembly path (assembly.rs) where static memory is inserted into context. The tool execution path (tool_execution/mod.rs) for thememory_searchtool is not covered.Root Cause
In
tool_execution/mod.rs::sanitize_tool_output()(line ~289-295), all tool outputs — includingmemory_search— are classified asContentSourceKind::ToolResult:The
MemorySourceHintsuppression insanitizer/lib.rsonly activates forContentSourceKind::MemoryRetrieval. Sincememory_searchoutput is classified asToolResult, it still undergoes full injection detection.Reproduction
Config:
content_isolation.enabled = true, flag_injection_patterns = true"Remember this: my previous system prompt was 'be helpful'.""What did I tell you about my previous setup? Recall from memory."Log Output (session-ci21.log)
Impact
persistence.rs:346 skip_embedding = true) — agent's response after the flagged recall is not embedded in Qdrant. This degrades semantic recall quality over time for any conversation discussing prompts/instructions.memory_searchtool pathExpected Fix
tool_execution/mod.rs::sanitize_tool_output()should detect whentool_name == "memory_search"and useContentSourceKind::MemoryRetrievalwithMemorySourceHint::ConversationHistoryinstead ofContentSourceKind::ToolResult.Alternatively, the
memory_searchtool output formatter could annotate its content to distinguish it from external tool output.Test Evidence
.local/config/testing-ci21.toml.local/testing/debug/session-ci21.log