Skip to content

The agent that grows with you

refactor(agent): derive the pruned-args recovery hint from the marker prefix

kshitijk4poor94119759c69b
diff --git a/agent/tool_executor.py b/agent/tool_executor.py
index 4d502157be5..72abc90f7cc 100644
--- a/agent/tool_executor.py
+++ b/agent/tool_executor.py
@@ -30,6 +30,7 @@ from agent.display import (
redact_tool_args_for_display as _redact_tool_args_for_display,
_detect_tool_failure,
)
+from agent.compression_marker import _COMPRESSION_MARKER_PREFIX
from agent.message_sanitization import coalesce_tool_call_id
from agent.inline_tool_executors import (
INLINE_TOOL_EXECUTORS,
@@ -641,7 +642,7 @@ _PRUNED_TOOL_ARGUMENTS_MESSAGE = (
"Tool was not executed because effect-capable arguments contain a Hermes context-compression artifact. "
"Recover the exact content from its durable source or re-read it, then issue a complete new call; "
"do not retry these arguments. To remove a marker that already landed in a file, match it by its "
- "HERMES-CONTEXT-COMPRESSION prefix (e.g. a terminal sed on that line) instead of quoting the full marker."
+ f"{_COMPRESSION_MARKER_PREFIX.strip('⟪:')} prefix (e.g. a terminal sed on that line) instead of quoting the full marker."
)
diff --git a/tests/agent/test_tool_call_guardrail_runtime.py b/tests/agent/test_tool_call_guardrail_runtime.py
index f0186d4f3a4..2565ccf4e97 100644
--- a/tests/agent/test_tool_call_guardrail_runtime.py
+++ b/tests/agent/test_tool_call_guardrail_runtime.py
@@ -400,9 +400,11 @@ def test_context_pruned_effectful_call_blocks_before_dispatch():
assert payload["argument_paths"] == ["$.body"]
assert "Recover the exact content from its durable source" in payload["message"]
# Only the compressor's current marker is an artifact; a legacy "...[truncated]" tail is ordinary content.
+ from agent.compression_marker import _COMPRESSION_MARKER_PREFIX
from agent.tool_dispatch_helpers import _context_pruned_argument_paths
assert _context_pruned_argument_paths("write_file", {"content": "x" * 201 + "...[truncated]"}) == []
+ assert _context_pruned_argument_paths("write_file", {"content": f"see {_COMPRESSION_MARKER_PREFIX} docs"}) == []
def test_read_only_tool_may_quote_current_context_prune_marker():