Skip to content

fix(providers/openai): correct reasoning detection for deployment aliases and third-party model IDs - #88

Merged
ethanndickson merged 1 commit into
coder_2_33from
ethan/openai-reasoning-name-rule
Dec 2, 2026
Merged

ethanndickson merged 1 commit into
coder_2_33from
ethan/openai-reasoning-name-rule

Conversation

@ethanndickson

Copy link
Copy Markdown
Member

Relates to coder/coder#31714

Two problems with the name check on Chat Completions, which I found whilst comparing it against what we had before the sync in #86.

A name with a reasoning marker is still treated as a non-reasoning model if it also contains gpt-3, gpt-4 or chatgpt-. No real model ID I could find matches both patterns, so this only affects made-up names, i.e. Azure deployments. A deployment named chatgpt-5 or gpt-4o-to-gpt-5 gets max_tokens, where before the sync it got max_completion_tokens. To fix, Chat Completions now just checks the reasoning pattern. The Responses path is unchanged.

The oss and computer-use markers also match third-party models, e.g. ByteDance-Seed/Seed-OSS-36B-Instruct and google/gemini-2.5-computer-use-preview-10-2025, which then get max_completion_tokens and lose temperature and top_p on an OpenAI-compatible provider. So oss becomes gpt-oss, and computer-use has to start the name or follow a /.

…ases and third-party model IDs

A Chat Completions model ID that carried a reasoning marker together
with gpt-3, gpt-4 or chatgpt- was treated as a non-reasoning model, so
an Azure OpenAI deployment named chatgpt-5 or gpt-4o-to-gpt-5 was sent
max_tokens. The non-reasoning pattern now applies to the Responses API
only.

The oss and computer-use markers also matched third-party IDs such as
ByteDance-Seed/Seed-OSS-36B-Instruct and
google/gemini-2.5-computer-use-preview-10-2025. They now match gpt-oss,
and computer-use only at the start of the ID or after a slash.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-02T09:13:34.982815Z 2e81519 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 2e815198bd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ethanndickson
ethanndickson merged commit 2286791 into coder_2_33 Dec 2, 2026
7 checks passed
ethanndickson added a commit to coder/coder that referenced this pull request Dec 2, 2026
…names

coder/fantasy#88 lets a reasoning marker win over gpt-3, gpt-4 and
chatgpt- on Chat Completions, so Azure OpenAI deployments named like
chatgpt-5 get max_completion_tokens. It also narrows the oss and
computer-use markers to gpt-oss and a leading computer-use, so they no
longer match third-party model IDs.
ethanndickson added a commit to coder/coder that referenced this pull request Dec 2, 2026
)

Closes #31714
Closes WI-31

Azure OpenAI reasoning models reject `max_tokens`:

```
Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.
```

We pick between `max_tokens` and `max_completion_tokens` from the model
name, and that check only knew names up to `gpt-5`, so a `gpt-6-luna`
deployment failed on default settings. To fix, the fantasy bump
(coder/fantasy#86, coder/fantasy#87 and coder/fantasy#88) extends the
check to `gpt-6` through `gpt-9`. That bump is a full sync with
upstream, so it also brings the other chatd changes listed there, which
is why a few test expectations move here.

On Azure that name is the deployment name though, which doesn't have to
say what model it serves. So the model form now also shows the existing
Reasoning Model setting for Azure models, and we obey it. With it on, we
send `max_completion_tokens` and drop `temperature` and `top_p`,
whatever the deployment is called.

I confirmed against a real Azure `gpt-5.4` deployment that it rejects
`max_tokens` and accepts `max_completion_tokens`, but that test resource
has since gone, so I haven't run this exact change against Azure.

This only fixes the `max_tokens` error. Going by [Microsoft's
docs](https://learn.microsoft.com/en-us/azure/foundry/openai/how-to/reasoning),
I think GPT-6 chats on Azure will then hit a second error, as on Chat
Completions those models only accept tools with the reasoning effort set
to `none`, or not at all. The OpenAI and Bedrock providers use the
Responses API, so they aren't affected. I can't reproduce that for the
same reason, so it's being tracked separately at
[CODAGT-1655](https://linear.app/codercom/issue/CODAGT-1655).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant