Skip to content

armgit / strix

Public Imported from GitHub
0

Open-source AI penetration testing tool to find and fix your app’s vulnerabilities.

fix: stop the run after finish_pr_review (#1451)

ian-at-strix03d2c6c16878
diff --git a/strix/agents/factory.py b/strix/agents/factory.py
index 61af684d..6622d3c0 100644
--- a/strix/agents/factory.py
+++ b/strix/agents/factory.py
@@ -517,6 +517,8 @@ def _lifecycle_tool_completed(tool_name: str, output: Any) -> bool:
completion_key = "agent_completed"
elif tool_name == "finish_scan":
completion_key = "scan_completed"
+ elif tool_name == "finish_pr_review": # registered by strix-pro
+ completion_key = "review_completed"
else:
return False
diff --git a/tests/test_agent_tool_registration.py b/tests/test_agent_tool_registration.py
index 2cea8685..489fea70 100644
--- a/tests/test_agent_tool_registration.py
+++ b/tests/test_agent_tool_registration.py
@@ -128,3 +128,16 @@ def test_disabling_strict_leaves_shared_tools_untouched() -> None:
agent = factory.build_strix_agent(is_root=True)
assert any(t.strict_json_schema for t in agent.tools if isinstance(t, FunctionTool))
+
+
+ ("tool_name", "output", "completed"),
+ [
+ ("finish_pr_review", '{"success": true, "review_completed": true}', True),
+ ("finish_pr_review", '{"success": false, "error": "agents_still_active"}', False),
+ ("finish_scan", '{"success": true, "scan_completed": true}', True),
+ ("think", '{"success": true, "review_completed": true}', False),
+ ],
+)
+def test_lifecycle_tool_completed(tool_name: str, output: str, completed: bool) -> None:
+ assert factory._lifecycle_tool_completed(tool_name, output) is completed