-
Notifications
You must be signed in to change notification settings - Fork 0
fix(engine): sanitize assistant content snippets in compaction summaries #614
Description
Problem
The compaction summarizer (src/synthorg/engine/compaction/summarizer.py, line ~226-228) extracts msg.content[:100] from every ASSISTANT role message and joins them into a SYSTEM message that is permanently injected into the agent's context. If the LLM response embedded sensitive tool output (credentials, PII, internal file paths) in its content field, those first 100 characters survive compaction and are sent to the LLM indefinitely.
Impact
Expanded by PR #601 -- compaction_callback is now wired into all auto-selected loops (previously only available to statically configured loops), substantially increasing the surface where compaction triggers.
Suggested Fix
In _build_summary, strip or redact known sensitive patterns (secrets-style regexes, file paths) from snippet text before joining, consistent with the sanitization already done in _handle_fatal_error (agent_engine.py lines ~1242-1253).
Requires product-level decision on what constitutes "sensitive content" in the summarizer context.
Context
Discovered during PR #601 review (security-reviewer agent, confidence 85).