Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Sep 23, 2025

Description

This PR attempts to address Issue #8270 by fixing the DeepSeek V3.1 Terminus model on OpenRouter to allow users to disable reasoning/thinking mode.

Problem

When using DeepSeek V3.1 Terminus via OpenRouter, reasoning appears to be enabled by default with no way to turn it off. This leads to:

  • Worse answers for some tasks
  • Increased token usage
  • Users unable to opt out of reasoning mode

Solution

Added explicit reasoning exclusion logic for the model when:

  • The model is being used via OpenRouter
  • Reasoning is not explicitly configured
  • The user has not enabled reasoning effort ( is false)

This follows the same pattern already established for Gemini 2.5 Pro models.

Changes

  • Modified to add reasoning exclusion for DeepSeek V3.1 Terminus
  • Added comprehensive test coverage in

Testing

  • ✅ All new tests pass (4 test cases)
  • ✅ Existing OpenRouter tests still pass
  • ✅ Linting and type checking pass

Expected Behavior

  • Default (reasoning OFF): DeepSeek V3.1 Terminus will not use reasoning tokens
  • When enabled: Users can still opt-in to reasoning by setting
  • Other models: No impact on other models or providers

Fixes #8270

Feedback and guidance are welcome!


Important

Disables reasoning by default for DeepSeek V3.1 Terminus on OpenRouter unless explicitly enabled by the user, with tests added to verify behavior.

  • Behavior:
    • Disables reasoning by default for DeepSeek V3.1 Terminus in OpenRouterHandler unless enableReasoningEffort is true.
    • Applies reasoning exclusion logic in createMessage() and completePrompt() in openrouter.ts.
  • Testing:
    • Adds openrouter-deepseek-terminus.spec.ts with tests for reasoning exclusion and inclusion.
    • Tests ensure no impact on other models like anthropic/claude-3-sonnet.

This description was created by Ellipsis for 389c96a. You can customize this summary. It will automatically update as commits are pushed.

…outer

- Added explicit reasoning exclusion for deepseek/deepseek-v3.1-terminus when reasoning is not enabled
- Ensures consistent behavior with user expectations where reasoning should be opt-in
- Added comprehensive tests to verify the fix works correctly
- Fixes #8270
@roomote roomote bot requested review from cte, jr and mrubens as code owners September 23, 2025 23:08
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Sep 23, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 23, 2025
Copy link
Contributor Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

Self-review complete. Found some code duplication that my copy-paste skills are particularly proud of.

typeof reasoning === "undefined" &&
!this.options.enableReasoningEffort
) {
reasoning = { exclude: true }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Consider extracting this reasoning exclusion logic into a helper method to avoid duplication with the same logic in completePrompt() (lines 262-268). For example:

private shouldExcludeReasoning(modelId: string, reasoning: any): boolean {
  return modelId === "deepseek/deepseek-v3.1-terminus" &&
    typeof reasoning === "undefined" &&
    !this.options.enableReasoningEffort;
}

}

// DeepSeek V3.1 Terminus also has reasoning enabled by default on OpenRouter
// We need to explicitly disable it when the user hasn't enabled reasoning
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Consider adding a comment explaining why DeepSeek V3.1 Terminus needs special handling, similar to the Gemini comment above. This would help future maintainers understand the reasoning behind this exclusion.

vi.clearAllMocks()
})

it("should exclude reasoning for DeepSeek V3.1 Terminus when reasoning is not enabled", async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Consider adding a test case for when reasoning is already defined in the model configuration. The current tests cover enableReasoningEffort true/false, but not the case where typeof reasoning !== "undefined".

@@ -0,0 +1,214 @@
import { describe, it, expect, vi, beforeEach } from "vitest"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Consider integrating these tests into the main openrouter.spec.ts file or following a consistent naming pattern. Other provider-specific tests are typically included in the main provider test file.

@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Sep 23, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Sep 23, 2025
@daniel-lxs
Copy link
Member

#8270 (comment)

@daniel-lxs daniel-lxs closed this Sep 24, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 24, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Prelim Review] to Done in Roo Code Roadmap Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working PR - Needs Preliminary Review size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[BUG] OpenRouter DeepSeek V3.1 Terminus forces reasoning; cannot disable

4 participants