You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Session-scoped bidirectional model and agent selection for attached TUI / ACP #48759
I have verified this feature I am about to request has not been suggested before.
Describe the enhancement you want to request
We embed an attached OpenCode TUI in a browser terminal while a controller owns the same runtime through ACP. We need supported selection state, change events, and setters for the model, variant, and primary agent, so the controller and TUI stay in sync.
Observed on OpenCode 1.18.30 (Linux, TUI attached inside tmux):
Change the model using the built-in picker in opencode attach, without submitting a prompt. The TUI selection changes, but GET /session/{id} does not immediately reflect it.
Change the persisted model with POST /api/session/{id}/model. Native readback changes, but the attached TUI picker does not follow.
ACP session/set_config_option can acknowledge a model change without updating that persisted selection.
Could OpenCode provide a session-scoped API/event contract that keeps these selections consistent? A supported TUI-plugin API would also help. Changes should affect subsequent turns, survive reconnects, and preserve draft prompt text without requiring simulated keystrokes or a TUI restart.
The model divergence above was reproduced using real picker interactions. Agent/variant synchronization is an enhancement request for the same use case, not a claim of independently reproduced bugs. This report describes the tested version, not a verification of current dev behavior.
Related, but not the same request: #47836, #43179, #46311. Happy to follow a preferred existing API or discuss the design before proposing a patch.
Heads-up that this may already be resolved: #52499 added session.model.selected / session.agent.selected events, which looks like exactly the contract this issue asks for.
Verified on a live 2.0.28 server: switching the model via POST /api/session/{id}/model emits session.model.selected on /api/event with the session and the new model ref, so an attached client can follow external switches by subscribing instead of polling.
One caveat: I can only confirm this on the 2.0 line @RoySalisbury
Thanks for the detailed write-up and for separating what you reproduced from what you're requesting.
You tested this on 1.18.30, which is OpenCode v1. v1 is a separate implementation and only gets fixes for critical bugs (data loss, security problems, or crashes or breakage with no workaround). This request is unlikely to be addressed there.
We'd encourage trying v2 (@opencode/cli), which already handles part of this:
feat(acp): follow model and agent changes from other clients #52499 (merged in v2): when the TUI, desktop app or another ACP connection switches a session's model or agent, ACP clients now get session.model.selected / session.agent.selected events, and their model, effort and mode pickers follow.
These open v2 issues cover the other parts of your request:
Closing this as not planned. The report is about OpenCode v1 (1.18.30), which only gets critical fixes, and we haven't heard back since the last comment.
On v2, #52499 already makes ACP clients follow model and agent changes made from the TUI or other clients. The remaining v2 gaps are tracked in #57771, #50315 and #59789. If you hit something on v2 that those don't cover, please open a new issue with the v2 version and steps to reproduce. Thanks again for the detailed report.
Activity
jensenojs commentedon Oct 14, 2026
Heads-up that this may already be resolved: #52499 added session.model.selected / session.agent.selected events, which looks like exactly the contract this issue asks for.
Verified on a live 2.0.28 server: switching the model via POST /api/session/{id}/model emits session.model.selected on /api/event with the session and the new model ref, so an attached client can follow external switches by subscribing instead of polling.
One caveat: I can only confirm this on the 2.0 line @RoySalisbury
opencodejr commentedon Oct 28, 2026
Thanks for the detailed write-up and for separating what you reproduced from what you're requesting.
You tested this on 1.18.30, which is OpenCode v1. v1 is a separate implementation and only gets fixes for critical bugs (data loss, security problems, or crashes or breakage with no workaround). This request is unlikely to be addressed there.
We'd encourage trying v2 (
@opencode/cli), which already handles part of this:session.model.selected/session.agent.selectedevents, and their model, effort and mode pickers follow.These open v2 issues cover the other parts of your request:
If you think the v1 behaviour is critical, or you see a gap on v2 that those issues don't cover, please reply here with the v2 version and steps.
opencodejr commentedon Oct 29, 2026
Closing this as not planned. The report is about OpenCode v1 (1.18.30), which only gets critical fixes, and we haven't heard back since the last comment.
On v2, #52499 already makes ACP clients follow model and agent changes made from the TUI or other clients. The remaining v2 gaps are tracked in #57771, #50315 and #59789. If you hit something on v2 that those don't cover, please open a new issue with the v2 version and steps to reproduce. Thanks again for the detailed report.