Skip to content

fix(deepseek): disable thinking mode to fix EMPTY_MESSAGE - #578

Merged
di-sukharev merged 2 commits into
di-sukharev:masterfrom
freedomsky11:fix/deepseek-v4-thinking-mode
Aug 22, 2026
Merged

fix(deepseek): disable thinking mode to fix EMPTY_MESSAGE#578
di-sukharev merged 2 commits into
di-sukharev:masterfrom
freedomsky11:fix/deepseek-v4-thinking-mode

Conversation

@freedomsky11

Copy link
Copy Markdown
Contributor

Problem

DeepSeek V4 enables thinking mode by default (effort=high). Chain-of-thought is returned in reasoning_content, leaving content empty when max_tokens is low. This caused EMPTY_MESSAGE errors during commit generation (reported with default 500 token output limit).

Changes

  • src/engine/deepseek.ts: Disable thinking mode via extra_body: { thinking: { type: 'disabled' } } (required for OpenAI SDK per DeepSeek docs). Commit messages don't need chain-of-thought; this also restores temperature/top_p behavior (ignored in thinking mode).
  • src/commands/config.ts: Update MODEL_LIST.deepseek and RECOMMENDED_MODELS to current V4 models (deepseek-v4-flash / deepseek-v4-pro).
  • src/utils/errors.ts: Update recommended model in error recovery.

Verification

Tested locally: with thinking mode disabled, commit generation succeeds with default 500 token limit (previously required OCO_TOKENS_MAX_OUTPUT=3000 workaround).

DeepSeek V4 enables thinking mode by default (effort=high). Chain-of-thought is returned in reasoning_content, leaving content empty when max_tokens is low, which causes EMPTY_MESSAGE errors during commit generation.

Disable thinking mode via extra_body (required for OpenAI SDK per DeepSeek docs) since commit messages don't need chain-of-thought. Also update MODEL_LIST.deepseek and RECOMMENDED_MODELS to current V4 model names (deepseek-v4-flash / deepseek-v4-pro).

Co-authored-by: uni <uni@hanwei.ink>

@di-sukharev di-sukharev left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The model IDs are updated correctly, but the parameter that disables thinking will not reach DeepSeek in the required shape. The JavaScript SDK needs a top-level thinking field, plus a regression test that verifies the actual JSON request body.

Comment thread src/engine/deepseek.ts Outdated
extra_body is a Python SDK helper; the OpenAI JavaScript SDK forwards unknown fields as-is, so the API would receive an extra_body field and thinking mode would remain enabled. Pass thinking directly via a local DeepseekChatCompletionParams type extending ChatCompletionCreateParamsNonStreaming.

Add request-body regression tests verifying thinking sits at the top level and extra_body is absent.

Co-authored-by: uni <uni@hanwei.ink>

@di-sukharev di-sukharev left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The blocking request-shape issue is fixed. The JavaScript client now sends thinking as a top-level API field, the obsolete extra_body wrapper is explicitly regression-tested, and the current V4 model IDs match DeepSeek's API schema. I also verified the combined merge with the other ready PRs: lint, typecheck, Prettier, build, 158 unit tests, and 34 end-to-end tests all pass. Approved.

@di-sukharev
di-sukharev merged commit 06867d7 into di-sukharev:master Aug 22, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants