This commit is contained in:
Yashwant Bezawada 2025-12-20 11:44:48 +01:00 committed by GitHub
commit 93ee99fbab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 8 deletions

View file

@ -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()

View file

@ -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."""