Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

roomote[bot]
Copy link

@roomote roomote bot commented Aug 13, 2025

Summary

This PR fixes issue #7054 where switching from GPT-5 models (which support the verbosity parameter) to GPT-4.1 or other models (which don't support it) causes API errors.

Problem

When a user sets verbosity while using GPT-5 models and then switches to GPT-4.1, the verbosity parameter is incorrectly passed to the API, resulting in:

  • 400 Unrecognized request argument supplied: verbosity when verbosity was set to Medium
  • 400 Unsupported value: 'verbosity' does not support 'low' with this model when verbosity was set to Low or High

Solution

  • Modified handleDefaultModelMessage in openai-native.ts to check the model's supportsVerbosity flag before including the verbosity parameter in the API request
  • Only models that explicitly support verbosity (GPT-5 family) will have the parameter included

Testing

  • Added comprehensive test cases to verify that verbosity is excluded for models that don't support it (gpt-4.1, gpt-4o, gpt-4.1-mini)
  • All existing tests continue to pass
  • Verified that GPT-5 models still correctly receive the verbosity parameter when set

Changes

  • src/api/providers/openai-native.ts: Added check for model.info.supportsVerbosity before adding verbosity parameter
  • src/api/providers/tests/openai-native.spec.ts: Added test cases for verbosity parameter handling

Fixes #7054


Important

Fixes verbosity parameter handling by checking model support before inclusion in openai-native.ts, with tests added in openai-native.spec.ts.

  • Behavior:
  • Testing:
    • Added tests in openai-native.spec.ts to ensure verbosity is excluded for unsupported models (gpt-4.1, gpt-4o, gpt-4.1-mini).
    • Verified GPT-5 models still receive verbosity parameter correctly.
  • Files Changed:
    • openai-native.ts: Added check for supportsVerbosity.
    • openai-native.spec.ts: Added test cases for verbosity handling.

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

- Check supportsVerbosity flag before adding verbosity to API request
- Prevents "Unrecognized request argument" errors when switching from GPT-5 to GPT-4.1
- Add tests to verify verbosity is excluded for unsupported models

Fixes #7054
@roomote roomote bot requested review from cte, jr and mrubens as code owners August 13, 2025 18:37
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels 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 is like debugging in a mirror - everything looks backwards but the bugs are still mine.

// Add verbosity if supported
if (verbosity) {
// Add verbosity only if the model supports it
if (verbosity && model.info.supportsVerbosity) {
Copy link
Author

Choose a reason for hiding this comment

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

Good fix! This correctly checks for verbosity support before adding the parameter. However, could we add a brief comment here explaining why this check is necessary? Something like:

Suggested change
if (verbosity && model.info.supportsVerbosity) {
// Add verbosity only if the model supports it
// GPT-5 family supports verbosity, but GPT-4.1 and other models don't
if (verbosity && model.info.supportsVerbosity) {

This would help future maintainers understand the reasoning behind this check.

// Verify that verbosity is NOT included in the request
const callArgs = mockCreate.mock.calls[0][0]
expect(callArgs).not.toHaveProperty("verbosity")
expect(callArgs.model).toBe("gpt-4.1-mini")
Copy link
Author

Choose a reason for hiding this comment

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

Great test coverage for the main GPT-4.1 family models! Consider also adding a test case for gpt-4.1-nano to ensure complete coverage of all GPT-4.1 variants that don't support verbosity. This would make the test suite more comprehensive.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Aug 13, 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 13, 2025
@mrubens mrubens merged commit 23afdfc into main Aug 13, 2025
25 checks passed
@mrubens mrubens deleted the fix/verbosity-parameter-gpt4 branch August 13, 2025 19:33
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Aug 13, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Aug 13, 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 Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Unrecognized request argument supplied: verbosity when switching to another OpenAI model from gpt-5-2025-08-07

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.