Skip to content

Commit 2402da2

Browse files
committed
simplify
1 parent 248648f commit 2402da2

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

tests/cross/test_agent_reconciliation.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,6 @@ def test_conversation_persistence_lifecycle(mock_completion):
271271
# Verify state was restored
272272
assert new_conversation.id == original_id
273273
# When loading from persistence, the state should be exactly the same
274-
# (no additional SecurityAnalyzerConfigurationEvent should be added)
275274
assert len(new_conversation.state.events) == original_event_count
276275
# Test model_dump equality (excluding events which may have different timestamps) # noqa: E501
277276
new_dump = new_conversation._state.model_dump(mode="json", exclude={"events"})

tests/sdk/tool/test_to_responses_tool_security.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def create(cls, conv_state=None, **params) -> Sequence["MockSecurityTool3"]:
4141

4242

4343
def test_to_responses_tool_security_gating():
44-
# security_risk field is now always included regardless of readOnlyHint
44+
# readOnlyHint=True -> do not add security_risk even if requested
4545
readonly = MockSecurityTool1(
4646
description="d",
4747
action_type=TRTSAction,
@@ -53,9 +53,9 @@ def test_to_responses_tool_security_gating():
5353
assert isinstance(params, dict)
5454
props = params.get("properties") or {}
5555
assert isinstance(props, dict)
56-
assert "security_risk" in props # Always included now
56+
assert "security_risk" not in props
5757

58-
# readOnlyHint=False -> also includes security_risk
58+
# readOnlyHint=False -> add when requested
5959
writable = MockSecurityTool2(
6060
description="d",
6161
action_type=TRTSAction,

tests/sdk/tool/test_tool_definition.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,8 @@ class ComplexNestedAction(Action):
542542
assert optional_array_schema["type"] == "array"
543543
assert optional_array_schema["items"]["type"] == "string"
544544

545-
def test_security_risk_added_for_all_tools_when_enabled(self):
546-
"""Test that security_risk is added for all tools when prediction is enabled."""
545+
def test_security_risk_only_added_for_non_readonly_tools(self):
546+
"""Test that security_risk is only added if the tool is not read-only."""
547547
# Test with read-only tool
548548
readonly_annotations = ToolAnnotations(
549549
title="Read-only Tool",
@@ -578,16 +578,14 @@ def test_security_risk_added_for_all_tools_when_enabled(self):
578578
annotations=None,
579579
)
580580

581-
# Test read-only tool - security_risk should be added when enabled
581+
# Test read-only tool - security_risk should NOT be added
582582
readonly_openai_tool = readonly_tool.to_openai_tool(
583583
add_security_risk_prediction=True
584584
)
585585
readonly_function = readonly_openai_tool["function"]
586586
assert "parameters" in readonly_function
587587
readonly_params = readonly_function["parameters"]
588-
assert (
589-
"security_risk" in readonly_params["properties"]
590-
) # Included for read-only tools too
588+
assert "security_risk" not in readonly_params["properties"]
591589

592590
# Test writable tool - security_risk SHOULD be added
593591
writable_openai_tool = writable_tool.to_openai_tool(

0 commit comments

Comments
 (0)