Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions src/claude_agent_sdk/_internal/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,10 @@ async def _handle_control_request(self, request: SDKControlRequest) -> None:

# 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()
Expand Down
7 changes: 7 additions & 0 deletions tests/test_tool_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ async def allow_callback(
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."""
Expand Down