anomalyco / anomalyco/opencode

Model-ID version gate excludes dotless IDs, so gpt-6-astra is treated as older than gpt-5.5

Open
#48,247 2 comments 0 reactions 1 assignee View on GitHub

@neriousy is already working on this.

Since Sep 9, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

packages/opencode/src/provider/transform.ts:1331 reads a model's version with a regex that requires a dotted minor:

const [, gptMajorVersion, gptMinorVersion] = input.model.api.id.match(/gpt-(\d+)\.(\d+)/) ?? []
const isGpt55OrNewer = Number(gptMajorVersion) > 5 || (Number(gptMajorVersion) === 5 && Number(gptMinorVersion) >= 5)

gpt-6-astra has no dotted minor, so the match fails and Number(undefined) > 5 evaluates NaN > 5. A GPT-6 model reports isGpt55OrNewer === false. gpt-5-pro fails the same regex.

The only consumer of that flag is the Azure early-return at :1333-1338, and the comment above it says "Any gpt version above 5.4 in combination with azure does not support reasoningEffort". So on Azure + useCompletionUrls, GPT-6 currently gets reasoningEffort: "medium" set precisely where the code intends to skip it.

Separately at :1340, "gpt-6-astra".includes("gpt-5") is false, so that block is skipped and textVerbosity: "low" never applies.

gpt-6-astra    regexMatch=false  isGpt55OrNewer=false  entersBlock1340=false
gpt-5.6-luna   regexMatch=true   isGpt55OrNewer=true   entersBlock1340=true
gpt-5-pro      regexMatch=false  isGpt55OrNewer=false  entersBlock1340=true
Suggested fix

Correcting the regex alone is safe and fixes the Azure path. Version-gating :1340 naively is not — the block contains four interlocking substring tests, and today gpt-6-pro / gpt-6-chat / gpt-6-codex are excluded only as a side effect of the outer includes("gpt-5") being false. Generalize just the outer test and they all fall in while includes("gpt-5-pro") and includes("gpt-5-chat") stay false:

  • gpt-6-proreasoningEffort: "medium", but OPENAI_GPT5_PRO_EFFORTS = ["high"] at :577 — an out-of-range effort rather than a lost optimization.
  • gpt-6-chat → reasoning params on a model the file deliberately treats as non-reasoning (gpt5ChatReasoningEfforts returns [] at :619).

All four tests need to move together, or none.

Note also that fixing the regex does not by itself restore textVerbosity for Astra: :1359 gates on includes("gpt-5."), and "gpt-6-astra" does not contain that either. And includes("gpt-5.") currently means "has an explicit minor" — generalizing it so a minor-less GPT-6 id qualifies is a deliberate behavior change worth arguing separately.

Rather than adding a second parser, this file already has anchored helpers at :594-609 used by variants():

const GPT5_FAMILY_RE = /(?:^|\/)gpt-5(?:[.-]|$)/
const GPT5_VERSION_RE = /(?:^|\/)gpt-5[.-](\d+)(?:[.-]|$)/
const GPT5_PRO_RE = /(?:^|\/)gpt-5[.-]?pro(?:[.-]|$)/

options() is the odd one out, hand-rolling substring tests and an unanchored inline regex. Generalizing those helpers to be family-agnostic and reusing them in options() seems like the right shape. The (?:^|\/) anchors matter — a bare /gpt-(\d+)/ reads gpt-50 as major 50.

Any test matrix should include gpt-6-pro, gpt-6-chat, gpt-6-codex, and gpt-50, since those are exactly the ids a partial fix breaks.

Plugins

@cortexkit/opencode-anthropic-auth@1.22.0, @cortexkit/opencode-openai-auth@0.7.1, oh-my-opencode-slim@2.2.11, @cortexkit/opencode-magic-context@0.41.4, @cortexkit/aft-opencode@0.55.1, opencode-copilot-delegate@0.12.1, @fro.bot/systematic@3.16.5

OpenCode version

1.18.29, confirmed present at v1.18.30

Steps to reproduce
  1. Pick a model ID with no dotted minor — gpt-6-astra or gpt-5-pro.
  2. Evaluate the conditions at transform.ts:1331 and :1340 against it.
  3. isGpt55OrNewer is false for GPT-6, so the Azure early-return at :1333 sets reasoningEffort: "medium" where the comment says it should not.
  4. The :1340 block is skipped, so textVerbosity: "low" never applies.
  5. Repeat with gpt-5.6-luna — both pass.
Screenshot and/or share link

n/a

Operating System

macOS 15.7.9 (arm64)

Terminal

Ghostty

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.