Skip to content

The agent that grows with you

fix(agent): guard repeated skill reads

benbenwybcd2d3089fb4a
diff --git a/agent/tool_guardrails.py b/agent/tool_guardrails.py
index 777cb9775da..243a0c64aad 100644
--- a/agent/tool_guardrails.py
+++ b/agent/tool_guardrails.py
@@ -24,6 +24,8 @@ IDEMPOTENT_TOOL_NAMES = frozenset(
"web_search",
"web_extract",
"session_search",
+ "skill_view",
+ "skills_list",
"browser_snapshot",
"browser_console",
"browser_get_images",
diff --git a/tests/agent/test_tool_guardrails.py b/tests/agent/test_tool_guardrails.py
index 05c25602618..33331010627 100644
--- a/tests/agent/test_tool_guardrails.py
+++ b/tests/agent/test_tool_guardrails.py
@@ -154,6 +154,41 @@ def test_hard_stop_enabled_blocks_repeated_exact_failure_before_next_execution()
+def test_skill_read_tools_are_idempotent_and_block_repeated_identical_success_output():
+ cases = [
+ (
+ "skill_view",
+ {"name": "gui-agent-ml-operations"},
+ '{"success":true,"name":"gui-agent-ml-operations","content":"same"}',
+ ),
+ (
+ "skills_list",
+ {"category": "mlops"},
+ '{"success":true,"skills":[{"name":"gui-agent-ml-operations"}]}',
+ ),
+ ]
+
+ for tool_name, args, result in cases:
+ controller = ToolCallGuardrailController(
+ ToolCallGuardrailConfig(
+ hard_stop_enabled=True,
+ no_progress_warn_after=2,
+ no_progress_block_after=2,
+ )
+ )
+
+ assert controller.before_call(tool_name, args).action == "allow"
+ assert controller.after_call(tool_name, args, result, failed=False).action == "allow"
+ assert controller.before_call(tool_name, args).action == "allow"
+ warn = controller.after_call(tool_name, args, result, failed=False)
+ assert warn.action == "warn"
+ assert warn.code == "idempotent_no_progress_warning"
+
+ blocked = controller.before_call(tool_name, args)
+ assert blocked.action == "block"
+ assert blocked.code == "idempotent_no_progress_block"
+
+
def test_mutating_or_unknown_tools_are_not_blocked_for_repeated_identical_success_output_by_default():
controller = ToolCallGuardrailController(
ToolCallGuardrailConfig(no_progress_warn_after=2, no_progress_block_after=2)