Skip to content

fix(openai-codex): send the verbosity setting in requests - #1977

Merged
taltas merged 1 commit into
Zoo-Code-Org:mainfrom
tosinxt:fix/codex-verbosity
Oct 9, 2026
Merged

taltas merged 1 commit into
Zoo-Code-Org:mainfrom
tosinxt:fix/codex-verbosity

Conversation

@tosinxt

@tosinxt tosinxt commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Related GitHub Issue

Closes: #1958

Description

OpenAiCodexHandler.buildRequestBody() now adds text: { verbosity } for models whose catalog entry has supportsVerbosity: true, falling back to "medium" when the setting is unset, the same rule openai-native.ts uses. Models without the flag get no text field, so their requests are unchanged.

  • One change covers both call paths: createMessage() and completePrompt() both build their request through buildRequestBody().
  • Responses Lite is untouched. transformResponsesLiteBody() already carries unrelated fields through, and the GPT-6.1 Sol tests confirm text.verbosity reaches the Lite request.
  • ResponsesRequestBody gains text?: { verbosity: VerbosityLevel }. model.verbosity is already typed VerbosityLevel | undefined, so no cast is needed (Native casts because its value arrives as any).
  • No new setting or UI, Codex only, and no changeset (per AGENTS.md, maintainers manage those).

Acceptance criteria → tests in openai-codex.spec.ts (OpenAiCodexHandler verbosity), all inspecting the body passed to the mocked responses.create:

Criterion Test
low / medium / high sent as text.verbosity, for chat and one-shot, on ordinary Responses (gpt-5) and Responses Lite (gpt-6.1-sol) $apiModelId $call request sends text.verbosity $expected when verbosity is $verbosity (12 cases)
Unset → "medium", same matrix same test, verbosity is unset cases (4)
Model without the flag (gpt-5-codex, verbosity high) → no text omits text.verbosity for a model without verbosity support (chat, one-shot)
Existing tests still pass all 48 existing cases in the file unchanged

Test Procedure

Run from src/:

  • pnpm exec vitest run api/providers/__tests__/openai-codex.spec.ts api/providers/__tests__/openai-native.spec.ts: before the fix, the 16 "sends text.verbosity" cases fail (expected undefined to deeply equal { verbosity: 'low' }, etc.); after it, 145/145 pass (66 Codex, 79 Native).
  • pnpm exec vitest run api: 122 files, 3,019 passed, 2 skipped.
  • The other specs that reference the Codex provider (core/webview/__tests__/ClineProvider.spec.ts, core/webview/__tests__/webviewMessageHandler.spec.ts, shared/__tests__/checkExistApiConfig.spec.ts): 306 pass.
  • pnpm check-types ✅, pnpm lint ✅ (--max-warnings=0), Prettier ✅.

Not run: live requests to the Codex backend (needs a ChatGPT sign-in). As the issue suggests, everything is verified with mocked SDK calls.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Visual Snapshot (UI changes only): N/A, no UI change.
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Visual Snapshots

N/A, no UI change.

Videos (interaction / animation only)

N/A.

Documentation Updates

  • No documentation updates are required.

Additional Notes

None.

Get in Touch

Discord: tosin.py

The Codex provider accepted a verbosity setting but never sent it, so
choosing low or high had no effect. buildRequestBody() now adds
text.verbosity for models with supportsVerbosity, falling back to
"medium" like OpenAI Native, and omits it for other models.

Closes Zoo-Code-Org#1958
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: Zoo-Code-Org/Zoo-Code/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 5cf5a9f4-cf25-4f3d-ac83-0454fd61f77e

📥 Commits

Reviewing files that changed from the base of the PR and between a101c61 and 913e316.


📒 Files selected for processing (2)
  • src/api/providers/__tests__/openai-codex.spec.ts
  • src/api/providers/openai-codex.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (5)
Treat model, provider, MCP, path, command, and tool data as untrusted.

⚙️ CodeRabbit configuration file

Files:

  • src/api/providers/openai-codex.ts
  • src/api/providers/__tests__/openai-codex.spec.ts

Require regression coverage at the lowest valid harness with behavior-focused assertions, including relevant negative, error, false/unset, and boundary cases.

⚙️ CodeRabbit configuration file

Files:

  • src/api/providers/__tests__/openai-codex.spec.ts

Check strict typing and exhaustive behavior across normal, boundary, error, cancellation, retry, and compatibility paths.

⚙️ CodeRabbit configuration file

Files:

  • src/api/providers/openai-codex.ts
  • src/api/providers/__tests__/openai-codex.spec.ts

