Skip to content

desktop: hidden models still appear in the model picker's Recent section #60911

Open

Description

@kotvaniy

Summary

Hiding a model in Settings → Models removes it from its provider group, but the model stays visible in the model picker if it is in the "Recent" (or "Favorites") block. A hidden model should not appear anywhere in the picker.

Environment

  • opencode version: 2.2.5
  • OS: Windows 10 Pro 19045 (win32 x64)
  • Terminal: desktop app
  • Shell: powershell
  • Install/channel: release (desktop app)
  • Active plugins: none

Reproduction

  1. Select a model, e.g. opencode/glm-5.3-flash-free, in a session so it is added to Recent.
  2. Open Settings → Models and turn that model off ("Choose which models appear in model picker").
  3. Open /models in a session.

Expected Behavior

The hidden model is not listed anywhere, including the Recent and Favorites sections.

Actual Behavior

The model disappears from its provider group but is still listed under "Recent" (the exact order matches the stored recent array). Selecting any model again keeps writing the old recent list back. Favorites behave the same way.

Additional Context

The picker builds its groups from models filtered by visible(), but recent()/favorites() are merged without that filter, so hidden entries leak through. Because the recent list is stored per client, the same model is correctly absent on other machines/clients that never selected it. On desktop the store is drafts.sqlite (state, name opencode.global.dat, key model).

Workaround: selecting two other models pushes the hidden one out of the 5-entry recent list.

Activity

  1. opencodejr commented on Oct 31, 2026

    @opencodejr
    Contributor

    Thanks for the clear report. I could reproduce this.

    The desktop app isn't available here, so I used the same app UI served as the web app by opencode serve, with a test provider that has three models (Alpha, Beta, Gamma):

    1. In a session, selected Alpha in the model picker so it was added to Recent.
    2. Turned Alpha off in Settings → Models.
    3. Opened the model picker in a new session.

    Alpha was gone from its provider group but still listed under Recent. It happens on 2.2.5 and still on the latest dev (bf544cd). The recording and screenshots below show it, and the script below reproduces it. I only checked Recent, not Favorites.

    The code looks like what you describe: the provider groups are filtered by visibility, but the Recent and Favorites lists are not. Related: #60267 (a provider's group disappears once all its models are in Recent). It involves the same picker code but is a different problem.

    recording.mp4

    Screenshot

    Screenshot

    Reproduction script (repro.mjs)
    // Reproduces anomalyco/opencode#60911 in the OpenCode web app (same UI as the desktop app).
    // Setup: project with opencode.json declaring provider "mock" (openai-compatible, apiKey "x",
    //   models alpha/beta/gamma named Alpha/Beta/Gamma), then `OPENCODE_PASSWORD=pw opencode serve --port 4097`.
    // Needs: bun add playwright-core; npx playwright install chromium
    // Run: CHROME=<chromium path> PASS=pw URL=http://127.0.0.1:4097 bun repro.mjs
    //   (for a source checkout: serve on :4096 with --cors http://127.0.0.1:5173, run vite in packages/app, APP=http://127.0.0.1:5173)
    import { chromium } from "playwright-core"
    async function open(url, pass, video, server = url) {
      const b = await chromium.launch({ executablePath: process.env.CHROME })
      const ctx = await b.newContext({ viewport: { width: 1400, height: 900 }, ...(video ? { recordVideo: { dir: video, size: { width: 1400, height: 900 } } } : {}) })
      const p = await ctx.newPage()
      await p.goto(url); await p.waitForTimeout(3000)
      await p.getByText("Use password").click()
      await p.fill("#server-connect-url", server)
      await p.fill("#server-connect-password", pass)
      await p.getByRole("button", { name: "Connect" }).click()
      await p.waitForTimeout(4000)
      return { b, ctx, p }
    }
    const url = process.env.URL ?? "http://127.0.0.1:4097"
    const { b, ctx, p } = await open(process.env.APP ?? url, process.env.PASS, process.env.VIDEO, url)
    const out = process.env.OUT ?? "/workspace/repro"
    await p.getByRole("button", { name: "New session" }).first().click(); await p.waitForTimeout(3000)
    // 1. Select Alpha in the picker so it is added to Recent
    await p.getByRole("button", { name: "Choose model variant" }).locator("xpath=preceding::button[1]").click(); await p.waitForTimeout(1500)
    await p.getByRole("dialog").getByText("Alpha", { exact: true }).click(); await p.waitForTimeout(1500)
    // 2. Hide Alpha in Settings -> Models
    await p.getByRole("button", { name: "Home" }).first().click(); await p.waitForTimeout(1500)
    await p.getByRole("button", { name: "Settings" }).first().click(); await p.waitForTimeout(1500)
    await p.getByText("Models", { exact: true }).first().click(); await p.waitForTimeout(1500)
    await p.getByRole("switch", { name: "Alpha" }).click({ force: true }); await p.waitForTimeout(1000)
    console.log("Alpha switch checked:", await p.getByRole("switch", { name: "Alpha" }).getAttribute("aria-checked"))
    await p.screenshot({ path: `${out}/1-alpha-hidden.png` })
    // 3. Back to the app, new session, open the picker
    await p.getByRole("button", { name: "Back to app" }).click(); await p.waitForTimeout(1500)
    await p.getByRole("button", { name: "New session" }).first().click(); await p.waitForTimeout(3000)
    await p.getByRole("button", { name: "Choose model variant" }).locator("xpath=preceding::button[1]").click(); await p.waitForTimeout(1500)
    const text = await p.getByRole("dialog").innerText()
    console.log("--- picker ---\n" + text)
    await p.screenshot({ path: `${out}/2-picker-shows-hidden-alpha.png` })
    console.log("Alpha listed in picker after hiding:", /\bAlpha\b/.test(text))
    await p.waitForTimeout(1000)
    await ctx.close(); await b.close()

    Run it: bun repro.mjs

  2. jimmyallinai commented on Oct 31, 2026

    @jimmyallinai
    Contributor

    I'll take a look at this. My plan: trace how the model picker builds its groups vs. recent()/favorites(), apply the same visible() filter to Recent and Favorites, add a regression test for a hidden model in Recent/Favorites, and run the affected package's tests and typecheck before opening a PR.

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