From 0b3bb832cc78e2c87286c5ffb321967f330a3010 Mon Sep 17 00:00:00 2001 From: Jonathan Boisson Date: Thu, 11 Jun 2026 12:20:49 +0200 Subject: [PATCH] fix(P2): add dedup note for repeated [SKILL_PRUNED] markers across compactions After successive compressions, the same skill may appear as [SKILL_PRUNED] multiple times in head/tail/summary. Without guidance, the LLM could redundantly reload the same skill multiple times. Add an explicit note in the summary: one reload is sufficient. Fixes #32106. --- agent/context_compressor.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/agent/context_compressor.py b/agent/context_compressor.py index efbf9a95ab40..93158cee8f81 100644 --- a/agent/context_compressor.py +++ b/agent/context_compressor.py @@ -1719,7 +1719,18 @@ This compaction should PRIORITISE preserving all information related to the focu f"[SKILL_PRUNED: content lost in compression; " f"reload with skill_view(name='{sn}')" ) + # Dedup note: across multiple compactions, the same skill + # may appear as [SKILL_PRUNED] in head/tail/summary. + # One reload is enough — the skill stays in context. summary += "\n## Pruned Skills\n" + "\n".join(_ps) + summary += ( + "\n\n**Note:** The same skill may appear as [SKILL_PRUNED] " + "multiple times across this summary and the protected " + "messages above/below (successive compactions). " + "Reloading a skill **once** is sufficient — it remains " + "in context for the rest of the session. Do not reload " + "the same skill multiple times." + ) # Store for iterative updates on next compaction self._previous_summary = summary self._summary_failure_cooldown_until = 0.0