Skip to content

fix: respect enableReasoningEffort setting when determining reasoning usage #7049

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

roomote[bot]
Copy link

@roomote roomote bot commented Aug 13, 2025

Summary

This PR fixes an issue where the reasoningEffort parameter would override the enableReasoningEffort setting, causing reasoning to be enabled even when explicitly disabled.

Problem

When enableReasoningEffort was set to false in the API configuration, the model would still perform reasoning if reasoningEffort (e.g., "medium") was present. This behavior was unexpected as the enableReasoningEffort setting should take precedence.

Solution

Modified the shouldUseReasoningEffort function in src/shared/api.ts to:

  1. First check if enableReasoningEffort is explicitly set to false
  2. If it is, return false immediately, disabling reasoning regardless of other settings
  3. Otherwise, proceed with the existing logic

Testing

  • Added comprehensive test cases to verify that reasoning is properly disabled when enableReasoningEffort is false
  • All existing tests continue to pass
  • Type checking passes without issues

Related Issue

Fixes #7048


Important

Fix shouldUseReasoningEffort to respect enableReasoningEffort setting, ensuring reasoning is disabled when explicitly set to false.

  • Behavior:
    • Fix shouldUseReasoningEffort in api.ts to respect enableReasoningEffort setting, returning false if set to false.
    • Ensures reasoning is disabled if enableReasoningEffort is false, regardless of reasoningEffort value.
  • Testing:
    • Add tests in api.spec.ts to verify reasoning is disabled when enableReasoningEffort is false.
    • Ensure all existing tests pass and type checking is successful.

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

… usage

- Modified shouldUseReasoningEffort to return false when enableReasoningEffort is explicitly set to false
- This ensures reasoning is disabled when the setting is false, regardless of reasoningEffort value
- Added comprehensive tests to verify the fix

Fixes #7048
@roomote roomote bot requested review from mrubens, cte and jr as code owners August 13, 2025 14:48
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Aug 13, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Aug 13, 2025
Copy link
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.

Reviewing my own code because apparently I trust no one, not even myself.

}): boolean => {
// If enableReasoningEffort is explicitly set to false, reasoning should be disabled
if (settings?.enableReasoningEffort === false) {
return false
Copy link
Author

Choose a reason for hiding this comment

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

Is this intentional? When enableReasoningEffort is undefined (not explicitly set), reasoning can still be enabled if other conditions are met. Should we consider treating undefined the same as false for a more conservative approach, or is the current behavior where only an explicit false disables reasoning the desired one?

@@ -63,7 +63,17 @@ export const shouldUseReasoningEffort = ({
}: {
model: ModelInfo
settings?: ProviderSettings
}): boolean => (!!model.supportsReasoningEffort && !!settings?.reasoningEffort) || !!model.reasoningEffort
}): boolean => {
// If enableReasoningEffort is explicitly set to false, reasoning should be disabled
Copy link
Author

Choose a reason for hiding this comment

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

Consider adding a JSDoc comment above the function to document the precedence rules. This would help future developers understand that enableReasoningEffort: false takes absolute precedence over all other settings.

reasoningEffort: "medium",
}

expect(shouldUseReasoningEffort({ model, settings })).toBe(false)
Copy link
Author

Choose a reason for hiding this comment

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

Good test coverage for the explicit false case! Consider also adding a test for when enableReasoningEffort is explicitly undefined (not just missing) to document that this allows reasoning to proceed - this would make the behavior more explicit.

@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Aug 15, 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 Aug 15, 2025
Copy link
Collaborator

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

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

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 15, 2025
@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Needs Review] in Roo Code Roadmap Aug 15, 2025
mrubens
mrubens previously approved these changes Aug 16, 2025
}): boolean => (!!model.supportsReasoningEffort && !!settings?.reasoningEffort) || !!model.reasoningEffort
}): boolean => {
// If enableReasoningEffort is explicitly set to false, reasoning should be disabled
if (settings?.enableReasoningEffort === false) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Roomote makes a good point about the default. Should this be:

Suggested change
if (settings?.enableReasoningEffort === false) {
if (!settings?.enableReasoningEffort) {

@mrubens mrubens dismissed their stale review August 16, 2025 03:36

Not sure the right default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lgtm This PR has been approved by a maintainer PR - Needs Review size:M This PR changes 30-99 lines, ignoring generated files.
Projects
Status: PR [Needs Review]
Development

Successfully merging this pull request may close these issues.

reasoningEffort overrides enableReasoningEffort setting in API config
4 participants