Skip to content

fix(openai-shim): nest reasoning under reasoning.effort for the Responses API - #1643

Closed
0xghost42 wants to merge 1 commit into
Twigpine:mainfrom
0xghost42:fix/1638-responses-reasoning-effort
Closed

0xghost42 wants to merge 1 commit into
Twigpine:mainfrom
0xghost42:fix/1638-responses-reasoning-effort

Conversation

@0xghost42

@0xghost42 0xghost42 commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

What

Adding an OpenAI-compatible provider on the Responses API (e.g. GPT-5.5 via /provider) failed on the first request with:

API Error: 400 Unsupported parameter: 'reasoning_effort'. In the Responses API,
this parameter has moved to 'reasoning.effort'.

Why

In src/services/api/openaiShim.ts, the responses body set the flat reasoning_effort / reasoning_summary fields. Those belong to Chat Completions — the Responses API nests them under a reasoning object (reasoning.effort / reasoning.summary) and rejects the flat form.

Change

Emit reasoning: { effort, summary } when building the responses body. The chat-completions path is untouched (the flat reasoning_effort is correct there).

Test

Added a responses-API test asserting the nested reasoning object is sent and the flat reasoning_effort is absent. bun test src/services/api/openaiShim.test.ts (122 pass) and tsc --noEmit clean.

Closes #1638

Summary by CodeRabbit

  • Bug Fixes
    • Fixed how reasoning effort settings are formatted and transmitted in API requests, ensuring proper handling and configuration.

…ponses API

When OPENAI_API_FORMAT is responses, the request body sent the flat
reasoning_effort / reasoning_summary fields. The Responses API nests
these under a reasoning object (reasoning.effort / reasoning.summary)
and rejects the flat form with:

  400 Unsupported parameter: 'reasoning_effort'. In the Responses API,
  this parameter has moved to 'reasoning.effort'.

so any OpenAI-compatible provider on the Responses API (e.g. GPT-5.5)
failed on the first request with a reasoning effort set. Emit
reasoning: { effort, summary } for the responses body. The chat
completions path keeps the flat reasoning_effort, which is correct there.

Closes Twigpine#1638
@coderabbitai

coderabbitai Bot commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 845bee12-5243-42c6-8b4e-b790cb3ac33e

📥 Commits

Reviewing files that changed from the base of the PR and between 8bce86f and 7930bd0.

📒 Files selected for processing (2)
  • src/services/api/openaiShim.test.ts
  • src/services/api/openaiShim.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: smoke-and-tests
  • GitHub Check: typecheck
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{ts,tsx,js,jsx,py,md}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Follow the existing code style in the touched files

Files:

  • src/services/api/openaiShim.test.ts
  • src/services/api/openaiShim.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add or update tests when the change affects behavior in TypeScript and JavaScript files

Files:

  • src/services/api/openaiShim.test.ts
  • src/services/api/openaiShim.ts
**/*

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/services/api/openaiShim.test.ts
  • src/services/api/openaiShim.ts
{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}

⚙️ CodeRabbit configuration file

{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}: Review provider routing, model selection, env precedence, auth/token handling, OpenAI-compatible shims, retries, proxy behavior, and outbound HTTP behavior with high scrutiny. Block on silent default changes, hidden fallback expansion, credential reuse mistakes, hardcoded provider assumptions, or new network reach that is not intentional and documented.

Files:

  • src/services/api/openaiShim.test.ts
  • src/services/api/openaiShim.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/services/api/openaiShim.test.ts
**

⚙️ CodeRabbit configuration file

**: # Contributing to OpenClaude

Thanks for contributing.

OpenClaude is a fast-moving open-source coding-agent CLI with support for multiple providers, local backends, MCP, and a terminal-first workflow. The best contributions here are focused, well-tested, and easy to review.

Before You Start

  • Search existing issues and discussions before opening a new thread.
  • Check open pull requests for work that overlaps with your contribution. If a PR already exists that addresses the same change, open an issue or discussion first to align on direction — duplicate PRs may be closed without review.
  • Use issues for confirmed bugs and actionable feature work.
  • Use discussions for setup help, ideas, and general community conversation.
  • For larger changes, open an issue first so the scope is clear before implementation.
  • For security reports, follow SECURITY.md.

Pull Requests

Every PR needs a reason. Your PR description must include:

  • what changed and why
  • the user or developer impact
  • the exact checks you ran
  • a linked issue when one exists, using Fixes fix: skip assertMinVersion for third-party providers #123, `Closes `#123, or another clear link
  • screenshots when the PR touches UI, terminal presentation, or the VS Code extension
  • which provider path was tested when the PR changes provider behavior

The PR author is responsible for ensuring their PR is merge-ready. PRs with merge conflicts will not be reviewed or approved until the conflicts are resolved.

Issues are the recommended starting point for anything non-trivial — opening one first helps avoid wasted effort if the change is out of scope or already being worked on. Small fixes, doc corrections, and obvious improvements can stand on their own without a linked issue, as long as the PR description explains the intent.

What Gets Closed Without Review

PRs may be closed without review...

Files:

  • src/services/api/openaiShim.test.ts
  • src/services/api/openaiShim.ts
🔇 Additional comments (2)
src/services/api/openaiShim.ts (1)

2574-2584: LGTM!

src/services/api/openaiShim.test.ts (1)

348-386: LGTM!


📝 Walkthrough

Walkthrough

buildResponsesBody in the OpenAI shim is updated to send reasoning: { effort, summary: 'auto' } as a nested object instead of the flat reasoning_effort and reasoning_summary fields. A new test verifies the nested shape is present and the flat field is absent.

Changes

Responses API reasoning payload fix

Layer / File(s) Summary
Nested reasoning object in buildResponsesBody + test
src/services/api/openaiShim.ts, src/services/api/openaiShim.test.ts
buildResponsesBody replaces responsesBody.reasoning_effort and responsesBody.reasoning_summary with responsesBody.reasoning = { effort, summary: 'auto' }. The new test stubs globalThis.fetch, configures reasoningEffort: 'high', and asserts the nested reasoning object is in the body while reasoning_effort is not.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested reviewers

  • gnanam1990
  • Vasanthdev2004
  • techbrewboss
  • jatmn
🚥 Pre-merge checks | ✅ 7
✅ Passed checks (7 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the core change: nesting reasoning parameters under a reasoning object for the Responses API.
Description check ✅ Passed The PR description covers the What, Why, and Change clearly. It includes the error context, root cause, solution, and test validation. Testing checklist is missing.
Linked Issues check ✅ Passed The PR fully addresses issue #1638 by fixing the 400 error caused by flat reasoning_effort fields, implementing the required nested reasoning object structure for Responses API.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the reasoning parameter nesting issue for Responses API. Chat Completions path left untouched as required.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Risk Surface Disclosed ✅ Passed PR touches outbound network behavior (HTTP request body format) and adequately discloses it as a bug fix for API compliance—changing flat reasoning_effort to nested reasoning object for Responses A...
No Hidden Policy Change ✅ Passed No policy changes detected. PR makes surgical API request format fix: changes nested reasoning object structure only for Responses API (+8/-2 in implementation, +40/-0 in test). Chat Completions pa...

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

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

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

@jatmn

jatmn commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

this is a duplicate of #1639

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unsupported parameter: 'reasoning_effort'

2 participants