Skip to content

fix: prevent empty tool_call delta from overwriting accumulated call_…#341

Open
lao-der wants to merge 1 commit into
SaladDay:mainfrom
lao-der:fix/streaming-toolcall-empty-id-name
Open

fix: prevent empty tool_call delta from overwriting accumulated call_…#341
lao-der wants to merge 1 commit into
SaladDay:mainfrom
lao-der:fix/streaming-toolcall-empty-id-name

Conversation

@lao-der

@lao-der lao-der commented Jul 13, 2026

Copy link
Copy Markdown

Summary

Fix streaming tool call conversion where call_id and name are overwritten by empty delta chunks.

In push_tool_call_delta, both id/call_id and name assignments lacked empty-string protection. When upstream models (e.g. GLM, qwen via DashScope/Aliyun) return empty id and name in tool_call delta chunks after the first one, the accumulated values are overwritten with empty strings. This causes response.output_item.done and response.completed to carry empty call_id and name, leading Codex to reject the tool call with unsupported call:.

This PR adds non-empty checks for both id and name assignments, so that empty deltas are treated as "continue previous value" rather than "clear". Verified locally that streaming tool calls work correctly after the fix.

Related Issue

Fixes #340

Screenshots

N/A (no UI changes)

Before After
call_id and name empty in output_item.done Both fields correctly preserved

Checklist

  • cargo clippy passes
  • cargo test passes

…id/name

When upstream Chat Completions models (e.g. GLM, qwen via DashScope)
  return empty strings for id/name in tool_call delta chunks after the
  first one, the streaming accumulation logic in push_tool_call_delta
  was overwriting previously stored call_id/name with those empty values.

  This caused response.output_item.done and response.completed to carry
  empty call_id and name, leading Codex to reject the tool call with
  "unsupported call:".

  Guard both id and name assignments with non-empty checks so that empty
  deltas are treated as "continue previous value" rather than "clear".
  Add regression test covering subsequent chunks with empty id/name.
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.

Can not use tool calls when using DsahScope deekseep-v4-pro in Codex

1 participant