From ae07412e4bc6722cc9ad0e18f660e6bb21d4466c Mon Sep 17 00:00:00 2001 From: Jonathan Boisson Date: Thu, 11 Jun 2026 12:26:43 +0200 Subject: [PATCH] fix(P1+P2): add DEDUP rule to prevent redundant skill reloads after compaction After multiple compactions, the same skill may appear as [SKILL_PRUNED] multiple times. Without guidance, the LLM could redundantly reload the same skill on every turn, seeing the old markers as 'unresolved'. Add: - P1-DEDUP: System rule to ignore remaining markers after one reload - P2-Dedup note: Summary reminder that markers are historical artifacts Fixes #32106. --- agent/context_compressor.py | 6 ++++-- agent/prompt_builder.py | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/agent/context_compressor.py b/agent/context_compressor.py index 93158cee8f81..ee4d7af29858 100644 --- a/agent/context_compressor.py +++ b/agent/context_compressor.py @@ -1728,8 +1728,10 @@ This compaction should PRIORITISE preserving all information related to the focu "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." + "in context for the rest of the session. " + "After reloading, **ignore any remaining [SKILL_PRUNED] markers " + "for that skill** — they are historical artifacts from previous " + "compactions and do not need further action." ) # Store for iterative updates on next compaction self._previous_summary = summary diff --git a/agent/prompt_builder.py b/agent/prompt_builder.py index 2ced932efd34..69482c8c02bc 100644 --- a/agent/prompt_builder.py +++ b/agent/prompt_builder.py @@ -180,7 +180,8 @@ SKILLS_GUIDANCE = ( "## Skill Safety Rule\n" "1. **UNAVAILABLE** — If a skill placeholder contains `[SKILL_PRUNED]`, the skill content was lost in compression and is inaccessible.\n" "2. **RELOAD** — Before performing any action that depends on a skill, re-check its content with `skill_view(name='...')` if it shows `[SKILL_PRUNED]`.\n" - "3. **WAIT** — If a skill is loading or was just pruned, wait for the reload confirmation before proceeding." + "3. **WAIT** — If a skill is loading or was just pruned, wait for the reload confirmation before proceeding.\n" + "4. **DEDUP** — After reloading a pruned skill, **ignore any remaining `[SKILL_PRUNED]` markers for that same skill** — they are historical artifacts from previous compactions and do not need further action.\n" ) KANBAN_GUIDANCE = (