Skip to content

[AISAGE-759] fix(ai-gateway): drop non-OpenAI reasoning fields on ChatGPT route - #8560

Merged
chrarnoldus merged 1 commit into
mainfrom
fix/openai-chatgpt-reasoning-fields
Oct 22, 2026
Merged

chrarnoldus merged 1 commit into
mainfrom
fix/openai-chatgpt-reasoning-fields

Conversation

@chrarnoldus

Copy link
Copy Markdown
Contributor

Summary

This follows up #8555. On the ChatGPT route, the delegated transform now removes reasoning fields that api.openai.com rejects with 400 unknown_parameter:

  • OpenRouter-only fields: reasoning.enabled, reasoning.exclude and reasoning.max_tokens are OpenRouter's own reasoning settings, documented in OpenRouter's reasoning tokens docs. OpenAI's Reasoning type has none of them. Clients that are set up for OpenRouter send them.
  • Deprecated reasoning.generate_summary: the OpenAI SDK marks it "Deprecated: use summary instead", and the API now rejects it. Dropping it loses nothing, because the gateway already sets reasoning.summary on every Responses request (enableReasoningSummaries).

effort, summary, context and mode are passed through unchanged. Tracked in AISAGE-759.

Verification

  • Checked production logs for this route: reasoning.enabled and reasoning.generate_summary are both rejected as unknown_parameter. exclude and max_tokens were not seen there, but they are part of the same OpenRouter settings and OpenAI's Reasoning type does not include them.
  • Ran all openai-chatgpt/ suites with a new transform test; all pass.
  • Ran pnpm --filter @kilocode/web-shared typecheck and oxlint on the changed files; both are clean.
  • No manual end-to-end test: it needs a live ChatGPT subscription-sharing connection.

Visual Changes

N/A

Reviewer Notes

  • A caller that disables reasoning with OpenRouter's enabled: false now gets the model's default effort instead of an error. Translating it to effort: "none" would fail on models that reject none, for example gpt-6-astra.

…ChatGPT route

OpenRouter's reasoning extensions (enabled, exclude, max_tokens) and OpenAI's
deprecated generate_summary are rejected as unknown parameters.
@chrarnoldus chrarnoldus self-assigned this Oct 22, 2026
@kilo-code-bot

kilo-code-bot Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

The two-file change deletes OpenRouter-only and deprecated reasoning fields from delegated ChatGPT Responses requests, and the new tests cover both a mixed reasoning object and an absent one; I found no defects in the changed lines.

Assumptions: [INFERENCE] The PR description says reasoning.context and reasoning.mode are passed through and accepted by api.openai.com, but the OpenAI Responses Reasoning type in this repo's generated types (services/ai-attribution/worker-configuration.d.ts:3988) contains only effort, summary, and generate_summary; I could not verify those two fields are accepted, so the denylist may still be incomplete for OpenRouter-configured clients. Tests were not run (read-only review, dependencies not installed); verification relies on the PR description and code reading.

Files Reviewed (2 files)
  • packages/web-shared/src/lib/ai-gateway/openai-chatgpt/routing.ts
  • packages/web-shared/src/lib/ai-gateway/openai-chatgpt/routing.test.ts

Reviewed by deepseek-flash-latest · Input: 60.7K · Output: 15.2K · Cached: 1.3M

Review guidance: REVIEW.md from base branch main

@joshburt
joshburt self-requested a review October 22, 2026 09:37
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.

2 participants