Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Handle empty function call metadata arguments
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 9b232bff-6a8c-4b02-addd-89de57a82f6a
  • Loading branch information
cecheta committed Aug 10, 2026
commit cdc75302522a61336ea016a7480213c069d8720c
Original file line number Diff line number Diff line change
Expand Up @@ -702,11 +702,7 @@ def handle(self, content: Content) -> Generator[ResponseStreamEvent]:
yield self._summary_part.emit_text_delta(content.text)

elif content.type == "function_call" and content.call_id is not None:
if (
content.user_input_request
and content.arguments is None
and content.call_id in self._seen_function_call_ids
):
if content.user_input_request and not content.arguments and content.call_id in self._seen_function_call_ids:
Comment thread
moonbox3 marked this conversation as resolved.
Resolved
return
Comment thread
cecheta marked this conversation as resolved.
Resolved
if self._active_type != "function_call" or self._active_id != content.call_id:
yield from self._close()
Expand Down
7 changes: 5 additions & 2 deletions python/packages/foundry_hosting/tests/test_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -1068,8 +1068,11 @@ async def test_function_call_streaming(self) -> None:
assert len(args_done) == 1
assert args_done[0]["data"]["arguments"] == '{"q": "hello"}'

async def test_declaration_only_metadata_does_not_duplicate_streamed_function_call(self) -> None:
metadata = Content.from_function_call("call_1", "search", arguments=None)
@pytest.mark.parametrize("arguments", [None, ""])
async def test_declaration_only_metadata_does_not_duplicate_streamed_function_call(
self, arguments: str | None
) -> None:
metadata = Content.from_function_call("call_1", "search", arguments=arguments)
metadata.id = "call_1"
metadata.user_input_request = True
agent = _make_agent(
Expand Down