Repository navigation
fix: preserve streaming tool_calls when provider omits finish_reason - #98575
sergioperezcheco wants to merge 1 commit into
Conversation
Some OpenAI-compatible providers (e.g., Evolink deepseek-v4-pro) send valid delta.tool_calls chunks but end the stream with data: [DONE] without a final finish_reason chunk. Previously, this caused an error that discarded all accumulated tool call blocks. Now we infer the stop reason from the accumulated content: toolUse if tool calls were parsed, stop otherwise. This matches the existing fallback logic that already promotes stop -> toolUse when tool calls are present. Fixes openclaw#97994
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: the linked issue’s active embedded-agent path is the boundary-aware OpenAI completions transport, and #98124 is an open, mergeable, proof-positive candidate for that path; this PR changes the lower-level provider path and broadens EOF-only tool execution unsafely. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Close this PR and continue review of #98124 as the canonical transport-level fix, preserving clean So I’m closing this here and keeping the remaining discussion on #98124. Review detailsBest possible solution: Close this PR and continue review of #98124 as the canonical transport-level fix, preserving clean Do we have a high-confidence way to reproduce the issue? Yes. Current main’s OpenAI completions transport strips no-finish streamed tool-call blocks unless an explicit stop finish reason was seen, and the linked issue includes redacted provider chunks showing valid Is this the best way to solve the issue? No. This branch is not the best fix because it changes the legacy provider path and cannot distinguish clean Security review: Security review needs attention: The diff changes a model-output-to-tool-execution boundary and would execute no-finish parsed tool calls without proving a clean stream terminal.
AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 1b0b8c294a3e. |
|
ClawSweeper applied the proposed close for this PR.
|
Some OpenAI-compatible providers (e.g., Evolink deepseek-v4-pro) send valid delta.tool_calls chunks but end the stream with data: [DONE] without a final finish_reason chunk. Previously, this caused an error that discarded all accumulated tool call blocks, making tool-using agent workflows silently fail.
Now we infer the stop reason from the accumulated content: toolUse if tool calls were parsed, stop otherwise. This matches the existing fallback logic that already promotes stop -> toolUse when tool calls are present.
Fixes #97994
Changes
Testing
All 36 existing tests pass plus the new test case.