Skip to content

fix(streaming): keep tool call name when later deltas send an empty name - #465

Open
Guezli wants to merge 1 commit into
nextcloud:mainfrom
Guezli:fix/streaming-empty-tool-name
Open

Guezli wants to merge 1 commit into
nextcloud:mainfrom
Guezli:fix/streaming-empty-tool-name

Conversation

@Guezli

@Guezli Guezli commented Nov 11, 2026

Copy link
Copy Markdown

Fixes #461

Some OpenAI-compatible providers (seen with Mistral, https://api.eu.mistral.ai/v1) send the function name only in the first streamed tool call delta and repeat it as "name": "" in every later delta. StreamingService::mergeToolCalls() assigned the name from every delta, so the empty string overwrote the real one and the Context Agent received tool calls without a name.

This change ignores an empty name in a delta. A non-empty name still overwrites as before, so behaviour with OpenAI (which omits name in later deltas) is unchanged.

Tests: added testEmptyToolNameInLaterDeltaDoesNotOverwriteTheName to tests/unit/Service/StreamingServiceTest.php. It fails without the fix ('name' => '') and passes with it. Also verified on a Nextcloud 35.0.2 instance with Context Agent 2.11.0: the agent then recognises schedule_event with the correct arguments.

🤖 Generated with Claude Code

Mistral and possibly other OpenAI-compatible providers repeat
"name": "" in every tool call delta after the first one. The empty
string overwrote the name received earlier, so the assembled tool call
had no function name.

Fixes nextcloud#461

Signed-off-by: PocketLab <115039460+Guezli@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Streaming tool calls lose the function name with Mistral (empty "name" in later deltas overwrites it)

1 participant