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.
This commit is contained in:
Jonathan Boisson 2026-06-11 12:20:49 +02:00
parent 7d03a9d512
commit 0b3bb832cc

View file

@ -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