[1.x] Replay reasoning on the OpenAI-compatible provider in tool loops
Merged
TA
7d ago+130+130+012345678901234567890123456789-110-110-012345678901234567890123456789
Fixes #1243
The openai-compatible provider reads reasoning off the response but drops it on the next tool step. Reasoning models served by vLLM or SGLang expect it back on the assistant's tool call message.
This PR:
- keeps the reasoning in
replayBlocks, under the field the server returned it in (reasoningfor vLLM,reasoning_contentfor SGLang and DeepSeek), for both generated and streamed steps - sends it back from the shared
MapsChatCompletionMessageson assistant messages with tool calls, like DeepSeek and OpenRouter already do - reduces DeepSeek's copy of the trait to its one difference: it sends an empty
reasoning_contentwhen there is none, which its thinking mode requires
Groq, Mistral and Cohere use the same trait but don't capture reasoning blocks, so their requests don't change.
Tests cover both field names, generated and streamed tool loops, and a server that returns no reasoning. The DeepSeek reasoning tests pass unchanged.