fix(azure): match the generation, not one release, for max_completion_tokens - #13007
Merged
diegosouzapw merged 1 commit intoSep 10, 2026
Merged
Conversation
…_tokens `azure/gpt-6-astra` fails validation and every request with: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead. `AZURE_COMPLETION_TOKEN_DEPLOYMENT` matched a literal `gpt-5`, so the swap applied to GPT-5 and the o-series and to nothing after them. The requirement belongs to the generation rather than to one release, so every new family arrives broken and needs another patch. Matching the range fixes GPT-6 and whatever follows it in the same edit. The range stops at 19 rather than being a digit-run. Azure's own name for GPT-3.5 is `gpt-35-turbo`, which requires `max_tokens` and would be caught by `gpt-\d+` -- the swap would then break a working deployment, which is worse than the bug. A test pins that, and it is the test that fails if the range is widened. Verified: 10 passed in tests/unit/azure-param-rules.test.ts, and each claim checked by reverting it -- back to the `gpt-5` literal fails only the new-generation test, widening to `gpt-\d+` fails only the gpt-35-turbo test. Closes diegosouzapw#12981
diegosouzapw
merged commit Sep 10, 2026
4edc3d5
into
diegosouzapw:release/v3.8.51
8 of 16 checks passed
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…_tokens (diegosouzapw#13007) Boarded with 13 sibling PRs into one worktree off release/v3.8.51 and validated as a set: 132 focused tests pass across all 15 test files in the batch, typecheck:core is clean, check-changelog-integrity reports no lost base bullets, and check-file-size is green. Your PR merged without conflict against its siblings. Thank you — the write-up made this reviewable: measuring the behaviour on the release tip and showing the before/after table meant the defect could be confirmed rather than taken on faith.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #12981.
azure/gpt-6-astrafails validation and every request:Why
AZURE_COMPLETION_TOKEN_DEPLOYMENTmatched a literalgpt-5:/(?:^|[/_-])(?:gpt-5|o(?:1|3|4))(?:[._-]|$)|^gpt-chat-latest$/iSo the
max_tokens→max_completion_tokensswap covered GPT-5 and the o-series and nothing after them. The requirement is a property of the generation, not of one release —gpt-6-astrarejectsmax_tokensfor exactly the reasongpt-5does — so each new family arrives broken and needs another patch. Matching the range fixes GPT-6 and whatever follows in the same edit.Why a range and not
gpt-\d+Azure's own deployment name for GPT-3.5 is
gpt-35-turbo— no dot. A digit-run matches it, and the swap would then strip themax_tokensthat deployment actually requires. Breaking a working deployment is worse than the bug being fixed, so the range stops at 19:gpt-(?:[5-9]|1\d). That still leaves room for a futuregpt-10.There is a test for exactly that, and it is the test that fails if someone later widens the pattern.
Verification
tests/unit/azure-param-rules.test.ts— 10 passed. Each claim checked by reverting it:gpt-5literalgenerations after GPT-5 convert max_tokens too (#12981)gpt-\d+gpt-35-turbo is not a GPT-3.5 deployment caught by the generation rangeThe pattern lives in one place and has one consumer (
applyAzureParamRules, shared byazure-openaiandazure-ai), so both wire paths pick this up.