Repository navigation
fix(acp): wait for a cold location's plugins before the first catalog read - #53358
Merged
Merged
Conversation
… read `opencode acp` runs a private server, so the first catalog read for a cwd boots its Location. Plugins activate after that boot, and model.list answers with whatever providers have registered so far. The first session/new then missed providers from later plugins (opencode/*, config providers), and selecting one right away failed with -32602. The plugin inventory stays empty until a Location finishes activating, so the catalog now polls it (25 ms, up to 5 s) before reading. Warm locations answer on the first poll; a timeout falls back to the current snapshot. Fixes #52729 Fixes #52472
This was referenced Oct 6, 2026
Closed
2 of 6 tasks
3 of 6 tasks
eshatalov
added a commit
to eshatalov/subturn
that referenced
this pull request
Oct 10, 2026
OpenCode's ACP catalog used to be read before the location's plugins had registered their providers, so a model from OpenCode Console (`opencode-go/*`, `opencode/*`) or from `opencode.json` selected right after `session/new` was refused with -32602. Subturn set the model again after each `config_option_update` for up to 5 s. OpenCode 2.0.25 reads the catalog after the plugins have loaded (anomalyco/opencode#53358, closing #52472 and #52729), so the retry has nothing left to do. It is removed from the ACP turn, together with the fake agent's `latemodel` and `nomodel` modes and their two tests; `configure` takes the client and the session id again. README names 2.0.25 as the minimum OpenCode version. Verified on OpenCode 2.0.26: typecheck and the offline suite (34 pass, 3 live skipped); `subturn status` lists `opencode-go/*` from the first catalog; live smoke + resume on `zai-coding-plan/glm-5.3-flash` and `opencode-go/muse-spark-1.3-contributor`, where the model was acknowledged 19 ms after `session/new`; the user's `opencode.db` gained no session. Claude Fable 5.1 in Claude Code. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
#52729 | #52472
Why the change
The first
session/newin a freshopencode acpprocess returned a model list taken while the location's plugins were still registering providers, so it missed models (#52729) and selecting a model fromopencode.jsonright away failed with-32602 model not found(#52472).Special things to note
8905af5074removed on purpose ("Activation timing is an internal server concern"). It readsplugin.list, which stays empty until activation finishes (core/src/plugin.ts:42, filled at:172, thenplugin.updatedat:175). That timing is not documented. If the server changes it, the wait ends on the first poll and ACP behaves as it does today. It cannot hang: it stops after 5 seconds and ignores errors. The server-side alternative is to havemodel.listwait for activation, which reverses that decision. Worth a quick OK from Dax.session/newper process omits the built-inopencodeprovider fromconfigOptions#52729 on their own. The bug is in the firstsession/newresponse itself, and a laterconfig_option_updatecan't change that response.session/newfor a cold location, measured against a real server. Warm locations pay one extra local request. Providers added later still arrive through catalog events, as before. That covers plugins installed from npm on first run (a second activation pass) and models found by background discovery.Change outline
The catalog waits for the location's plugins before its first read, then reads as before. A probe of a cold location against a real server showed why. It returned 0 plugins and 10 models with no config provider, then 87 plugins and 11 models with it. The model list did not change after the plugin list filled.
ACPCatalog.load(client, cwd) + poll plugin.list every 25 ms until it is non-empty, up to 5 s, ignoring errors read models, default model, agents, commands retry while there is no default model or agent, every 25 ms, up to 5 sloadalso runs on reloads. Locations idle for an hour are dropped and recreated cold, so the wait stays inloadrather than only on first use.The new wire test lets the fake server finish activating 200 ms after start. It checks that the first
session/newlists the late model and that selecting it right away works. Without the fix it fails with-32602 model not found: test/second-model.