Verify extension/webview contracts, cancellation and error propagation, VS Code lifecycle correctness, and behavior under retries and partial failure.

⚙️ CodeRabbit configuration file

Files:

  • src/api/providers/openai-codex.ts
  • src/api/providers/__tests__/openai-codex.spec.ts

Act as an adversarial second-opinion reviewer.

⚙️ CodeRabbit configuration file

Files:

  • src/api/providers/openai-codex.ts
  • src/api/providers/__tests__/openai-codex.spec.ts



🔇 Additional comments (2)
src/api/providers/openai-codex.ts (1)

16-16: LGTM!

Also applies to: 410-410, 451-455


src/api/providers/__tests__/openai-codex.spec.ts (1)

1016-1034: LGTM!

Also applies to: 1036-1053, 1055-1064, 1066-1075





📝 Summary

Summary by CodeRabbit

  • Improvements
    • Requests now apply the selected verbosity level for models that support it, defaulting to medium when no level is configured.
    • Models that do not support verbosity continue to omit the setting.

Walkthrough

The Codex request builder now includes text.verbosity when the selected model declares support. It uses medium when no verbosity is configured. Tests cover chat and one-shot requests for supported and unsupported models.

Changes

Codex verbosity requests

Layer / File(s) Summary
Build and verify verbosity requests
src/api/providers/openai-codex.ts, src/api/providers/__tests__/openai-codex.spec.ts
The request-body type accepts VerbosityLevel. The builder adds the configured verbosity or medium when the model supports it. Tests check selected and default values in chat and one-shot requests, and verify that gpt-5-codex omits text.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium


Merge Risk: ⚪ Minimal · up to 913e3

The verbosity setting reaches requests on the covered paths. No actionable merge-blocking risk remains after normal checks.

🚥 Pre-merge checks | ✅ 8
✅ Passed checks (8 passed)
Check name Status Explanation
Linked Issues check Passed Issue #1958 requires Codex requests to send text.verbosity for models with supportsVerbosity, use medium when unset, and omit text for unsupported models. buildRequestBody() implements this …
Out of Scope Changes check Passed The pull request changes only openai-codex.ts and its Codex tests. The implementation and tests directly support issue #1958. The changes add no setting, UI, unrelated provider behavior, or duplicat…
Regression Evidence Passed Focused regression coverage is present at the provider request layer. The added parameterized tests exercise createMessage() and completePrompt() for ordinary Responses (gpt-5) and Responses Lit…
Security Boundaries Passed No changed security-boundary violation is present. In src/api/providers/openai-codex.ts:451-454, the PR adds only text.verbosity when the catalog model has supportsVerbosity === true; `getModel(…
Persistence Integrity Passed No changed persistence path exists. The patch only adds text.verbosity to the outgoing request in buildRequestBody and covers the existing chat and one-shot request flow. It performs no persistence wr…
Lifecycle Resource Cleanup Passed No changed lifecycle path can leak a resource or duplicate work. The implementation change only adds an optional text field to ResponsesRequestBody and assigns body.text.verbosity in `buildReque…
Title check Passed The title clearly and concisely describes the main change: sending the configured verbosity setting in OpenAI Codex requests.
Description check Passed The description follows the repository template. It links issue #1958, explains the implementation and scope, documents test procedures and results, completes the checklist, and addresses UI, video, d…


✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review status

Thanks for contributing. This comment tracks the review sequence and the next action.

Current step: Awaiting fresh human maintainer or CODEOWNER approval.

Automated review is complete for the latest commit but does not replace human approval.

Review-state labels are managed by this workflow; do not edit them manually. community-approved is managed the same way — do not add or remove it manually. It signals a fresh community code approval for the current head as an advisory priority only; maintainer review is still required.

@codecov

codecov Bot commented Oct 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions github-actions Bot added coderabbit-review-active Required CI passed; CodeRabbit review is active awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit labels Oct 9, 2026
@github-actions github-actions Bot added awaiting-maintainer CodeRabbit approved; waiting for a human maintainer and removed coderabbit-review-active Required CI passed; CodeRabbit review is active awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit labels Oct 9, 2026

@WebMad WebMad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for your contribution! See you in the next PRs

@taltas

taltas commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Thanks for the contribution @tosinxt !

@taltas
taltas added this pull request to the merge queue Oct 9, 2026
Merged via the queue into Zoo-Code-Org:main with commit 9b6d742 Oct 9, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-maintainer CodeRabbit approved; waiting for a human maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] OpenAI Codex ignores the verbosity setting

3 participants