Skip to content

fix(opencode): allow model picks when discovery is unavailable - #31985

Merged
brennanb2025 merged 8 commits into
mainfrom
brennanb2025/sta-11453-opencode-version-gates
Oct 26, 2026
Merged

brennanb2025 merged 8 commits into
mainfrom
brennanb2025/sta-11453-opencode-version-gates

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​216 $\color{#cf222e}{\Huge{\mathbf{−}}}$​326 $\color{#cf222e}{\Huge{\mathbf{−}}}$​110
Prod 17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​287 $\color{#cf222e}{\Huge{\mathbf{−}}}$​203 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​84

Supported OpenCode launches can be rejected before they start because a model catalog is incomplete, the CLI reports a different model name, or optional agent discovery fails. This PR lets the selected model reach the existing launch operation despite those discovery failures.

The remaining change compared with main is catalog and readback handling, not version support. Legacy launches pass the exact selected model through the existing flag without catalog approval. Eligible v2 launches use an optional resolved-agent lookup and a launch-only configuration overlay; they no longer require catalog membership or a matching model echo. The overlay targets the first resolved selectable agent. When none is discovered, it changes only the top-level model, preserving existing agents and never inventing an agent from a stale default or a guessed build name.

Main’s #33307 and #33436 policies are preserved: stable 1.x from 1.18.30 below 2; 2.0.16 and stable 2.0.19 or later below 3. Picked-model launches on 2.0.14/15/17/18, unknown versions, prereleases and 3.x remain refused. The error names OpenCode and tells the user to update it or launch without a model choice; the renderer translates this guidance in all seven supported locales. Existing-worktree workers are refused before dispatch, including when native workers are the default, matching main. Their preflight checks placement and version without repeating metadata discovery or full terminal preparation.

No startup-prompt fix is included. The separate no-model startup-submit issue is STA-12110. This change preserves the requested model; it does not add a guarantee that the CLI applies it or switches a resumed session’s model. Those existing limitations remain tracked in STA-11727. Existing placement, argument and configuration limits remain.

Validation covers real OpenCode 2.0.19 output for a stale default_agent and disabled build, both at the initial empty-list snapshot and after agent resolution. Checked-in contract tests feed those captured shapes through the parser and overlay writer, verifying the resolved agent and preserved configuration. The empty response was transient; it is not evidence of persistent discovery failure. CI executed all six changed regression files successfully (78 tests), plus the writer configuration file (eight tests), on its merge commit incorporating 76149fc1. These cover unsafe-version guidance, pre-dispatch worker refusal under both mode defaults, cleanup and renderer localization. These tests prove model preparation and refusal handling, not provider inference.

A retained P2 limitation is that eligible-v2 terminal workers with unsupported configured arguments fail after dispatch, leaving a failed receipt; main refused those arguments before dispatch. Unsafe-version refusal is restored before effects. Native ACP workers use a separate fixed argument list and remain eligible. The status comment records the independent disposition of this distinction.

All applicable CI checks passed on the final head. The full-path review and focused delta review classify the changed flows as CLI/orchestration and copy tests rows. The final status comment records the exact head, test execution, CI result and evidence limits. Historical 129-test evidence on 4253aaa9 predates these corrections; assertions that relied on raw config defaults or late worker failure are superseded.

Earlier investigation on OpenCode 2.0.14 found six unsent first prompts, and a later manual submission reached a provider quota error. Neither result is a passing test of the final accepted-version policy. Historical successful 1.18.32 replies cover the unchanged legacy transport.

@brennanb2025
brennanb2025 marked this pull request as ready for review October 22, 2026 11:16
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review.

Recent review info
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: 1d8a90f7-6c23-4c4d-aebc-a1300ec6ef7c
Commits

Reviewing files that changed from the base of the PR and between 48fdc9d and 76149fc.

Files selected for processing: 1
  • src/renderer/src/i18n/en-runtime-required.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

Walkthrough

OpenCode launch no longer checks the CLI model catalog. The launch-context probe now returns a primary agent from agent data. The startup plan selects a route by probing capabilities and applies the requested model through launch configuration. Runtime support checks use model, platform, and WSL-path conditions. Shared refusal messages are translated into localized strings, and related tests and fixtures were updated.

Priority: Normal

Merge Risk: Moderate · up to 76149

Some supported worker launches can be refused after preflight, and early empty discovery can omit the selected model from the primary agent. These launch paths should be corrected before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 17 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: allowing OpenCode model selections when discovery is unavailable.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description is detailed and covers the problem, implementation, version policy, limitations, testing evidence, localization, and worker behavior. It references related issues and explains why the …
Full details: Description check

Explanation

The description is detailed and covers the problem, implementation, version policy, limitations, testing evidence, localization, and worker behavior. It references related issues and explains why the change is needed. It does not use the template headings or include explicit checklist states, visual proof marked as N/A, or AI disclosure, but the missing items do not prevent review because the required technical information is present.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 17 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • 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.

@brennanb2025

brennanb2025 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Supported OpenCode launches can be refused before starting when catalog or model discovery is incomplete. This PR lets the exact picked model reach the existing launch operation without requiring catalog membership or a matching model echo.

The final difference from main is still model preparation, not version eligibility. For v2, the overlay uses OpenCode’s first resolved selectable agent. A stale config default cannot create a blank agent; if discovery returns no agent, only the top-level model changes and existing agent entries remain untouched. The recorded initial-empty and settled-list responses from real OpenCode 2.0.19 cover a stale default_agent and a disabled build.

Main’s #33307/#33436 policy is retained: stable 1.x from 1.18.30 below 2; 2.0.16 and stable 2.0.19 or later below 3. Picked-model launches on 2.0.14/15/17/18, unknown versions, prereleases and 3.x remain refused. Refused users are told to update OpenCode or omit their model choice, with all seven locales covered. Existing-worktree workers refuse before dispatch under either mode default, matching main; preflight repeats neither metadata discovery nor full terminal preparation.

The no-model startup-submit bug is separately tracked as STA-12110 and is not fixed here. Actual model application and resumed-model switching remain the existing limitation tracked in STA-11727. With discovery absent, a preserved agent-specific model can still override the top-level model. The design preserves the requested model in launch preparation; these contracts do not prove provider execution.

Focused corrections are in 48fdc9d171a; the necessary generated English runtime-catalog correction is additive commit 76149fc1f86. Both passed the ordinary precommit hook. No further main sync, force-push or startup-submit repair was made.

Later main integration: merge 1ba99b1dc121659807776a8118aa92bd26004e08 brings in origin/main at a944e37a62835b25c0d989b065deab78eb5fa202 to resolve the new blocking conflict after e0531162. The only conflict was in the moved src/main/ipc/pty/pty-launch-parity.test.ts: main’s relocation, corrected module paths and extracted window cases are preserved together with this PR’s executable-only mock and primary-agent fixture. Main’s #33436 picked-model refusal remains unchanged. The exact merge-only lint-staged command passed before the --no-verify merge commit, followed by an additive push. Independent narrow merge review confirmed retained test assertions, imports and CI discovery, with no integration regression. All applicable checks on the merged head passed. The first Debian/Fedora WSL jobs timed out around 55 minutes; exactly one failed-job retry of run 40213983361 passed on this same head (Debian 4m20s, Fedora 4m21s), preserving the earlier Ubuntu success. No additional rerun or source change was needed. Prior evidence and the marker’s tested head 76149fc1 carry across both main integrations; no QA rerun was warranted.

Main integration after #33249: merge e05311621f836c302c2c29fff53490406a3e30da brings in origin/main at 7d18e19907adcc2fe039f2eafb4aa40dca0c707c to resolve a merge-blocking conflict. The single conflict in ipc-error.ts preserves main’s shortened comments and the PR’s complete OpenCode localization switch. The required merge-only lint-staged command passed before the --no-verify merge commit; the push was additive. Independent narrow merge review found no executable-token changes across 19 scoped TypeScript files and no merge-induced regression. Merged-head CI passed all applicable checks, including all five Node shards, static analysis/typecheck, relay integration, Linux/Windows packaging, persistence, WSL distro checks and mobile verification. Existing evidence and the marker’s tested head 76149fc1 carry across this main merge; no QA rerun was warranted.

Verified on reviewed head 76149fc1f86129f1d97a8f9a47712f6463a66213:

  • The original full review plus one continued narrow delta review found no open proven P0/P1. X1/X2 and unsafe-version worker timing are fixed. The final reference comparison is complete.
  • CI passed all applicable checks: static analysis/typecheck, all five Node shards, relay integration, both packaging jobs, three persistence platforms, WSL distro checks and mobile verification. Selection skips are not claimed as passes.
  • File-level CI logs confirm all six changed regression files passed (78 tests), plus eight direct writer configuration tests: seven files/86 tests. CI used merge commit 9591a1ac8fd81173a0685d43d1aa509e60fb5b5f, incorporating the reviewed head.
  • The real 2.0.19 archive, all 60 manifest files, eight HTTP/normalized response pairs, 15 upstream source files and exact checked-in fixture projections were independently verified.
  • Each changed flow is a CLI/orchestration or copy tests row. No new lifecycle, process ownership, login, screen layout or interaction flow requires another running-app round. The current-head tests provide the validation; no older qa_head carry is used.

Late automated review comments were independently traced. Empty-agent polling is the already-recorded one-shot discovery limitation; the initial empty snapshots are covered and the top-level-only fallback is intentional. Custom-argument preflight identifies a deferred P2 timing difference: eligible-v2 terminal workers with unsupported configured arguments fail after dispatch and leave a failed receipt, whereas main rejected them before dispatch. Unsafe versions still refuse before effects. Native ACP workers use fixed arguments and can proceed, so the suggested unconditional guard would reject that separate path too. This focused correction retains version-only preflight and the existing terminal preparation boundary; it does not claim identical timing for every refusal.

The earlier 129-test result on 4253aaa9 is historical, not fresh proof for the corrected behavior. In particular, config-derived primary selection and late worker failure assertions are superseded. The source-independent 2.0.19 captures include initial transient empty lists, not persistent-empty proof. All captured processes and owned terminals were stopped, assigned ports cleared, real config hashes unchanged, and QA tickets released.

For Brennan’s review: resolved agent selection, model overlay, worker refusal before dispatch.

Historical investigation screenshots (old 2.0.14 policy; not final acceptance evidence)

All six no-keypress measurements stayed unsent. A later manual submission reached a provider quota error, with no successful reply. Those results support the retained unsafe-release refusal and separate STA-12110 report.

Old main refused the picked model:

Old main refusal

Old head after manual submission received a provider quota error:

Old head quota result

nwparker added a commit that referenced this pull request Oct 24, 2026
…election (#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 #26611. Supersedes #26683, #31985.

Co-authored-by: ggbdpq <[email protected]>
@brennanb2025 brennanb2025 changed the title OpenCode launches accept picked models across CLI updates fix(opencode): allow model picks when discovery is unavailable Oct 25, 2026

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 2


Review info
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: f4bc0da4-b26f-4ee8-98e5-137f83105be7
Commits

Reviewing files that changed from the base of the PR and between 4253aaa and 48fdc9d.

Files selected for processing: 20
  • src/main/opencode/opencode-launch-model-config.ts
  • src/main/opencode/opencode-launch-model-context-cleanup.test.ts
  • src/main/opencode/opencode-launch-model-context.test.ts
  • 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-resolved-agents.fixture.json
  • src/main/runtime/orchestration-opencode-model-host.test.ts
  • src/main/runtime/rpc/methods/orchestration-worker-start-mode-selection.test.ts
  • src/main/runtime/terminal/wait/terminal-interactive-wait.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/pt.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/lib/ipc-error.test.ts
  • src/renderer/src/lib/ipc-error.ts
  • src/shared/agent-launch-model-preferences.ts
Files skipped from review as they are similar to previous changes: 1
  • src/shared/agent-launch-model-preferences.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

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)
@brennanb2025
brennanb2025 merged commit 0266b5f into main Oct 26, 2026
48 of 50 checks passed
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.

1 participant