From 52341f6ca3b5d3b5cf3c3931d1a019ac246f7b8d Mon Sep 17 00:00:00 2001 From: Jonathan Boisson Date: Thu, 11 Jun 2026 11:58:08 +0200 Subject: [PATCH] fix(P2-3): check [SKILL_PRUNED] marker directly in summary, not skill_view(name) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The P1 Skill Safety Rule only triggers on [SKILL_PRUNED]. Checking skill_view(name='...') in the LLM summary is insufficient — the LLM can mention a skill name without the canonical marker, causing the re-injection to be skipped while P1 remains inactive. Use the simpler and more correct check: '[SKILL_PRUNED]' not in summary. Fixes #32106. --- agent/context_compressor.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/agent/context_compressor.py b/agent/context_compressor.py index 44840d8633c1..0fa9107003e5 100644 --- a/agent/context_compressor.py +++ b/agent/context_compressor.py @@ -1691,10 +1691,10 @@ This compaction should PRIORITISE preserving all information related to the focu # Defensive: append canonical markers so the system Skill Safety Rule # can detect them. Fixes #32106 (Ghost Skill — summary loss). if _pruned_skill_names: - _has_markers = all( - f"skill_view(name='{sn}')" in summary for sn in _pruned_skill_names - ) - if not _has_markers: + # The P1 Skill Safety Rule only triggers on [SKILL_PRUNED]. + # Merely mentioning a skill name is not enough — the marker + # must survive. Re-inject if the canonical marker is absent. + if "[SKILL_PRUNED]" not in summary: _ps = [] for sn in _pruned_skill_names: _ps.append(