Repository navigation
fix(opencode): list OpenCode 2.x models before the first message - #28423
Closed
AmoabaKelvin wants to merge 4 commits into
Closed
AmoabaKelvin wants to merge 4 commits into
AmoabaKelvin wants to merge 4 commits into
Conversation
AmoabaKelvin
force-pushed
the
fix/opencode-2x-model-listing
branch
2 times, most recently
from
October 15, 2026 14:04
14a8f4b to
00a1f6b
Compare
AmoabaKelvin
force-pushed
the
fix/opencode-2x-model-listing
branch
2 times, most recently
from
October 15, 2026 21:15
0dddffa to
5d82644
Compare
…have Every 2.x release rejects `opencode models --verbose`, and its own listings are empty before 2.0.27 and can omit providers that report after startup. The early listing now applies to the 1.x line only; on 2.x the chat's own list fills the picker.
…nd deletes 2.x has no listing command that matches its chats, but a new session reports exactly what a chat offers. The catalog probe now opens one, reads its models and deletes it with session/delete. A release that cannot delete a session is not asked, so no empty conversation is left; 1.x keeps its models --verbose listing.
OpenCode 2 records a project for every folder a session opens in, so the throwaway session in the home folder left a home-folder project in OpenCode's list. The session now opens in the folder of the chat that asked, as bb does; a startup or settings refresh has no chat, so it skips the listing without counting as a failure.
A picker opened during a startup refresh joined a listing that had no chat folder to open its session in, so it was answered with no models. Registrations now mark a listing that runs in the asking chat's folder, and the prewarm skips it, so the picker's own read lists in its folder. bb likewise keeps its folder-less prewarm apart from folder reads.
AmoabaKelvin
force-pushed
the
fix/opencode-2x-model-listing
branch
from
October 15, 2026 23:08
5d82644 to
706c315
Compare
Collaborator
Author
|
Folded into #28424, which now carries the model list work as well as the OpenCode 2 chat, so there is one PR to review. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
ELI5
Before a chat sends its first message, Orca fills the model picker by asking the agent which models it has. OpenCode 2.x has no command that answers that correctly, so the first OpenCode chat on a 2.x install had an empty picker. Now Orca opens a chat session with OpenCode in the background, reads the models that session offers, and deletes it.
What Changed
Before. With
opencodeon 2.x, Orca ranopencode models --verbose, which every 2.x release rejects. The first chat of an account had no model list until its first message.After. On 2.x the picker lists the models before the first message, and nothing is left in the user's OpenCode history. The list is saved and reused like every agent's. On 2.x it is refreshed when a chat asks and the saved list is more than 10 minutes old; the background refreshes at app start and after a setting change skip it, because they have no chat folder to open a session in. 1.x still uses
models --verbose, unchanged.Mechanism. OpenCode's listing setting now says which releases its listing command covers (1.x) and that other releases list through a session. The model list probe gained that session path: it checks that the agent can delete a session (
sessionCapabilities.delete), opens one withsession/newin the folder of the chat that asked, reads its models with the same code a running chat uses, and deletes it withsession/delete. An agent that cannot delete a session is not asked. The model list service now hands the asking chat's folder to the probe. Registrations mark a listing that runs in a chat's folder, and a startup or settings refresh, which has no chat, never runs it; a read without a folder skips it without counting as a failure. So a picker never waits on a listing that cannot answer it.Why
--verbose.opencode modelsandopencode api model.listanswer empty from a fresh start on 2.0.14 to 2.0.26, and on 2.0.28 left out a provider that loaded 300 ms late. Orca lets a newer list replace an older one, so a short list would hide working models. Upstream: v2:opencode models --refreshno longer recognized (flag removed from models command) anomalyco/opencode#53682, cli: opencode models prints empty list with exit 0 on a cold server anomalyco/opencode#53724 and fix(server): await catalog readiness for model and provider reads anomalyco/opencode#36117, all open.Linked Issue
Part of #19581. The next PR, #28424, makes the OpenCode 2 launcher entry open as a chat and lists its models the same way.
Visual Proof
N/A: the picker looks the same; it now has models before the first message. Testing gives the counts.
Testing
New tests, each failing on the previous code: on 2.x the probe opens a session in the asking chat's folder, reads its models and deletes it, with no listing command; it opens no session on a release that cannot delete one, nor without a chat folder; a startup refresh that skips is not held, and the next read lists in its chat's folder.
Real OpenCode, isolated folders: on 2.0.14 and 2.0.29 a new session reported 71 and 11 models, and after
session/deleteOpenCode's store held no session and no file was written in the folder.Real app (hidden dev builds, macOS arm64, fresh profiles, isolated OpenCode folders):
opencodeon 2.0.29: the first chat lists 11 models before any message, and OpenCode's store holds no session afterwards.models --verbose, and no session is created.pnpm lint,pnpm tc, the three audits,check:code-quality:changed,check:react-doctor:changedandcheck:zustand-selector-fanoutpass on the head. 56 dependent test files pass (563 tests)..I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)