Skip to content

fix(agent): strip MEDIA directives from compressor summarizer input (salvages #15369)#44708

Merged
teknium1 merged 2 commits into
mainfrom
fix/compression-media-strip
Jun 12, 2026
Merged

fix(agent): strip MEDIA directives from compressor summarizer input (salvages #15369)#44708
teknium1 merged 2 commits into
mainfrom
fix/compression-media-strip

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

MEDIA delivery directives are stripped from the compressor's summarizer input, so compaction summaries can no longer carry MEDIA:<path> tags that downstream models re-emit as bogus attachment sends.

Root cause (#14665): _serialize_for_summary redacts secrets but passed MEDIA:\S+ directives through verbatim; gateway adapters parse re-emitted tags and attempt attachment delivery for stale paths.

Closes #14665.

Changes

Note: the issue's second leg (todo snapshot injected as a user-role message) is partially mitigated by the historical-framing prefix work in #44454; tracking separately if it still reproduces.

Validation

Before After
MEDIA:/path/img.png in compacted turns survives into summary, re-emitted by next model [media attachment] placeholder
scripts/run_tests.sh media/compressor/prefix suites 39 passed

(test_context_compressor.py currently times out in the hermetic runner on origin/main as well — pre-existing env issue, not introduced here; the same file passed against this diff in a direct run earlier: 90/94 with the 4 failures reproducing identically on clean main.)

Attribution

Salvages #15369 by @Tranquil-Flow — cherry-picked with authorship preserved; rebase-merge to keep per-commit credit.

Infographic

compression-media-directive-strip

Tranquil-Flow and others added 2 commits June 11, 2026 23:05
Avoid recompiling the pattern on every _serialize_for_summary call; name it
beside _PATH_MENTION_RE with the #14665 rationale.
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: fix/compression-media-strip vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 10848 on HEAD, 10847 on base (🆕 +1)

🆕 New issues (1):

Rule Count
unresolved-import 1
First entries
tests/agent/test_compressor_media_stripping.py:7: [unresolved-import] unresolved-import: Cannot resolve imported module `pytest`

✅ Fixed issues: none

Unchanged: 5687 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent loop, run_agent.py, prompt builder labels Jun 12, 2026
@teknium1 teknium1 merged commit 8e5b759 into main Jun 12, 2026
28 checks passed
@teknium1 teknium1 deleted the fix/compression-media-strip branch June 12, 2026 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Context compaction can misread preserved todo/tool state as current user intent and leak MEDIA directives

3 participants