Skip to content

fix: bug encountered when using azure gpt-5.5 w/ completions api - #26222

Merged
rekram1-node merged 7 commits into
anomalyco:devfrom
frederiknsgo:fix/gpt-5-5-reasoning-effort
May 14, 2026
Merged

rekram1-node merged 7 commits into
anomalyco:devfrom
frederiknsgo:fix/gpt-5-5-reasoning-effort

Conversation

@frederiknsgo

@frederiknsgo frederiknsgo commented May 7, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #26219

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

This fixes an issue where gpt-5.5 requests fail when routed through /v1/chat/completions.

ProviderTransform.options() automatically adds reasoningEffort for all models matching gpt-5, which also includes gpt-5.5. Some OpenAI-compatible providers reject this parameter on the chat completions endpoint and return a 400 error.

This PR early returns with only reasoningSummary for the azure package with gpt5.5 so reasoningEffort is no longer added automatically for that model.

How did you verify your code works?

I tested this locally using a patched OpenCode build with gpt-5.5 routed through an OpenAI-compatible /v1/chat/completions endpoint.

Before the change, requests failed with:

Function tools with reasoning_effort are not supported for gpt-5.5 in /v1/chat/completions

After excluding gpt-5.5 from the automatic reasoning block, requests completed successfully.

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

@teumaas

teumaas commented May 11, 2026

Copy link
Copy Markdown

@rekram1-node

@frederiknsgo

Copy link
Copy Markdown
Contributor Author

@rekram1-node As discussed on discord, tagging you here

@rekram1-node rekram1-node changed the title fix: avoid sending reasoningEffort for gpt-5.5 fix: bug encountered when using azure gpt-5.5 w/ completions api May 14, 2026
@rekram1-node
rekram1-node merged commit 9675579 into anomalyco:dev May 14, 2026
10 checks passed
Astro-Han added a commit to Astro-Han/pawwork that referenced this pull request Jun 3, 2026
Root cause: ProviderTransform.options() adds reasoningEffort:"medium" to any model whose api id contains "gpt-5" (excluding gpt-5-chat/gpt-5-pro). Azure's gpt-5.5 matched that shared block, but Azure's completions API rejects the reasoningEffort parameter, so every request failed and the provider was unusable.

Change: add an early-return guard before the shared gpt-5 block — for @ai-sdk/azure models whose api id contains "gpt-5.5", set only reasoningSummary:"auto" and return. Scoped to azure gpt-5.5; all other providers/models keep their existing options.

Boundary: only packages/opencode/src/provider/transform.ts (4-line guard) and packages/opencode/test/provider/transform.test.ts (new azure reasoningEffort describe block). No other files touched.

Verification:
- Red->green: with the guard removed the new test fails (reasoningEffort === "medium"); with it, reasoningEffort is undefined and reasoningSummary === "auto".
- Scope-lock tests added per review: azure gpt-5.1 and gpt-5.2 still get reasoningEffort:"medium".
- All 10 required CI checks green (typecheck, unit-opencode/app/desktop/ui, e2e-artifacts, smoke-macos-arm64, analyze-js-ts, dependency-review, dev-dep-audit).
- Local full opencode suite earlier: 3669 pass / 0 fail; turbo typecheck 8/8.

Review follow-ups:
- gemini-code-assist (2 threads, resolved): kept the early return (mirrors upstream, currently safe — trailing blocks are provider-specific and never match azure); added the gpt-5.1/5.2 scope tests it suggested.
- codex review [P2]: ProviderTransform.variants() still returns reasoningEffort entries for azure gpt-5.5 reasoning variants, and session/llm.ts merges the selected variant after options(). So a user who explicitly selects a reasoning-effort variant for azure gpt-5.5 still hits the Azure rejection. This is pre-existing (not a regression here) and the upstream fix has the same scope. Closing it needs a product decision about whether azure gpt-5.5 should expose reasoning-effort controls plus an out-of-scope change at the merge site — deferred.

Residual risk: the variant-selected azure gpt-5.5 path above remains broken (deferred). The non-required windows-advisory check (unit-windows-opencode-server-tools) is red on an unrelated pre-existing #1145 Windows path bug in import.ts (Received "D:\\..." vs expected POSIX path), outside this change's scope; required merge gate is fully green.

Ports upstream anomalyco/opencode#26222 (thanks @frederiknsgo).
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
isaacfinnegan pushed a commit to isaacfinnegan/whispercode that referenced this pull request Jun 15, 2026
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.

GPT-5.5 fails because reasoningEffort is added automatically

3 participants