Repository navigation
fix(acp): follow server defaults and refresh the session catalog - #52286
Merged
Merged
Conversation
This was referenced Sep 30, 2026
Closed
2 of 6 tasks
3 tasks done
Ichinose-Kazuki
pushed a commit
to Ichinose-Kazuki/opencode
that referenced
this pull request
Oct 7, 2026
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.
Closes #50236 | Closes #51819 | Closes #50378 | Closes #49630 | Refs #52284, #52259, #51478 | Supersedes #50619
Why the change
Since
8905af5074removed the plugin activation wait (first shipped in v2.0.4),opencode acpreads its model/agent/command catalog before config and plugins have loaded, caches that snapshot for the life of the process, and locks new sessions to its stale defaults, so config-defined agents,default_agent, providers, the configuredmodel, and agent permission rules silently don't apply; after this change ACP sessions use the server's real defaults and the client catalog catches up as soon as those plugins finish loading.Special things to note
packages/cli/src/acp; moving it to Effect is a separate follow-up.session/newno longer sendsagent/model. The server picks them at prompt time, after plugins have loaded, so permissions are correct even when the firstsession/newresponse still showsbuild. Clients that ignoreconfig_option_updatecan show a stale mode/model until they re-read options. A side effect: sessions whose mode/model the client never set now follow laterdefault_agent/modelconfig changes.opencode acpprocesses with the ACP: agents/permissions/default_agent from OPENCODE_CONFIG_CONTENT silently ignored across v2 (2.0.3-2.2.0); file-based agent registration regressed after 2.0.3 #52284 config (env content and global config file): before, the firstsession/newgotbuildabout half the time and the cached cwd never recovered; after, every stale response is followed by aconfig_option_updatetocopilot-build, and later sessions in the same cwd start correct. The part of ACP: agents/permissions/default_agent from OPENCODE_CONFIG_CONTENT silently ignored across v2 (2.0.3-2.2.0); file-based agent registration regressed after 2.0.3 #52284 that says env content was already inert on 2.0.3 did not reproduce on macOS (16/16 correct on 2.0.3) and still needs a Windows repro, so that issue is only referenced.Change outline
Catalog loading moves out of the service into its own module. Each cwd gets one live catalog object that sessions point at, instead of each session holding its own copy.
packages/cli/src/acp/ +├── catalog.ts # Catalog type, load() (moved), one event subscription, per-cwd reload └── service.ts # sessions point at a live catalog, follow server defaults, retry on unknown idstype Attached = { - catalog: Catalog - model: ModelRef - modeID: string + readonly catalog: ACPCatalog.Live // { cwd, current: Catalog }, shared per cwd + model?: ModelRef // unset = follow server default + modeID?: string // unset = follow server default }Session creation stops locking in the snapshot defaults.
The catalog stays live instead of being a one-time snapshot.