Repository navigation
feat(acp): follow model and agent changes from other clients - #52499
Merged
Merged
Conversation
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.
#35457 | #48759
Why the change
When the TUI, the desktop app, or another ACP connection switches the model or agent of a session that ACP has open, the ACP client's model, effort, and mode pickers now follow the change instead of showing a stale value.
Special things to note
session.model.selected/session.agent.selected, and hands each event to the attached session it names. Each attached session then runs one fold that applies catalog reloads and selection changes in order, so a reload racing a switch cannot leave stale options on the client. Closing, detaching, or re-attaching a session ends its fold with the session scope.switchModel/switchAgent, so the server's echoed event diffs to the same options and nothing is pushed. A comment at the write sites inservice.tsrecords this ordering. Variant rule: the event's model ref replaces the selection as a whole, so a ref without a variant shows thedefaulteffort, matching core'sswitchModel.Refs.Change outline
Event routing and the per-session fold:
Files:
packages/cli/ ├── src/acp/ │ ├── sessions.ts # + connection subscription, one fold per session │ └── service.ts # + no-echo ordering comment └── test/acp/ + └── selection.test.ts # external switch, variant, no echo, routing, close/re-attach, catalog raceRefs #48759