From 3d8a31432d6b571a117d87f3e04f4675ca14dff5 Mon Sep 17 00:00:00 2001 From: Jonathan Boisson Date: Thu, 11 Jun 2026 15:12:30 +0200 Subject: [PATCH] =?UTF-8?q?fix(P2):=20align=20v2=20pre-pass=20placeholder?= =?UTF-8?q?=20with=20P2=20regex=20=E2=80=94=20include=20skill=5Fview(name?= =?UTF-8?q?=3D'X')?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The P2 extraction regex expects skill_view(name='X') but the v2 pre-pass placeholder used 'reload with skill_view before relying on it'. This mismatch meant _pruned_skill_names was always empty, so the P2 defense (pre-LLM extraction + post-LLM re-injection) never fired. Align both Phase 1 and pre-pass v2 placeholders to use the callable skill_view(name='X') format so the regex matches and the agent can reload the pruned skill directly. Addresses review comment from @liuhao1024 on PR #44166. --- agent/context_compressor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agent/context_compressor.py b/agent/context_compressor.py index ee4d7af29858..40e56bc3b3e9 100644 --- a/agent/context_compressor.py +++ b/agent/context_compressor.py @@ -554,7 +554,7 @@ def _summarize_tool_result(tool_name: str, tool_args: str, tool_content: str) -> 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"}: @@ -989,7 +989,7 @@ class ContextCompressor(ContextEngine): f"[skill_view] name={skill_name} " f"({len(original_content):,} chars) " f"[SKILL_PRUNED: content lost in compression; " - f"reload with skill_view before relying on it]" + f"reload with skill_view(name='{skill_name}')]" ) result[idx] = {**result[idx], "content": placeholder} pruned += 1