mirror of
https://github.com/anthropics/claude-code-sdk-python.git
synced 2025-12-23 09:19:52 +00:00
Merge 03d4837616 into 3eb12c5a37
This commit is contained in:
commit
93ee99fbab
2 changed files with 11 additions and 8 deletions
|
|
@ -255,14 +255,10 @@ class Query:
|
|||
|
||||
# Convert PermissionResult to expected dict format
|
||||
if isinstance(response, PermissionResultAllow):
|
||||
response_data = {
|
||||
"behavior": "allow",
|
||||
"updatedInput": (
|
||||
response.updated_input
|
||||
if response.updated_input is not None
|
||||
else original_input
|
||||
),
|
||||
}
|
||||
response_data = {"behavior": "allow"}
|
||||
# Only include updatedInput if explicitly provided by the user
|
||||
if response.updated_input is not None:
|
||||
response_data["updatedInput"] = response.updated_input
|
||||
if response.updated_permissions is not None:
|
||||
response_data["updatedPermissions"] = [
|
||||
permission.to_dict()
|
||||
|
|
|
|||
|
|
@ -96,6 +96,13 @@ class TestToolPermissionCallbacks:
|
|||
response = transport.written_messages[0]
|
||||
assert '"behavior": "allow"' in response
|
||||
|
||||
# IMPORTANT: Verify updatedInput is NOT included when not provided
|
||||
# This is the regression test for issue #1063
|
||||
assert '"updatedInput"' not in response, (
|
||||
"updatedInput should not be included when PermissionResultAllow() "
|
||||
"is returned without updated_input parameter"
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_permission_callback_deny(self):
|
||||
"""Test callback that denies tool execution."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue