Repository navigation
fix(cli): gate OpenAI-only reasoning effort tiers to gpt-5 family #13563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
maphew
wants to merge
30
commits into
Kilo-Org:main
Choose a base branch
from
maphew:fix/reasoning-effort-variants-non-openai
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
37be46d
fix(cli): gate OpenAI-only reasoning effort tiers to gpt-5 family
maphew 5bc05ff
fix(cli): extract gpt-5 tier gate to Kilo mirror, cover hyphen-prefix…
maphew ee7eff3
fix(cli): exempt native Azure from gpt-5 tier gate, drop stray marker
maphew 2fd2735
test(cli): widen timeouts for flaky prompt tests on loaded CI
maphew 143a595
test(cli): annotate test timeout changes with kilocode_change markers
maphew 22d75a3
fix(cli): gate custom-provider fallback rollout tiers to gpt-5 family
maphew 97db666
fix(cli): treat providerID openai as first-party, drop unrelated time…
maphew ff8ed58
Merge branch 'main' into fix/reasoning-effort-variants-non-openai
WebReflection a1e6d4a
Merge upstream/main into fix/reasoning-effort-variants-non-openai
maphew 4ef3287
Merge remote-tracking branch 'upstream/main' into fix/reasoning-effor…
maphew f0b445b
fix(cli): respect effective endpoint in first-party reasoning-tier ex…
maphew 835cb35
fix(cli): annotate variants signature for upstream check
maphew 6ec820f
Merge upstream/main into fix/reasoning-effort-variants-non-openai
maphew 27ee94b
Merge remote-tracking branch 'upstream/main' into fix/reasoning-effor…
maphew b2d7b7d
Merge upstream/main into fix/reasoning-effort-variants-non-openai
maphew 0044cca
Merge remote-tracking branch 'upstream/main' into fix/reasoning-effor…
maphew 7a60c95
fix(provider): gate reasoning tiers when the endpoint cannot be parsed
maphew 5467fc4
Merge remote-tracking branch 'upstream/main' into fix/reasoning-effor…
maphew 4a7063d
Merge remote-tracking branch 'upstream/main' into fix/reasoning-effor…
maphew 308ff6c
Merge remote-tracking branch 'upstream/main' into fix/reasoning-effor…
maphew 4cc27a7
Merge branch 'main' into fix/reasoning-effort-variants-non-openai
maphew 892dd10
Merge remote-tracking branch 'upstream/main' into fix/reasoning-effor…
maphew fdc2e1b
Merge remote-tracking branch 'origin/fix/reasoning-effort-variants-no…
maphew 8446c84
Merge remote-tracking branch 'upstream/main' into fix/reasoning-effor…
maphew d880cf7
chore(ci): retrigger checks after unrelated serve IPv6 timing failure
maphew d9f900c
Merge remote-tracking branch 'upstream/main' into fix/reasoning-effor…
maphew ce4e577
chore(ci): retrigger unit tests after runner timing failures
maphew 7169315
Merge remote-tracking branch 'upstream/main' into fix/reasoning-effor…
maphew ea60807
Merge remote-tracking branch 'upstream/main' into fix/reasoning-effor…
maphew ed3d4e8
Merge upstream/main into fix/reasoning-effort-variants-non-openai
maphew File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@kilocode/cli": patch | ||
| --- | ||
|
|
||
| Stop offering OpenAI-only `none`/`xhigh` reasoning-effort variants for non-OpenAI models routed through the OpenAI provider npm (e.g. Grok on an OpenAI-compatible base URL), which the upstream provider rejects with a 400. Only gpt-5-family models now receive the rollout-gated tiers. |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| // Kilo-specific reasoning-effort gate for shared ProviderTransform. | ||
| // | ||
| // OpenAI rolled out the `none` and `xhigh` reasoning_effort tiers on fixed | ||
| // dates. Only gpt-5-family models accept them: non-OpenAI models routed | ||
| // through @ai-sdk/openai on a compatible base URL (e.g. Grok via api.x.ai) | ||
| // reject them, which surfaced as offering an unusable `xhigh` variant | ||
| // (issue #13342). | ||
|
|
||
| const GPT5_FAMILY_PREFIX_RE = /(?:^|\/|\.|-)gpt-5(?:[.-]|$)/ | ||
|
|
||
| /** | ||
| * True when the model id is a gpt-5 family member that may receive OpenAI's | ||
| * rollout-gated reasoning tiers (`none`, `xhigh`). | ||
| * | ||
| * Matches bare ("gpt-5.5"), slash-prefixed ("openai/gpt-5.6"), dot-prefixed | ||
| * ("openai.gpt-5.5", Bedrock Mantle), and hyphen-prefixed deployment ids | ||
| * ("azure-openai--gpt-5.4", SAP AI Core) while still excluding lookalikes | ||
| * such as "gpt-50" and "gpt-5o". | ||
| */ | ||
| export function gpt5FamilyReasoningTiers(id: string) { | ||
| return GPT5_FAMILY_PREFIX_RE.test(id.toLowerCase()) | ||
| } | ||
|
|
||
| type EndpointModel = { | ||
| providerID: string | ||
| api: { url?: string } | ||
| options?: Record<string, unknown> | ||
| } | ||
|
|
||
| /** | ||
| * True when providerID "openai" genuinely serves first-party OpenAI models. | ||
| * A baseURL override to a third party (e.g. xAI) under that id serves | ||
| * non-OpenAI models that reject the rollout-gated tiers (issue #13342), so the | ||
| * exemption follows the effective endpoint, not the id alone. Model options | ||
| * shadow provider options, matching resolveSDK/getModel precedence; with no | ||
| * endpoint information the first-party default is preserved for forward | ||
| * compatibility. | ||
| */ | ||
| export function isFirstPartyOpenAIEndpoint(model: EndpointModel, options: Record<string, unknown>): boolean { | ||
| if (model.providerID !== "openai") return false | ||
| const override = | ||
| model.options?.["providerEndpointOverride"] ?? | ||
| model.options?.["endpoint"] ?? | ||
| model.options?.["baseURL"] ?? | ||
| options["providerEndpointOverride"] ?? | ||
| options["endpoint"] ?? | ||
| options["baseURL"] | ||
| const endpoint = typeof override === "string" && override !== "" ? override : model.api.url | ||
| if (typeof endpoint !== "string" || endpoint === "") return true | ||
| let host: string | ||
| try { | ||
| host = new URL(endpoint).hostname.toLowerCase() | ||
| } catch { | ||
| // A configured but unexpanded endpoint ({env:...}, ${...}) cannot be | ||
| // proven first-party. Gate conservatively: offering tiers the endpoint may | ||
| // reject is worse than omitting tiers a first-party endpoint would accept. | ||
| return false | ||
| } | ||
| return host === "openai.com" || host.endsWith(".openai.com") | ||
| } |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WARNING: The gate is bypassed by the custom-provider fallback for non-gpt-5 ids
customProviderVariants()(packages/opencode/src/kilocode/provider/provider.ts) callsProviderTransform.variants()and, when the heuristics return{}, falls back toFALLBACK_EFFORTS = ["none", "low", "medium", "high", "xhigh", "max"]for@ai-sdk/openai. Several ids are short-circuited byvariants()before reaching this gate —qwen*,deepseek-*,minimax*,glm*,kimi*,big-pickle(theid.includes("qwen")block invariants()) — so a custom OpenAI-compatible provider using one of those ids still advertisesnone/xhigh, the same unsupported-tier shape as #13342. The existingpackages/opencode/test/kilocode/provider-reasoning-options.test.tscases assert exactly this fallback (["none","low","medium","high","xhigh","max"]forqwen-customon@ai-sdk/openai). The new regression tests callProviderTransform.variants()directly, so they do not cover this path. Consider gating the fallback for@ai-sdk/openaito the widely supported set unless the id is gpt-5 family, or documenting the exception with a regression test.Reply with
@kilocode-bot fix itto have Kilo Code address this issue.