Skip to content

Conversation

@rabi
Copy link
Contributor

@rabi rabi commented Dec 31, 2025

Summary

Some LLM providers (e.g., vLLM with QwQ models) send tool_call chunks where the first chunk contains only the function name without arguments, and subsequent chunks contain the arguments. This caused deserialization to fail with 'missing field arguments'.

The deserialization error was silently treated as end-of-stream because 'while let Some(Ok(...))' doesn't match 'Some(Err(...))' - it just exits the loop as if the stream had completed normally.

Changes:

  • Added #[serde(default)] to DeltaToolCallFunction.arguments in openai.rs to handle missing arguments by defaulting to empty string
  • Fixed stream consumption pattern: changed 'while let Some(Ok(...))' to 'while let Some(result)' with explicit error propagation via '?'
  • Added test for stream error propagation

Type of Change

  • Feature
  • Bug fix
  • Refactor / Code quality
  • Performance improvement
  • Documentation
  • Tests
  • Security fix
  • Build / Release
  • Other (specify below)

AI Assistance

  • This PR was created or reviewed with AI assistance

Testing

Unit and manual testing with vLLM.

Some LLM providers (e.g., vLLM with QwQ models) send tool_call chunks
where the first chunk contains only the function name without arguments,
and subsequent chunks contain the arguments. This caused deserialization
to fail with 'missing field arguments'.

The deserialization error was silently treated as end-of-stream because
'while let Some(Ok(...))' doesn't match 'Some(Err(...))' - it just exits
the loop as if the stream had completed normally.

Changes:
- Added #[serde(default)] to DeltaToolCallFunction.arguments in openai.rs
  to handle missing arguments by defaulting to empty string
- Fixed stream consumption pattern: changed 'while let Some(Ok(...))'
  to 'while let Some(result)' with explicit error propagation via '?'
- Added test for stream error propagation

Signed-off-by: rabi <[email protected]>
@rabi rabi changed the title fix: make tool_call arguments optional and fix silent stream termination fix(openai): make tool_call arguments optional and fix silent stream termination Jan 5, 2026
Copy link
Collaborator

@jamadeo jamadeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

@jamadeo jamadeo merged commit a66e5d3 into block:main Jan 14, 2026
17 checks passed
ThanhNguyxn pushed a commit to ThanhNguyxn/goose that referenced this pull request Jan 14, 2026
zanesq added a commit that referenced this pull request Jan 14, 2026
…ased

* 'main' of github.com:block/goose:
  fix(code_execution): serialize record_result output as JSON (#6495)
  perf(google): avoid accumulating thoughtSignatures across conversation history (#6462)
  fix(openai): make tool_call arguments optional and fix silent stream termination (#6309)
  fix: Improve error messages for invalid tool calls (#6483)
  fix: require auth when running goose on non loopback address (#6478)
  chore(deps): bump hono from 4.11.3 to 4.11.4 in /ui/desktop (#6485)
  feat(cli): graceful fallback for keyring failures (#5808)
  fix: support global .gooseignore and negation patterns (#6157)
  docs: manual config for jetbrains (#6490)
  fix: Recipe slash command doesn't work with single optional parameter (#6235)
  fix(openrouter): Handle Gemini thoughtSignature for tool calls (#6370)
  docs: fix extensions page (#6484)
  Allow customizing the new line keybinding in the CLI (#5956)
  Ask for permission in the CLI (#6475)
  docs: add Ralph Loop tutorial for multi-model iterative development (#6455)
  Remove gitignore fallback from gooseignore docs (#6480)
  fix: clean up result recording for code mode (#6343)
  fix(code_execution): handle model quirks with tool calls (#6352)
  feat(ui): support prefersBorder option for MCP Apps (#6465)
  fixed line breaks (#6459)
lifeizhou-ap added a commit that referenced this pull request Jan 15, 2026
* main:
  fixed 0 token in openrouter steaming (#6493)
  feat(goose-acp): enable parallel sessions with isolated agent state (#6392)
  copilot instruction to flag prelease docs (#6504)
  docs: acp mcp support (#6491)
  feat: add flatpak support for linux (#6387)
  fix(code_execution): serialize record_result output as JSON (#6495)
  perf(google): avoid accumulating thoughtSignatures across conversation history (#6462)
  fix(openai): make tool_call arguments optional and fix silent stream termination (#6309)
  fix: Improve error messages for invalid tool calls (#6483)
zanesq added a commit that referenced this pull request Jan 16, 2026
* 'main' of github.com:block/goose: (28 commits)
  chore(deps): bump aiohttp from 3.13.0 to 3.13.3 in /scripts/provider-error-proxy (#6539)
  chore(deps): bump brotli from 1.1.0 to 1.2.0 in /scripts/provider-error-proxy (#6538)
  docs: temp correction for agent directory (#6544)
  chore: upgrade rmcp (#6516)
  docs: clarify directory in /documentation readme (#6541)
  Release 1.20.0
  Standalone mcp apps (#6458)
  don't add escaping to the command field (#6519)
  Fix popular topics not starting chat when clicked (#6508)
  fix[desktop]: deeplink ui repeat on refresh (#6469)
  fixed test compilation on main branch (#6512)
  fix: correctly parse extension name from tool call for MCP apps (#6482)
  fixed 0 token in openrouter steaming (#6493)
  feat(goose-acp): enable parallel sessions with isolated agent state (#6392)
  copilot instruction to flag prelease docs (#6504)
  docs: acp mcp support (#6491)
  feat: add flatpak support for linux (#6387)
  fix(code_execution): serialize record_result output as JSON (#6495)
  perf(google): avoid accumulating thoughtSignatures across conversation history (#6462)
  fix(openai): make tool_call arguments optional and fix silent stream termination (#6309)
  ...
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.

2 participants