From 6816f2f02c12e787d6d5f0c7ebcb1dda962157a7 Mon Sep 17 00:00:00 2001 From: Jonathan Boisson Date: Thu, 23 Jul 2026 12:24:59 -0700 Subject: [PATCH] fix(P1+P2): marker names skill_view(name='X') + DEDUP rule for repeated [SKILL_PRUNED] markers Surgical reapply of the marker-alignment and dedup-guidance halves of PR #44166 commits 52341f6ca3 / 3d8a31432d / ae07412e4b onto current main: - the [SKILL_PRUNED: ...] marker embeds the exact reload call skill_view(name='') so the model can act without guessing - SKILLS_GUIDANCE Skill Safety Rule gains rule 4 (DEDUP): after one reload, remaining markers for the same skill are historical artifacts Fixes #32106 (part). --- agent/context_compressor.py | 2 +- agent/prompt_builder.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/agent/context_compressor.py b/agent/context_compressor.py index 1406aa2197b9..9c362e0d3402 100644 --- a/agent/context_compressor.py +++ b/agent/context_compressor.py @@ -894,7 +894,7 @@ def _summarize_tool_result_unguarded(tool_name: str, tool_args: str, tool_conten if tool_name == "skill_view": name = args.get("name", "?") if content_len > 5000: - return f"[skill_view] name={name} ({content_len:,} chars) [SKILL_PRUNED: content lost in compression; reload with skill_view before relying on it]" + return f"[skill_view] name={name} ({content_len:,} chars) [SKILL_PRUNED: content lost in compression; reload with skill_view(name='{name}')]" return f"[skill_view] name={name} ({content_len:,} chars)" if tool_name in {"skills_list", "skill_manage"}: diff --git a/agent/prompt_builder.py b/agent/prompt_builder.py index a7340f17279a..845e4260ddbd 100644 --- a/agent/prompt_builder.py +++ b/agent/prompt_builder.py @@ -197,7 +197,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." ) KANBAN_GUIDANCE = (