tui: tab model selection follows other tabs and clients · Issue #54363 · anomalyco/opencode · GitHub
Skip to content

tui: tab model selection follows other tabs and clients #54363

Open

Description

@cleardevice

Description

Model preferences are synced across clients since #49611. A tab without its own selection resolves its model from the shared recent list, and its variant from the shared per-model preferences, and keeps following them live. A model or variant picked in another tab or TUI instance therefore changes what an open tab will use, and a new tab opened from a session starts from whatever was picked last anywhere instead of the session it was opened from.

Plugins

No response

OpenCode version

2.0.26 (also current v2)

Steps to reproduce

  1. Run two TUI instances, A and B. In A, open a new session tab and do not pick a model. In B, pick a different model. A's footer switches to B's model.
  2. In one instance, open a session in tab 1 and pick model X with variant high. Switch to tab 2 and pick model Y. Back in tab 1, open a new tab with "+": it starts with Y instead of X / high. With /new it keeps X, but the variant follows the one last set for X anywhere.

Screenshot and/or share link

No response

Operating System

Arch Linux

Terminal

GNOME Console 51.0 (bash 5.3)

Activity

  1. opencode-agent commented on Oct 10, 2026

    @opencode-agent
    Contributor

    Thanks for the clear report. I reproduced the first scenario on 2.0.26, and it still happens on the latest dev (7b3d4ce).

    Steps (simulated provider with two models and no model set in the config):

    1. Open TUI A on a new-session screen without picking a model. Its footer shows the first model.
    2. In a second TUI B, pick the other model via /models.
    3. A's footer switches to B's model even though nothing was done in A.

    The recording and screenshots below show instance A before and after B picks a model, and the script below reproduces it. I did not automate the second scenario ("+" and /new tabs inside one instance), but the code that causes the first problem looks like it causes that one too.

    Related: #49611 (the change that syncs model preferences across clients).

    recording.mp4

    Screenshot

    Screenshot

    Reproduction script (drive.ts)
    // Repro for anomalyco/opencode#54363: a new-session tab with no own model follows a
    // model picked in another TUI instance (shared "recent" model preferences).
    import { Effect } from "effect"
    import { OpenCodeDriver } from "opencode-drive"
    
    export default OpenCodeDriver.use(
      {
        ...(process.env.OC_DEV ? { opencode: { dev: process.env.OC_DEV } } : {}),
        tui: { recording: true, keypressOverlay: true },
        setup: ({ config }) =>
          Effect.sync(() => {
            const c = config as any
            delete c.model // no configured default: the tab falls back to recent models
            c.providers.simulation.models["gpt-sim-second"] = {
              name: "Second Model",
              capabilities: { tools: true, input: ["text"], output: ["text"] },
              limit: { context: 128_000, output: 16_000 },
            }
          }),
      },
      (oc) =>
        Effect.gen(function* () {
          const a = oc.ui
          yield* a.waitFor("Simulated Model")
          yield* a.screenshot("A-before")
          const b = yield* oc.tuis.launch({ viewport: { cols: 100, rows: 40 } })
          yield* b.ui.waitFor("Simulated Model")
          // In instance B, pick the other model
          yield* b.ui.submit("/models")
          yield* b.ui.waitFor("Select model")
          yield* b.ui.type("Second")
          yield* Effect.sleep(500)
          yield* b.ui.enter()
          yield* b.ui.waitFor("Second Model")
          yield* b.ui.screenshot("B-after-pick")
          // A never picked a model, yet its footer switches to B's choice
          yield* a.waitFor("Second Model", { timeout: 10_000 })
          yield* Effect.sleep(1000)
          yield* a.screenshot("A-after")
        }),
    )

    Run it with opencode-drive: opencode-drive run ./drive.ts. It drives opencode from your PATH; set OC_DEV to the path of an OpenCode checkout to run that from source instead.

  2. arashbehmand commented on Oct 15, 2026

    @arashbehmand

    I'm seeing this too. I'm on OpenCode 2.0.29 on macOS, installed from the Homebrew tap anomalyco/tap/opencode-v2. I upgraded from V1 to V2 this week. I run several TUI windows at the same time, each on a different model on purpose. In V1 every window was its own process, so each one kept its own model.

    On V2, I opened a few windows, changed the model in one, and the others switched to it without me touching them, which is scenario 1 above. I'd like each window to stay on the model it shows. That could mean treating it as that window's own choice, or adding a setting to turn off live model sync between clients.

  3. cleardevice commented on Oct 15, 2026

    @cleardevice
    Author

    Thanks for confirming on 2.0.29. Windows still on the new-session screen with no model picked in them follow the most recent pick from any window; #54367 should fix that by keeping the model each window resolved when it loaded. A window with a session already running keeps that session's model, except when you switch between plan and build and the agent you switch to has no model of its own; that case is tracked in #54375.

    Did a window with a running session switch too, without a plan/build switch? That would be a different bug.

    Syncing model preferences across clients is intentional (#49611), so a switch to turn it off would be a separate request for the maintainers; keeping each window on its own model is what #54367 aims for without one.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions