Skip to content

fix(cli): gate OpenAI-only reasoning effort tiers to gpt-5 family - #13563

Open
maphew wants to merge 25 commits into
Kilo-Org:mainfrom
maphew:fix/reasoning-effort-variants-non-openai
Open

maphew wants to merge 25 commits into
Kilo-Org:mainfrom
maphew:fix/reasoning-effort-variants-non-openai

Conversation

@maphew

@maphew maphew commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #13342

What

openaiReasoningEfforts() in packages/opencode/src/provider/transform.ts handed out OpenAI's rollout-gated reasoning tiers — none (rolled out 2025-11-13) and xhigh (rolled out 2025-12-04) — to any model whose release date is new enough, regardless of whether it is actually a gpt-5-family model. Non-OpenAI models routed through @ai-sdk/openai on an OpenAI-compatible base URL (e.g. Grok via api.x.ai, the config shape the maintainer workaround in #13082 recommends) were therefore offered an xhigh variant they cannot honor, and selecting it failed with invalid xai provider options (the AI SDK's zod validation rejecting reasoning_effort: "xhigh").

Change

The gpt-5 family gate lives in a Kilo mirror (src/kilocode/provider/transform.ts) per the fork-merge policy; the shared upstream file keeps a single marked gpt5FamilyReasoningTiers(id) call and a marked import. The family check accepts 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 like gpt-50 / gpt-5o. Non-gpt-5 ids get only the widely-supported low/medium/high set — matching what the bundled @ai-sdk/xai provider already exposes for Grok.

All existing gpt-5 / o-series / azure / mantle / SAP variant expectations are preserved (the shared transform.test.ts suite passes, including the openai.gpt-5.5 Mantle case that still receives none/xhigh).

Why this scope

Scanned the issue space before picking this: #13342 is unaddressed (no PR), and a search for related reasoning-effort PRs found no intersections. The same class of mis-offering exists in openaiCompatibleReasoningEfforts() for @ai-sdk/gateway, but that path is deliberately tested to expose the full OpenAI set (Cloudflare's gateway translates reasoning_effort upstream), so it is intentionally left unchanged to avoid a behavioral regression on the gateway's contract.

Verification

  • Regression tests live in test/kilocode/provider/transform.test.ts (Kilo-owned path), failing before the fix and passing after:
    • grok-4.6 via @ai-sdk/openai with a post-cutoff release date → only low/medium/high.
    • unknown reasoning model on the OpenAI npm → only low/medium/high.
    • lookalikes gpt-50 / gpt-5o excluded.
    • openai.gpt-5.5 (Mantle) and azure-openai--gpt-5.4 (SAP) still receive none/xhigh.
  • bun test ./test/kilocode/provider/transform.test.ts → 5 pass; bun test ./test/provider/transform.test.ts → 422 pass.
  • bun run typecheck (opencode) → clean.
  • bun run script/check-opencode-annotations.ts --worktree → clean.
  • Changeset included (patch).

Note on CI

The JetBrains typecheck in the pre-push hook could not run in the sandbox (no Java 21 / SDKMAN available); it is unrelated to these opencode-only changes. test/provider/provider.test.ts shows 3 pre-existing failures (defaultModel / opencode loader resolve to the Kilo gateway kilo-auto/efficient model instead of a direct provider) that are unrelated to this diff.

@maphew
maphew marked this pull request as ready for review August 28, 2026 21:23
@kilo-code-bot

kilo-code-bot Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

This revision (7a60c95) addresses the last open finding: an unparseable/unevaluated endpoint override (e.g. https://{env:XAI_HOST}/v1) now returns false from isFirstPartyOpenAIEndpoint, so a rerouted openai provider with a non-gpt-5 id stays on low/medium/high instead of being treated as first-party. The no-endpoint and empty-string cases still default to first-party, and gpt-5-family ids keep none/xhigh regardless, so no first-party regression.

Files Reviewed (7 files)
  • .changeset/grok-xhigh-effort-gate.md - no issues
  • packages/opencode/src/kilocode/provider/provider.ts - no issues (fallback gating verified)
  • packages/opencode/src/kilocode/provider/transform.ts - no issues (conservative unparseable-endpoint fallback verified)
  • packages/opencode/src/provider/provider.ts - no issues (endpoint-aware re-derivation verified)
  • packages/opencode/src/provider/transform.ts - no issues (gpt-5 gate call and annotation-only signature change)
  • packages/opencode/test/kilocode/provider-reasoning-options.test.ts - no issues
  • packages/opencode/test/kilocode/provider/transform.test.ts - no issues (regression test covers the newly gated placeholder case)
Previous Review Summaries (10 snapshots, latest commit 835cb35)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 835cb35)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/opencode/src/kilocode/provider/transform.ts 55 An unparseable baseURL override is treated as first-party, so a rerouted openai provider with an env-substituted endpoint (e.g. https://${XAI_HOST}/v1, expanded only later in resolveSDK) still offers none/xhigh for non-gpt-5 ids.
Files Reviewed (7 files)
  • .changeset/grok-xhigh-effort-gate.md - no issues
  • packages/opencode/src/kilocode/provider/provider.ts - no issues (fallback gate verified for @ai-sdk/openai non-gpt-5 ids)
  • packages/opencode/src/kilocode/provider/transform.ts - 1 SUGGESTION (carried forward, unchanged in this revision)
  • packages/opencode/src/provider/provider.ts - no issues (endpoint-aware re-derivation verified)
  • packages/opencode/src/provider/transform.ts - no issues (this revision is annotation/reformat only; kilocode_change markers added around the variants signature)
  • packages/opencode/test/kilocode/provider-reasoning-options.test.ts - no issues
  • packages/opencode/test/kilocode/provider/transform.test.ts - no issues

Fix these issues in Kilo Cloud

Previous review (commit f0b445b)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/opencode/src/kilocode/provider/transform.ts 55 An unparseable baseURL override is treated as first-party, so a rerouted openai provider with an env-substituted endpoint (e.g. https://${XAI_HOST}/v1, expanded only later in resolveSDK) still offers none/xhigh for non-gpt-5 ids.
Files Reviewed (7 files)
  • .changeset/grok-xhigh-effort-gate.md - no issues
  • packages/opencode/src/kilocode/provider/provider.ts - no issues (fallback gate verified for @ai-sdk/openai non-gpt-5 ids)
  • packages/opencode/src/kilocode/provider/transform.ts - 1 SUGGESTION
  • packages/opencode/src/provider/provider.ts - no issues (endpoint-aware re-derivation verified)
  • packages/opencode/src/provider/transform.ts - no issues (previous providerID-vs-endpoint finding now addressed)
  • packages/opencode/test/kilocode/provider-reasoning-options.test.ts - no issues
  • packages/opencode/test/kilocode/provider/transform.test.ts - no issues

Fix these issues in Kilo Cloud

Previous review (commit 97db666)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/provider/transform.ts 1115 First-party bypass keys off providerID (model.providerID === "openai"), but the endpoint is set by the overridable baseURL. A config that keeps the openai provider id while pointing options.baseURL at an OpenAI-compatible endpoint (documented in packages/kilo-docs/pages/code-with-ai/agents/custom-models.md, the #13342 shape) yields providerID === "openai" with a non-gpt-5 api.id such as grok-4.6, so the gate is skipped and none/xhigh are offered again. Key first-party detection on model.api.url or the model family instead.
Files Reviewed (6 files)
  • .changeset/grok-xhigh-effort-gate.md - no issues
  • packages/opencode/src/kilocode/provider/provider.ts - fallback gate verified, no issues
  • packages/opencode/src/kilocode/provider/transform.ts - new Kilo mirror, no issues
  • packages/opencode/src/provider/transform.ts - 1 WARNING
  • packages/opencode/test/kilocode/provider-reasoning-options.test.ts - no issues
  • packages/opencode/test/kilocode/provider/transform.test.ts - no issues

Fix these issues in Kilo Cloud

Previous review (commit b132952)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/provider/transform.ts 1115 First-party bypass keys off providerID (model.providerID === "openai"), but the endpoint is set by the overridable baseURL. A config that keeps the openai provider id while pointing baseURL at an OpenAI-compatible endpoint (e.g. https://api.x.ai, the #13342 shape) skips the gate and offers none/xhigh again. Key first-party detection on model.api.url or the model family instead.
Files Reviewed (6 files)
  • .changeset/grok-xhigh-effort-gate.md - no issues
  • packages/opencode/src/kilocode/provider/provider.ts - fallback gate verified, no issues
  • packages/opencode/src/kilocode/provider/transform.ts - new Kilo mirror, no issues
  • packages/opencode/src/provider/transform.ts - 1 WARNING
  • packages/opencode/test/kilocode/provider-reasoning-options.test.ts - no issues
  • packages/opencode/test/kilocode/provider/transform.test.ts - no issues

Fix these issues in Kilo Cloud

Previous review (commit cbe4d89)

Status: No Issues Found | Recommendation: Merge

The previously reported fallback bypass is resolved by cbe4d892: customProviderVariants() now caps the @ai-sdk/openai fallback to low/medium/high for non-gpt-5 ids while keeping the full set for gpt-5-family ids, with regression coverage added.

Files Reviewed (2 files)
  • packages/opencode/src/kilocode/provider/provider.ts - fix verified, no new issues
  • packages/opencode/test/kilocode/provider-reasoning-options.test.ts - coverage added for the gated and gpt-5 paths

Previous review (commit 6a42873)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/provider/transform.ts 712 New gpt-5 gate is bypassed by the custom-provider fallback for qwen/deepseek/minimax/glm/kimi ids
Files Reviewed (2 files)
  • packages/opencode/test/session/prompt.test.ts - no new issues (kilocode_change marker annotations only)
  • packages/opencode/src/provider/transform.ts - 1 issue (carried, re-verified at HEAD)

Fix these issues in Kilo Cloud

Previous review (commit 869f0ba)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/provider/transform.ts 712 New gpt-5 gate is bypassed by the custom-provider fallback for qwen/deepseek/minimax/glm/kimi ids
Files Reviewed (5 files)
  • .changeset/grok-xhigh-effort-gate.md
  • packages/opencode/src/kilocode/provider/transform.ts
  • packages/opencode/src/provider/transform.ts - 1 issue
  • packages/opencode/test/kilocode/provider/transform.test.ts
  • packages/opencode/test/session/prompt.test.ts

Fix these issues in Kilo Cloud

Previous review (commit b93b74d)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (3 files)
  • packages/opencode/src/kilocode/provider/transform.ts
  • packages/opencode/src/provider/transform.ts
  • packages/opencode/test/kilocode/provider/transform.test.ts

Previous review (commit 5f2740e)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (4 files)
  • .changeset/grok-xhigh-effort-gate.md
  • packages/opencode/src/kilocode/provider/transform.ts
  • packages/opencode/src/provider/transform.ts
  • packages/opencode/test/kilocode/provider/transform.test.ts

Previous review (commit ba4a8dc)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (3 files)
  • .changeset/grok-xhigh-effort-gate.md
  • packages/opencode/src/provider/transform.ts
  • packages/opencode/test/provider/transform.test.ts

Reviewed by deepseek-flash-latest · Input: 59.8K · Output: 5.8K · Cached: 382.6K

Review guidance: REVIEW.md from base branch main

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ba4a8dc686

ℹ️ 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".

Comment thread packages/opencode/src/provider/transform.ts Outdated
Comment thread packages/opencode/src/provider/transform.ts Outdated

maphew commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

Addressed both Codex review points in 5f2740e:

  • P1 (extract to Kilo mirror): moved the gpt-5 family gate (regex + helper) into src/kilocode/provider/transform.ts and reduced the shared src/provider/transform.ts change to a single marked gpt5FamilyReasoningTiers(id) call plus the marked import. Regression tests moved out of the shared test/provider/transform.test.ts into test/kilocode/provider/transform.test.ts, so the shared file returns to its upstream shape (the diff there is now a pure deletion of the previously-inlined Kilo tests).
  • P2 (hyphen-prefixed deployment ids): GPT5_FAMILY_PREFIX_RE now also accepts a - prefix boundary, so SAP AI Core deployment ids like azure-openai--gpt-5.4 still receive their none/xhigh tiers instead of being collapsed to low/medium/high. Added a regression test for that exact id form.

Verification: test/kilocode/provider/transform.test.ts (5 tests) and the shared test/provider/transform.test.ts (422 tests) pass; opencode typecheck and check-opencode-annotations.ts --worktree are clean.

maphew commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-08-29T03:41:34.664542Z 5f2740e 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.

maphew commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

Merge-readiness check complete:

  • Both Codex review findings addressed (gate extracted to src/kilocode/provider/transform.ts in 5f2740e; hyphen-prefixed deployment ids covered).
  • Branch synced with main (0 behind), no merge conflicts.
  • CI green (all checks pass); fresh Codex review re-triggered.
  • Typecheck + regression tests verified locally.

Ready for human review.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5f2740eddc

ℹ️ 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".

Comment thread packages/opencode/src/kilocode/provider/transform.ts Outdated
Comment thread packages/opencode/src/provider/transform.ts Outdated

maphew commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up: the Codex re-review findings were addressed in b93b74d (removed stray marker from the kilo-owned file; native Azure now passes isFirstPartyOpenAI so opaque deployment/model keys keep none/xhigh). CI is green again and no new findings from the re-review. Still blocked only on a human approval.

maphew commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Merge-readiness sweep complete: branch synced with current main (ffc0655, 0 behind), no merge conflicts, CI green on the latest head. Ready for human review.

@WebReflection

Copy link
Copy Markdown
Contributor

Review finding: the new GPT-5 gate is bypassed for custom model IDs whose heuristics return {} (for example qwen/deepseek/minimax/glm/kimi), after which customProviderVariants() still exposes none/xhigh for @ai-sdk/openai. Please gate that fallback or add an explicit exception and regression test; otherwise the same unsupported-tier 400 can still occur. CI is otherwise green.

@maphew
maphew force-pushed the fix/reasoning-effort-variants-non-openai branch from 0892f59 to 869f0ba Compare September 27, 2026 11:08
// kilocode_change start - `none`/`xhigh` are OpenAI rollout tiers only gpt-5-family
// models accept; non-OpenAI models on an OpenAI-compatible base URL (e.g. Grok
// via api.x.ai) reject them (issue #13342). See gpt5FamilyReasoningTiers.
if (!isFirstPartyOpenAI && !gpt5FamilyReasoningTiers(id)) return WIDELY_SUPPORTED_EFFORTS

Copy link
Copy Markdown
Contributor

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) calls ProviderTransform.variants() and, when the heuristics return {}, falls back to FALLBACK_EFFORTS = ["none", "low", "medium", "high", "xhigh", "max"] for @ai-sdk/openai. Several ids are short-circuited by variants() before reaching this gate — qwen*, deepseek-*, minimax*, glm*, kimi*, big-pickle (the id.includes("qwen") block in variants()) — so a custom OpenAI-compatible provider using one of those ids still advertises none/xhigh, the same unsupported-tier shape as #13342. The existing packages/opencode/test/kilocode/provider-reasoning-options.test.ts cases assert exactly this fallback (["none","low","medium","high","xhigh","max"] for qwen-custom on @ai-sdk/openai). The new regression tests call ProviderTransform.variants() directly, so they do not cover this path. Consider gating the fallback for @ai-sdk/openai to the widely supported set unless the id is gpt-5 family, or documenting the exception with a regression test.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@WebReflection

Copy link
Copy Markdown
Contributor

Follow-up review at 6a42873955. The direction is right. These are the changes needed to land it:

  1. The fallback bypass is still open. The Sep 18 finding hasn't changed. qwen*, deepseek-*, minimax*, glm*, kimi* and big-pickle ids make variants() return {}. After that, customProviderVariants() (src/kilocode/provider/provider.ts) exposes FALLBACK_EFFORTS, which includes none/xhigh/max, for @ai-sdk/openai. That is the same 400 as [VS Code] Grok 4.6 with xhigh reasoning returns "invalid xai provider options" #13342. Pick one fix:

    • Preferred: for @ai-sdk/openai, cap the fallback to low/medium/high unless gpt5FamilyReasoningTiers(model.api.id) passes. Then update the qwen-custom case in test/kilocode/provider-reasoning-options.test.ts.
    • Or keep the broad fallback on purpose, state that in the PR description, and add a test that pins it.
  2. Forward-compat regression on first-party OpenAI. Only native Azure passes isFirstPartyOpenAI. So providerID: "openai" now goes through a gpt-5-only allowlist too. Before this PR, a future post-cutoff model like gpt-6 or o5 got none/xhigh from the release-date logic. With the PR, it silently drops to low/medium/high until someone edits the regex. Suggest also treating providerID === "openai" as first-party (or keying off the transport), so the gate only hits OpenAI-compatible third parties like Grok/xAI. Please add a test for a hypothetical gpt-6 on openai.

  3. Scope. The test/session/prompt.test.ts timeout bumps are unrelated to [VS Code] Grok 4.6 with xhigh reasoning returns "invalid xai provider options" #13342, and they add kilocode_change markers to a shared upstream test. Please move them to a separate PR, or drop them if main is no longer flaky.

With 1 and 2 fixed and 3 split out, this looks good to merge from my side. CI is green, and the branch is 6 commits behind main with no conflicts.

@github-actions github-actions Bot added area:cli CLI, TUI and core engine community Opened by someone outside the Kilo team needs-triage Waiting for a maintainer to look labels Oct 8, 2026
@WebReflection

Copy link
Copy Markdown
Contributor

Re-checked at d5cdfd2992. Thanks for the fallback fix, point 1 ✅. Two items remain before I can approve:

  1. First-party OpenAI forward-compat is still reproducible. On providerID: "openai" with a post-cutoff release_date, gpt-6 and o5 return low/medium/high on this branch but none/low/medium/high/xhigh on main. Please treat providerID === "openai" as first-party, as you already do for native Azure (isFirstPartyOpenAI), so the gate only affects third-party OpenAI-compatible endpoints like xAI. Please also add a gpt-6-on-openai regression test in test/kilocode/provider/transform.test.ts.
  2. Scope: please drop the test/session/prompt.test.ts timeout changes from this PR. They're unrelated to [VS Code] Grok 4.6 with xhigh reasoning returns "invalid xai provider options" #13342 and touch a shared upstream file.

I'm happy to approve once those land and CI is green.

@maphew
maphew force-pushed the fix/reasoning-effort-variants-non-openai branch from d5cdfd2 to b132952 Compare October 11, 2026 04:53
const efforts = openaiReasoningEfforts(model.api.id, model.release_date)
// kilocode_change start - providerID "openai" serves first-party OpenAI models, so a post-cutoff
// id like gpt-6 keeps rollout tiers via release-date logic instead of collapsing to low/medium/high
const efforts = openaiReasoningEfforts(model.api.id, model.release_date, model.providerID === "openai")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: The first-party bypass keys off providerID, but the endpoint is chosen by baseURL

This bypass treats providerID === "openai" as a first-party OpenAI transport. The actual endpoint, however, is determined by the provider's baseURL, which is user-overridable (documented in packages/kilo-docs/pages/code-with-ai/agents/custom-models.md). A config that keeps the openai provider id but points baseURL at an OpenAI-compatible endpoint (e.g. https://api.x.ai) yields providerID === "openai" with a non-OpenAI api.id such as grok-4.6, so the gate is skipped and none/xhigh are offered again - the exact #13342 failure. Consider keying first-party detection on the endpoint host (model.api.url) or on the model family, rather than on the provider id.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@github-actions github-actions Bot added needs-review and removed needs-triage Waiting for a maintainer to look labels Oct 12, 2026
@maphew
maphew force-pushed the fix/reasoning-effort-variants-non-openai branch from b132952 to 97db666 Compare October 13, 2026 20:16
@WebReflection

Copy link
Copy Markdown
Contributor

Remaining before merge: the first-party exemption must respect the effective endpoint, not just providerID === "openai". Overriding options.baseURL to xAI under that ID still offers unsupported none/xhigh for non-GPT models. Please fix this and add a regression test, preserving genuine first-party forward compatibility. Checking model.api.url alone is insufficient because baseURL overrides it. The earlier fallback bypass is fixed.

@github-actions github-actions Bot added awaiting-contributor Waiting for the contributor to reply priority:p1 High: fixes and regressions. Set from the title. Change by hand. and removed needs-review labels Oct 16, 2026
host = new URL(endpoint).hostname.toLowerCase()
} catch {
// Unexpanded config placeholders ({env:...}, ${...}) cannot be judged.
return true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: Unparseable endpoint overrides still fall back to the first-party exemption

When the effective endpoint cannot be parsed as an absolute URL, this returns true (first-party), so the rollout-gated tiers are kept. resolveSDK expands ${VAR} references in baseURL from the environment after provider variants are built (packages/opencode/src/provider/provider.ts:1897), so a rerouted openai provider whose baseURL is an env-substituted host (e.g. https://${XAI_HOST}/v1) is judged first-party here and keeps offering none/xhigh for a non-gpt-5 id - the #13342 shape this PR fixes. If the intent is to avoid offering tiers the endpoint may reject, consider treating a present-but-unparseable override as non-first-party, and defaulting to first-party only when no override is configured at all.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@github-actions github-actions Bot added needs-triage Waiting for a maintainer to look and removed awaiting-contributor Waiting for the contributor to reply labels Oct 19, 2026
@maphew

maphew commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

Review finding addressed in 7a60c95: an unparseable non-empty endpoint override (e.g. https://{env:XAI_HOST}/v1) now returns false from isFirstPartyOpenAIEndpoint, so non-gpt-5 ids stay gated to low/medium/high instead of being assumed first-party. Added a regression test that exercises the URL-parse failure path. The no-endpoint case still defaults to first-party for forward compatibility. bun test ./test/kilocode/provider/transform.test.ts ./test/kilocode/provider-reasoning-options.test.ts (30 pass) and bun run typecheck are green.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:cli CLI, TUI and core engine community Opened by someone outside the Kilo team needs-triage Waiting for a maintainer to look priority:p1 High: fixes and regressions. Set from the title. Change by hand.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[VS Code] Grok 4.6 with xhigh reasoning returns "invalid xai provider options"

2 participants