feat: drop reasoning when tools present but reasoning_with_tool_calls unsupported - #4630
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughSummary by CodeRabbit
WalkthroughA new optional boolean field Changesreasoning_with_tool_calls Capability Support
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies" Comment |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
plugins/compat/dropparams.go (1)
160-163: 🎯 Functional Correctness | 🟠 MajorAdd reasoning_with_tool_calls check to ResponsesRequest path for consistency.
The
ResponsesRequestpath (lines 160–163) only checksisSupported["reasoning"]before dropping theReasoningparameter, but theChatRequestpath (lines 71–77) conditionally drops it when tools are present andreasoning_with_tool_callsis unsupported. SinceResponsesParametersalso has aToolsfield (used at lines 144, 152, 184, 188), the same conditional logic should apply:- if params.Reasoning != nil && !isSupported["reasoning"] { - params.Reasoning = nil - dropped = append(dropped, "reasoning") + if params.Reasoning != nil { + if !isSupported["reasoning"] || params.Tools != nil && !isSupported["reasoning_with_tool_calls"] { + params.Reasoning = nil + dropped = append(dropped, "reasoning") + } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@plugins/compat/dropparams.go` around lines 160 - 163, The reasoning parameter handling in the ResponsesRequest path (lines 160–163) is inconsistent with the ChatRequest path. In the ChatRequest path, reasoning is dropped only when both tools are present AND reasoning_with_tool_calls is unsupported. Update the logic for params.Reasoning in the ResponsesRequest path to apply the same conditional check: drop reasoning only if params.Tools is not empty AND isSupported["reasoning_with_tool_calls"] is false, similar to how it's handled in the ChatRequest section. This ensures consistent behavior across both paths since ResponsesParameters also has a Tools field.
🧹 Nitpick comments (2)
plugins/compat/dropparams.go (1)
71-77: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAdd explicit parentheses for clarity and clarify the comment.
While the operator precedence is correct (
&&binds tighter than||), explicit parentheses would improve readability. Also, the comment mentions "reasoning_effort" but the code drops the entireReasoningparameter, which may contain additional reasoning-related fields.♻️ Proposed improvements
if params.Reasoning != nil { - // for chat completions, some models do not support reasoning_effort - // with tools - if !isSupported["reasoning"] || params.Tools != nil && !isSupported["reasoning_with_tool_calls"] { + // Drop reasoning parameter when: (1) reasoning is unsupported, or + // (2) tools are present but reasoning_with_tool_calls is unsupported + if !isSupported["reasoning"] || (params.Tools != nil && !isSupported["reasoning_with_tool_calls"]) { params.Reasoning = nil dropped = append(dropped, "reasoning") }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@plugins/compat/dropparams.go` around lines 71 - 77, In the condition checking params.Reasoning support, add explicit parentheses around the logical AND operation to improve readability: wrap the params.Tools != nil && !isSupported["reasoning_with_tool_calls"] portion in parentheses to make the OR precedence explicit. Additionally, update the comment above the condition to accurately reflect what is being dropped—the entire params.Reasoning parameter (which may contain multiple reasoning-related fields) rather than just "reasoning_effort", ensuring the comment accurately describes the behavior of setting params.Reasoning to nil and appending "reasoning" to the dropped list.framework/modelcatalog/datasheet/types.go (1)
480-482: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winSimplify the nil-check condition.
The condition can be simplified from:
parsed.SupportsReasoningWithToolCalls == nil || (parsed.SupportsReasoningWithToolCalls != nil && *parsed.SupportsReasoningWithToolCalls)to:
parsed.SupportsReasoningWithToolCalls == nil || *parsed.SupportsReasoningWithToolCallsThis is safe because Go's
||operator short-circuits—if the first condition is true, the second part (with the dereference) won't be evaluated.♻️ Proposed simplification
- if parsed.SupportsReasoningWithToolCalls == nil || (parsed.SupportsReasoningWithToolCalls != nil && *parsed.SupportsReasoningWithToolCalls) { + if parsed.SupportsReasoningWithToolCalls == nil || *parsed.SupportsReasoningWithToolCalls { addParam("reasoning_with_tool_calls") }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@framework/modelcatalog/datasheet/types.go` around lines 480 - 482, The nil-check condition for parsed.SupportsReasoningWithToolCalls in the if statement is unnecessarily verbose. Simplify the condition by removing the redundant nil check from the second part of the OR expression. Since Go's || operator short-circuits, if the first condition (parsed.SupportsReasoningWithToolCalls == nil) is false, the pointer will be safe to dereference in the second part. Replace the entire condition with just parsed.SupportsReasoningWithToolCalls == nil || *parsed.SupportsReasoningWithToolCalls, keeping the addParam call with reasoning_with_tool_calls unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@plugins/compat/dropparams.go`:
- Around line 160-163: The reasoning parameter handling in the ResponsesRequest
path (lines 160–163) is inconsistent with the ChatRequest path. In the
ChatRequest path, reasoning is dropped only when both tools are present AND
reasoning_with_tool_calls is unsupported. Update the logic for params.Reasoning
in the ResponsesRequest path to apply the same conditional check: drop reasoning
only if params.Tools is not empty AND isSupported["reasoning_with_tool_calls"]
is false, similar to how it's handled in the ChatRequest section. This ensures
consistent behavior across both paths since ResponsesParameters also has a Tools
field.
---
Nitpick comments:
In `@framework/modelcatalog/datasheet/types.go`:
- Around line 480-482: The nil-check condition for
parsed.SupportsReasoningWithToolCalls in the if statement is unnecessarily
verbose. Simplify the condition by removing the redundant nil check from the
second part of the OR expression. Since Go's || operator short-circuits, if the
first condition (parsed.SupportsReasoningWithToolCalls == nil) is false, the
pointer will be safe to dereference in the second part. Replace the entire
condition with just parsed.SupportsReasoningWithToolCalls == nil ||
*parsed.SupportsReasoningWithToolCalls, keeping the addParam call with
reasoning_with_tool_calls unchanged.
In `@plugins/compat/dropparams.go`:
- Around line 71-77: In the condition checking params.Reasoning support, add
explicit parentheses around the logical AND operation to improve readability:
wrap the params.Tools != nil && !isSupported["reasoning_with_tool_calls"]
portion in parentheses to make the OR precedence explicit. Additionally, update
the comment above the condition to accurately reflect what is being dropped—the
entire params.Reasoning parameter (which may contain multiple reasoning-related
fields) rather than just "reasoning_effort", ensuring the comment accurately
describes the behavior of setting params.Reasoning to nil and appending
"reasoning" to the dropped list.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: c5e40eb2-b0d0-4b34-b3ed-e31d3b70f5b8
📒 Files selected for processing (2)
framework/modelcatalog/datasheet/types.goplugins/compat/dropparams.go
85cc7c7 to
0fb111e
Compare
0fb111e to
d037479
Compare
The merge-base changed after approval.
0fd12e9 to
1e9a9eb
Compare
d037479 to
2b63b57
Compare
Merge activity
|
… unsupported (#4630) ## Summary Some models that support reasoning do not support using reasoning alongside tool calls. This PR introduces a `reasoning_with_tool_calls` capability flag so that reasoning parameters can be selectively dropped when tools are present but the model doesn't support that combination. ## Changes - Added `SupportsReasoningWithToolCalls` field to `modelParametersParseResult`, allowing datasheets to explicitly declare whether a model supports reasoning when tool calls are also present. - In `extractSupportedParams`, `reasoning_with_tool_calls` is added as a supported param by default (when the field is `nil`), preserving backward compatibility. It is only excluded when explicitly set to `false`. - Updated `dropUnsupportedParams` in the compat plugin to drop `reasoning` not only when the model doesn't support reasoning at all, but also when tools are present and the model doesn't support `reasoning_with_tool_calls`. - Updated a stale comment referencing `buildSupportedOutputsIndex` to correctly reference `extractSupportedParams`. ## Type of change - [ ] Bug fix - [x] Feature - [ ] Refactor - [ ] Documentation - [ ] Chore/CI ## Affected areas - [x] Core (Go) - [ ] Transports (HTTP) - [ ] Providers/Integrations - [x] Plugins - [ ] UI (React) - [ ] Docs ## How to test Send a request with both `reasoning` and `tools` parameters to a model whose datasheet has `supports_reasoning_with_tool_calls` set to `false`. Verify that the `reasoning` parameter is dropped and the request proceeds without error. Send the same request to a model without `supports_reasoning_with_tool_calls` set (i.e., `nil`) and verify that `reasoning` is preserved, confirming backward-compatible behavior. ```sh go test ./... ``` ## Breaking changes - [ ] Yes - [x] No ## Related issues ## Security considerations None. ## Checklist - [x] I read `docs/contributing/README.md` and followed the guidelines - [x] I added/updated tests where appropriate - [x] I updated documentation where needed - [x] I verified builds succeed (Go and UI) - [x] I verified the CI pipeline passes locally if applicable
…ot produced names Review follow-up: len(supported) > 0 could not distinguish "row said nothing about parameters" from "row explicitly said false". A row carrying only supports_function_calling: false produced an empty list, degraded to a nil allowlist, and compat stopped dropping tools for a model that explicitly said it has none. Replace the gate with declaredParamSurface (any model_parameters entry or any non-nil supports_* flag that maps to a request parameter), so: - cost-only / deprecation-only / mode-only rows still stay unknown (the maximhq#6276 fix) - explicit-false-only rows keep an authoritative allowlist with the default marker - populated rows keep the maximhq#4630 default as before Also note the block must stay last in extractSupportedParams, and refresh the repro row in the test comments (gemini-3.6-flash was fixed upstream; claude-opus-4-7-20260416 still reproduces on the live feed).
… unsupported (maximhq#4630) ## Summary Some models that support reasoning do not support using reasoning alongside tool calls. This PR introduces a `reasoning_with_tool_calls` capability flag so that reasoning parameters can be selectively dropped when tools are present but the model doesn't support that combination. ## Changes - Added `SupportsReasoningWithToolCalls` field to `modelParametersParseResult`, allowing datasheets to explicitly declare whether a model supports reasoning when tool calls are also present. - In `extractSupportedParams`, `reasoning_with_tool_calls` is added as a supported param by default (when the field is `nil`), preserving backward compatibility. It is only excluded when explicitly set to `false`. - Updated `dropUnsupportedParams` in the compat plugin to drop `reasoning` not only when the model doesn't support reasoning at all, but also when tools are present and the model doesn't support `reasoning_with_tool_calls`. - Updated a stale comment referencing `buildSupportedOutputsIndex` to correctly reference `extractSupportedParams`. ## Type of change - [ ] Bug fix - [x] Feature - [ ] Refactor - [ ] Documentation - [ ] Chore/CI ## Affected areas - [x] Core (Go) - [ ] Transports (HTTP) - [ ] Providers/Integrations - [x] Plugins - [ ] UI (React) - [ ] Docs ## How to test Send a request with both `reasoning` and `tools` parameters to a model whose datasheet has `supports_reasoning_with_tool_calls` set to `false`. Verify that the `reasoning` parameter is dropped and the request proceeds without error. Send the same request to a model without `supports_reasoning_with_tool_calls` set (i.e., `nil`) and verify that `reasoning` is preserved, confirming backward-compatible behavior. ```sh go test ./... ``` ## Breaking changes - [ ] Yes - [x] No ## Related issues ## Security considerations None. ## Checklist - [x] I read `docs/contributing/README.md` and followed the guidelines - [x] I added/updated tests where appropriate - [x] I updated documentation where needed - [x] I verified builds succeed (Go and UI) - [x] I verified the CI pipeline passes locally if applicable
… unsupported (maximhq#4630) ## Summary Some models that support reasoning do not support using reasoning alongside tool calls. This PR introduces a `reasoning_with_tool_calls` capability flag so that reasoning parameters can be selectively dropped when tools are present but the model doesn't support that combination. ## Changes - Added `SupportsReasoningWithToolCalls` field to `modelParametersParseResult`, allowing datasheets to explicitly declare whether a model supports reasoning when tool calls are also present. - In `extractSupportedParams`, `reasoning_with_tool_calls` is added as a supported param by default (when the field is `nil`), preserving backward compatibility. It is only excluded when explicitly set to `false`. - Updated `dropUnsupportedParams` in the compat plugin to drop `reasoning` not only when the model doesn't support reasoning at all, but also when tools are present and the model doesn't support `reasoning_with_tool_calls`. - Updated a stale comment referencing `buildSupportedOutputsIndex` to correctly reference `extractSupportedParams`. ## Type of change - [ ] Bug fix - [x] Feature - [ ] Refactor - [ ] Documentation - [ ] Chore/CI ## Affected areas - [x] Core (Go) - [ ] Transports (HTTP) - [ ] Providers/Integrations - [x] Plugins - [ ] UI (React) - [ ] Docs ## How to test Send a request with both `reasoning` and `tools` parameters to a model whose datasheet has `supports_reasoning_with_tool_calls` set to `false`. Verify that the `reasoning` parameter is dropped and the request proceeds without error. Send the same request to a model without `supports_reasoning_with_tool_calls` set (i.e., `nil`) and verify that `reasoning` is preserved, confirming backward-compatible behavior. ```sh go test ./... ``` ## Breaking changes - [ ] Yes - [x] No ## Related issues ## Security considerations None. ## Checklist - [x] I read `docs/contributing/README.md` and followed the guidelines - [x] I added/updated tests where appropriate - [x] I updated documentation where needed - [x] I verified builds succeed (Go and UI) - [x] I verified the CI pipeline passes locally if applicable

Summary
Some models that support reasoning do not support using reasoning alongside tool calls. This PR introduces a
reasoning_with_tool_callscapability flag so that reasoning parameters can be selectively dropped when tools are present but the model doesn't support that combination.Changes
SupportsReasoningWithToolCallsfield tomodelParametersParseResult, allowing datasheets to explicitly declare whether a model supports reasoning when tool calls are also present.extractSupportedParams,reasoning_with_tool_callsis added as a supported param by default (when the field isnil), preserving backward compatibility. It is only excluded when explicitly set tofalse.dropUnsupportedParamsin the compat plugin to dropreasoningnot only when the model doesn't support reasoning at all, but also when tools are present and the model doesn't supportreasoning_with_tool_calls.buildSupportedOutputsIndexto correctly referenceextractSupportedParams.Type of change
Affected areas
How to test
Send a request with both
reasoningandtoolsparameters to a model whose datasheet hassupports_reasoning_with_tool_callsset tofalse. Verify that thereasoningparameter is dropped and the request proceeds without error.Send the same request to a model without
supports_reasoning_with_tool_callsset (i.e.,nil) and verify thatreasoningis preserved, confirming backward-compatible behavior.go test ./...Breaking changes
Related issues
Security considerations
None.
Checklist
docs/contributing/README.mdand followed the guidelines