Skip to content

fix(agent): drop tool_calls key when all tool_calls are deduplicated (#70126) - #70181

Closed
ms-alan wants to merge 1 commit into
NousResearch:mainfrom
ms-alan:fix/70126-sanitize-tool-calls
Closed

fix(agent): drop tool_calls key when all tool_calls are deduplicated (#70126)#70181
ms-alan wants to merge 1 commit into
NousResearch:mainfrom
ms-alan:fix/70126-sanitize-tool-calls

Conversation

@ms-alan

@ms-alan ms-alan commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Closes #70126

sanitize_api_messages() Step 3 deduplication creates tool_calls: []
when every tool_call in a turn has a duplicate id. This empty array
then passes through to strict OpenAI-compatible providers (Qwen-series)
which reject it with HTTP 400. Fix: when kept_tcs is empty after
dedup, drop the tool_calls key entirely instead of setting it to [].

…upes

sanitize_api_messages() Step 3 deduplication creates tool_calls: []
when every tool_call in a turn has a duplicate id. This empty array
then passes through to strict OpenAI-compatible providers (Qwen-series)
which reject it with HTTP 400. Fix: when kept_tcs is empty after
dedup, drop the tool_calls key entirely instead of setting it to [].

Closes NousResearch#70126
@ms-alan ms-alan closed this Jul 23, 2026
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/qwen Qwen / Alibaba Cloud (OAuth) sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state duplicate This issue or pull request already exists labels Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists provider/qwen Qwen / Alibaba Cloud (OAuth) sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: sanitize_api_messages dedup writes tool_calls: [], breaking Qwen-series tool-calling sessions on v0.18.2+

2 participants