The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(compression): treat legacy clarify cancel notice as non-response
unsupportedpastels0145fc95b471
diff --git a/agent/context_compressor.py b/agent/context_compressor.pyindex ff1eb22988f..554c5822069 100644--- a/agent/context_compressor.py+++ b/agent/context_compressor.py@@ -1719,6 +1719,17 @@ def _sum_skill_view(name, args, content, content_len, line_count):return f"[skill_view] name={skill} ({content_len:,} chars)" + marker+# Runtime notices that clarify producers persisted as user_response before per-response+# status existed. Only status-less (legacy) entries are checked; explicit status wins.+_CLARIFY_NON_RESPONSE_PREFIXES = (+ "The user did not provide a response", # tools/clarify_tool.TIMEOUT_RESPONSE+ "[user did not respond", # gateway clarify delivery timeout+ "[clarify prompt could not be delivered", # gateway UNDELIVERED*+ "[oneshot mode:", # hermes_cli/oneshot.py+ "The user cancelled", # classic CLI Ctrl+C+)++def _sum_clarify(name, args, content, content_len, line_count):response_prefix = "[clarify] user responded: "# Strictly below _PRUNE_MIN_CHARS so the summary survives later prune passes via the@@ -1741,10 +1752,8 @@ def _sum_clarify(name, args, content, content_len, line_count):# Pre-status sessions also stored timeout/delivery notices as user_response.# Only those legacy records need the old sentinel check; explicit status wins.if "status" not in entry and any(- isinstance(item, str) and item.lstrip().startswith((- "The user did not provide a response", "[user did not respond",- "[clarify prompt could not be delivered", "[oneshot mode:",- )) for item in values+ isinstance(item, str) and item.lstrip().startswith(_CLARIFY_NON_RESPONSE_PREFIXES)+ for item in values):continueanswers.extend(values)diff --git a/tests/agent/test_context_compressor.py b/tests/agent/test_context_compressor.pyindex 26c8ed68b2f..908b200b712 100644--- a/tests/agent/test_context_compressor.py+++ b/tests/agent/test_context_compressor.py@@ -57,7 +57,6 @@ class TestLegacyClarifyResults:def test_answers_reach_summary_after_repeated_pruning(self, monkeypatch, shape, question_size, answer):import agent.context_compressor as module- print("compressor module:", module.__file__)answers = answer if isinstance(answer, list) else [answer]entry = {"question": "Which environment? " + "q" * question_size,"choices_offered": ["staging", "production"], "user_response": answer}@@ -100,6 +99,7 @@ class TestLegacyClarifyResults:"[user did not respond within 60m]","[clarify prompt could not be delivered]","[oneshot mode: no user available]",+ "The user cancelled. Use your best judgement to proceed.",])def test_legacy_sentinels_are_not_answers_but_explicit_status_is_authoritative(self, sentinel):for value in (sentinel, ["production", " " + sentinel]):