fix(agent): strip MEDIA directives from compressor summarizer input (#14665)

This commit is contained in:
Tranquil-Flow
2026-06-12 01:14:28 -07:00
committed by Teknium
parent 8b2a3c9c51
commit 286ecd26d8
2 changed files with 62 additions and 0 deletions
+6
View File
@@ -1006,10 +1006,16 @@ class ContextCompressor(ContextEngine):
(API keys, tokens, passwords) from leaking into the summary that
gets sent to the auxiliary model and persisted across compactions.
"""
# Strip MEDIA directives before sending to the summarizer — if they
# leak into the summary, the downstream model may re-emit them as
# active directives on the next turn (#14665).
_MEDIA_RE = re.compile(r'MEDIA:\S+')
parts = []
for msg in turns:
role = msg.get("role", "unknown")
content = redact_sensitive_text(msg.get("content") or "")
content = _MEDIA_RE.sub("[media attachment]", content)
# Tool results: keep enough content for the summarizer
if role == "tool":