Skip to content

[FEATURE]: Session-scoped bidirectional model and agent selection for attached TUI / ACP #48759

Closed as not planned

Description

@RoySalisbury

Feature hasn’t been suggested before.

  • 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):

  1. 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.
  2. Change the persisted model with POST /api/session/{id}/model. Native readback changes, but the attached TUI picker does not follow.
  3. 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.

Activity

  1. jensenojs commented on Oct 14, 2026

    @jensenojs
    Contributor

    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

  2. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    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:

    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.

  3. opencodejr commented on Oct 29, 2026

    @opencodejr
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions