Description
Reasoning is received and persisted correctly for OpenAI-compatible custom providers, but it is not included when assistant messages are converted back into the next Chat Completions request.
For models such as Qwen that expose reasoning via reasoning / reasoning_content, Docker Agent correctly:
- captures the streamed reasoning in
oaistream
- accumulates it as
ReasoningContent
- stores it on the assistant
chat.Message
- displays it in the TUI
However, when the conversation history is converted for the next request, oaistream.ConvertMessages() serializes the assistant content and tool calls but does not serialize msg.ReasoningContent.
As a result, reasoning is visible and stored in the Docker Agent session, but is silently omitted from subsequent model requests.
This means a reasoning model cannot see its previous reasoning after a tool call. In long-running agent workflows this can cause the model to repeatedly reconstruct decisions and analysis it has already performed, substantially increasing reasoning tokens and execution time.
I confirmed this by patching the OpenAI-compatible message conversion to include the stored reasoning. An existing session that Docker Agent previously considered within a ~120K context window immediately produced a ~277K context request once the previously stored reasoning was actually replayed. After compaction/accounting was adjusted, the model retained reasoning correctly across tool turns and showed substantially better continuity.
This appears specific to the OpenAI-compatible/custom-provider conversion path; the reasoning state is already retained and replayed appropriately by other provider implementations.
Expected Behavior
We should at least have an option to preserve reasoning for models using this provider. I appreciate this may need to be configurable rather than enabled by default, since OpenAI-compatible providers can behave differently.
Actual Behavior
Reasoning is never preserved when using OpenAI custom provider.
Steps to Reproduce
Use the custom AI provider and monitor context usage, it will only go up for output and not reasoning.
Docker Agent version
1.141.0
OS & terminal
Linux
Model used
Qwen 3.8 flash next via llama.cpp
Error output
No specific error, its subtle to spot
Screenshots
No response
Additional context
No response
Description
Reasoning is received and persisted correctly for OpenAI-compatible custom providers, but it is not included when assistant messages are converted back into the next Chat Completions request.
For models such as Qwen that expose reasoning via
reasoning/reasoning_content, Docker Agent correctly:oaistreamReasoningContentchat.MessageHowever, when the conversation history is converted for the next request,
oaistream.ConvertMessages()serializes the assistant content and tool calls but does not serializemsg.ReasoningContent.As a result, reasoning is visible and stored in the Docker Agent session, but is silently omitted from subsequent model requests.
This means a reasoning model cannot see its previous reasoning after a tool call. In long-running agent workflows this can cause the model to repeatedly reconstruct decisions and analysis it has already performed, substantially increasing reasoning tokens and execution time.
I confirmed this by patching the OpenAI-compatible message conversion to include the stored reasoning. An existing session that Docker Agent previously considered within a ~120K context window immediately produced a ~277K context request once the previously stored reasoning was actually replayed. After compaction/accounting was adjusted, the model retained reasoning correctly across tool turns and showed substantially better continuity.
This appears specific to the OpenAI-compatible/custom-provider conversion path; the reasoning state is already retained and replayed appropriately by other provider implementations.
Expected Behavior
We should at least have an option to preserve reasoning for models using this provider. I appreciate this may need to be configurable rather than enabled by default, since OpenAI-compatible providers can behave differently.
Actual Behavior
Reasoning is never preserved when using OpenAI custom provider.
Steps to Reproduce
Use the custom AI provider and monitor context usage, it will only go up for output and not reasoning.
Docker Agent version
1.141.0
OS & terminal
Linux
Model used
Qwen 3.8 flash next via llama.cpp
Error output
Screenshots
No response
Additional context
No response