# agent: Fix Preserve tool call ID/name across DashScope empty delta chunks \(\#54872\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/febc3ebcb4df347e1e273b5ccb428940672e9fb2)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: febc3ebcb4df347e1e273b5ccb428940672e9fb2

Requested commit: febc3ebcb4df347e1e273b5ccb428940672e9fb2

Commit: febc3ebcb4df347e1e273b5ccb428940672e9fb2

Tree: ccb693ee8970d019fd0373107fab977aeeb8c5af

Author: kangxl

Committer: GitHub

## Message

```
agent: Fix Preserve tool call ID/name across DashScope empty delta chunks (#54872)

Release Notes:

- Fixed: DashScope (Aliyun) tool calls now preserve id and name across
streaming delta chunks
   

---------------------------------------------------------------------------------------------------
    Aliyun (DashScope) SSE streaming sends id="" and name="" in
    subsequent tool_calls delta chunks after the first chunk. Previously
    these empty strings would unconditionally overwrite the accumulated
    id and name values, causing tool calls to lose identity and fail.
    
    Add is_empty() guards so id and name are only updated when the
    delta provides a non-empty value (falsy guard pattern), matching how
    Hermes Agent and OpenAI SDK handle this provider edge case.
    
    Test stream_maps_preserves_tool_id_and_name_across_empty_deltas
    simulates DashScope's actual streaming behavior and asserts that
    the completed ToolUse retains the correct id, name, and arguments.
    
    Files changed: 1 (+148/-2)
    - crates/open_ai/src/completion.rs
    
    CLA signed.
    
- [x] I've reviewed my own diff for quality, security, and reliability
    - [x] Tests cover the new/changed behavior
    - [x] Performance impact has been considered and is acceptable
    
 
<img width="980" height="1392" alt="CleanShot 2026-04-26 at 00 03 20@2x"
src="https://github.com/user-attachments/assets/428a845b-82a0-44eb-9e43-1a351de6ca6a"
/>

After FIx
<img width="900" height="1398" alt="CleanShot 2026-04-26 at 00 02 15@2x"
src="https://github.com/user-attachments/assets/604e36fd-bf90-4549-9e60-8a927033d3e9"
/>

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
```

## Parents

- [cb715fb374b9693e47535314e2987a56f3b405a4](https://git.cafe/gitcafe/zed/commit/cb715fb374b9693e47535314e2987a56f3b405a4?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/febc3ebcb4df347e1e273b5ccb428940672e9fb2?format=markdown)
