Skip to content

Commit 290d18b

Browse files
committed
fix(test): test_bash_tool_safety_guard_review_warning_merged - assert non-empty rule_ids instead of specific R005
sleep 100 & triggers R003 (background process) at MEDIUM, not R005 (sleep 100 < 300 threshold). The contract under test is that warning fields are merged into the dict result, not which specific rule fires.
1 parent 2e38e1b commit 290d18b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

tests/tool_safety/test_opt_in.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,10 +289,13 @@ def test_bash_tool_safety_guard_review_warning_merged(tmp_path: Path):
289289
# block_on_review=False (default): review does not block, warning is merged.
290290
tool = _make_stub_bash_tool(tmp_path, block_on_review=False)
291291
# 'sleep 100 &' ends with '&' (not '&&') and sleep is not a net command →
292-
# MEDIUM → NEEDS_HUMAN_REVIEW under the default policy.
292+
# the background-process rule (R003) fires at MEDIUM → NEEDS_HUMAN_REVIEW
293+
# under the default policy. We do NOT assert a specific rule id here so
294+
# the test stays robust to which rule fires first; the contract being
295+
# tested is that the warning fields are merged into the dict result.
293296
result = asyncio.run(_run_bash_tool(tool, "sleep 100 &"))
294297
assert isinstance(result, dict)
295298
assert result.get("stdout") == "stub-output" # impl ran
296299
assert result.get("safety_warning") == "TOOL_SAFETY_NEEDS_REVIEW"
297300
assert result.get("safety_risk_level") == "medium"
298-
assert "R005_resource_abuse" in result.get("safety_rule_ids", [])
301+
assert len(result.get("safety_rule_ids", [])) > 0

0 commit comments

Comments
 (0)