Skip to content

fix(deepseek): preserve empty reasoning content - #690

Merged
qinxuye merged 2 commits into
xorbitsai:mainfrom
bsbds:fix/deepseek-reasoning-content
Jun 26, 2026
Merged

fix(deepseek): preserve empty reasoning content#690
qinxuye merged 2 commits into
xorbitsai:mainfrom
bsbds:fix/deepseek-reasoning-content

Conversation

@bsbds

@bsbds bsbds commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Depends-On: #689

See anomalyco/opencode#24146 for related context.

@XprobeBot XprobeBot added the bug Something isn't working label Jun 25, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for preserving and replaying provider-specific state and reasoning content (such as DeepSeek's reasoning_content) across tool-calling loops. It refactors OpenAILLM into a base OpenAICompatibleLLM class and a derived OpenAILLM subclass, allowing DeepSeekLLM to inherit from the compatible base and implement custom logic for managing reasoning metadata. Additionally, internal metadata keys prefixed with _xagent_ are stripped before sending requests to the LLM providers. Feedback on the changes identifies that the newly added static method _is_thinking_enabled in DeepSeekLLM is unused and should be removed as dead code.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/xagent/core/model/chat/basic/deepseek.py Outdated
Comment thread src/xagent/core/model/chat/basic/deepseek.py Outdated

@rogercloud rogercloud left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The presence-vs-truthiness fix for reasoning_content (preserving an explicit empty string) is correct, and the round-trip of provider-owned state through _xagent_provider_state is traced end-to-end: response → runtime merge → ReAct message metadata → execution-context restore → DeepSeek replay → stripped before the provider call. The OpenAILLMOpenAICompatibleLLM split keeps OpenAI-specific output_config/env policy isolated cleanly. No output_config regression for DeepSeek (its _normalize_response_format neutralizes json_schema before reaching the base), and passing thinking through is a no-op for DeepSeek since supports_enable_thinking_param is False. Test coverage for the empty-string and provider-state replay paths is solid. The previously flagged dead _is_thinking_enabled helper has been removed.

@qinxuye
qinxuye merged commit f45d0cc into xorbitsai:main Jun 26, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants