Skip to content

fix(opencode): accept OpenCode release ranges for launch-time model selection - #33307

Merged
nwparker merged 1 commit into
mainfrom
nwparker/agint-opencode-model-version-gate
Oct 24, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/agint-opencode-model-version-gate

Conversation

@nwparker

@nwparker nwparker commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​29 $\color{#cf222e}{\Huge{\mathbf{−}}}$​21 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​8
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​26 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​20

ELI5

When you pick a model for an OpenCode terminal or worker, Orca first checks that the installed OpenCode can actually use it. That check only trusted three exact releases: 1.18.30, 1.18.32 and 2.0.16. Every newer OpenCode, including the current 1.19.4 and 2.1.4, got capability_unsupported: The execution host cannot verify this OpenCode model launch. This change replaces the three exact releases with a minimum version for each major.

Root cause

src/main/opencode/opencode-model-version-policy.ts had a Set(['1.18.30', '1.18.32']) for the 1.x --model route, and opencode-model-startup-plan.ts had a hard-coded version !== '2.0.16' for the 2.x config-overlay route. Neither route depends on anything that changed in upstream after those releases:

  • 1.x --model route (passes --model, after checking the model with opencode models). Comparing upstream v1.18.30 with v1.19.4, packages/opencode/src/cli/cmd/models.ts and packages/tui/src/context/local.tsx (args.model handling, :198) have no diff. packages/opencode/src/cli/cmd/tui.ts:81 (--model) changed only for the updater (#54409/#54904).

  • 2.x config-overlay route (serve probe, OPENCODE_CONFIG_CONTENT overlay, --standalone). The code Orca relies on is the same from v2.0.14 through v2.1.4 and dev:

    • agent.list still returns the selected default agent first (packages/core/src/agent.ts:124 at v2.0.14, :103 at v2.1.4/dev).
    • /api/model/default is still served (packages/protocol/src/groups/model.ts:26).
    • serve still prints server listening on (packages/cli/src/server-process.ts:163).
    • The --standalone flag is still there (packages/cli/src/commands/commands.ts:16).

    The parser comment claiming "newer source has a different order" was out of date, so this PR corrects it.

About #26683's "1.18.35 is too old" question: the main test that calls 1.18.35 too old (acp-structured-launch-resolution-opencode.test.ts:279) is for the opencode2 ACP provider, whose minimum is 2.0.14. It has nothing to do with this model gate, so it is not a conflict.

What changed

  • isVerifiedOpenCodeLegacyModelVersion: accepts stable 1.x >= 1.18.30 (the previous floor).
  • New isVerifiedOpenCodeConfigModelVersion: accepts stable 2.x >= 2.0.14, the same floor as the opencode2 ACP minimum.
  • Prereleases and unknown majors (3.x) are still refused. The 2.x before/after server probes and the 1.x opencode models check still refuse a model that isn't available.
  • Tests: the legacy route now covers 1.18.35 and 1.19.4, and the v2 route covers 2.0.14, 2.0.16 and 2.1.4. Refusal is checked for 1.18.29, 2.0.13, 2.1.5-beta.1 and 3.0.0.

How verified

I ran a throwaway vitest harness, not checked in, that calls the real buildExecutionHostAgentStartupPlan against real binaries from npm (opencode-darwin-arm64, @opencode/cli-darwin-arm64) plus the installed opencode 2.0.16. Each run used isolated XDG dirs.

Version main this PR
1.18.30 --model launch --model launch
1.18.35 REFUSED --model launch
1.19.4 REFUSED --model launch
2.0.14 / 2.0.15 / 2.0.16 (installed) REFUSED / REFUSED / launch --standalone + overlay {"model":…,"agents":{"build":{"model":…}}}
2.0.32 / 2.1.4 REFUSED --standalone + overlay; the after-probe confirmed the build agent's model
1.19.4 / 2.1.4, model opencode/not-a-model — REFUSED (still fails closed)
2.1.4, model it doesn't list — REFUSED (still fails closed)

Checks run: pnpm tc:node, pnpm test src/main/opencode plus the related runtime/worker/pty-launch tests (1056 passed), and pnpm run check:code-quality:changed.

Risk

Low. The only change is which versions get to run the existing model probes. Remote and WSL are still refused before any probe, and there are no UI or mobile changes. Folder workspaces are unaffected. OPENCODE_NATIVE_PROMPT_VERSIONS (draft-prompt prefill) is a separate exact list and is not touched here.

Credit: @ggbdpq (#26683) for reporting and first fixing 1.18.35, and @brennanb2025 (#31985) for the broader gate analysis. This PR supersedes both.

Fixes #26611

…election

The model launch gate admitted only 1.18.30, 1.18.32 and 2.0.16, so every
later OpenCode release refused a picked model. Upstream's `--model` and
`opencode models` (1.x) and the agent/model/config API plus `--standalone`
(2.x) are unchanged across 1.18.30..1.19.4 and 2.0.14..2.1.4; replace the
exact list with per-major floors. The 2.x before/after probes still fail
closed on an unavailable model.

Fixes #26611

Co-authored-by: ggbdpq <[email protected]>
Co-authored-by: Brennan Benson <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c2b55764-a4bd-44c6-aa9b-46186db1272e
Commits

Reviewing files that changed from the base of the PR and between a02a635 and 4551d6c.

Files selected for processing: 4
  • src/main/opencode/opencode-launch-model-context.ts
  • src/main/opencode/opencode-model-startup-plan.test.ts
  • src/main/opencode/opencode-model-startup-plan.ts
  • src/main/opencode/opencode-model-version-policy.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker
nwparker merged commit d170b5a into main Oct 24, 2026
32 checks passed
nwparker added a commit that referenced this pull request Oct 25, 2026
…op the startup prompt (#33436)

OpenCode 2.x model-selection launches require 2.0.19+ (upstream #51938 waits for agent/model before auto-submitting --prompt) or a native-prompt version (2.0.12, 2.0.16), fixing a regression from #33307 where 2.0.14/15/17/18 accepted a picked model but silently dropped the first prompt.
LuweiLiao pushed a commit to LuweiLiao/orca that referenced this pull request Oct 25, 2026
…election (stablyai#33307)

OpenCode model selection accepts per-major floors (1.x >= 1.18.30, 2.x >= 2.0.14; prereleases and 3.x refused) instead of exact version allowlists, so current releases launch with a picked model again. Fixes stablyai#26611. Supersedes stablyai#26683, stablyai#31985.

Co-authored-by: ggbdpq <[email protected]>
(cherry picked from commit d170b5a)
LuweiLiao pushed a commit to LuweiLiao/orca that referenced this pull request Oct 25, 2026
…op the startup prompt (stablyai#33436)

OpenCode 2.x model-selection launches require 2.0.19+ (upstream stablyai#51938 waits for agent/model before auto-submitting --prompt) or a native-prompt version (2.0.12, 2.0.16), fixing a regression from stablyai#33307 where 2.0.14/15/17/18 accepted a picked model but silently dropped the first prompt.

(cherry picked from commit e575cc1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: OpenCode 1.18.35 rejected by worker-start --model due to narrow verified-version gate

1 participant