Skip to content

desktop: a provider disappears from /models once all its models are in Recent / 桌面版:某 provider 的模型全部进入「最近使用」后,该分组从 /models 中消失 #60267

Closed as not planned

Description

@trt44343

Description

EN — Once every model of a provider has been used, that provider's group vanishes from the desktop model picker completely: no header, no rows. It reads as if the provider was removed from the config. Typing anything in the search box brings the group back.

中文 — 当某个 provider 的全部模型都被使用过之后,该分组会从桌面版模型选择器中整个消失:标题和所有行都不见了,看起来像是该 provider 被从配置里删掉了。在搜索框里随便输入内容,分组就会重新出现。

Mechanism / 机制

Recent models are moved, not copied — they are subtracted from their provider group, and a group left with zero rows is dropped entirely:

近期模型是被「移动」而不是「复制」——它们会从所属 provider 分组中被剔除,剩余数量为 0 的分组整组被丢弃:

function Ka(e) {
  let t = new Set(e.favorites.map(key)),
      n = e.recent.filter(x => !t.has(key(x))),
      r = new Set([...t, ...n.map(key)]);        // shown above
  return [
    ...(e.favorites.length ? [favGroup] : []),
    ...(n.length ? [recentGroup] : []),
    ...e.groups.flatMap(g => {
      let t = g.items.filter(x => !r.has(key(x)));   // ← rows removed
      return t.length > 0 ? [{ ...g, items: t }] : [];  // ← empty group dropped
    })
  ];
}

The Recent list is capped at 5 entries (I = 5), so any provider with ≤5 models disappears after ordinary use.
「最近使用」上限为 5 条(I = 5),因此模型数 ≤5 的 provider 在正常使用后必然消失。

Search bypasses the whole path — f.search.trim() ? e : Ka({ ... }) — which is why the group reappears while typing.
搜索会跳过这段逻辑——f.search.trim() ? e : Ka({ ... })——这就是输入关键词后分组重新出现的原因。

Expected / 预期

The provider keeps its group with all models listed; Recent is an additional shortcut, not a relocation.
provider 分组保持完整列出所有模型;「最近使用」是额外的快捷入口,而不是把模型搬走。

Impact / 影响

Custom and local OpenAI-compatible providers are usually small (1–5 models), so they disappear after normal use and look like data or config loss.
自定义和本地 OpenAI 兼容 provider 通常模型很少(1–5 个),因此正常使用后就会消失,看起来像数据或配置丢失。

Related / 相关

#45821 (closed 2026-10-28 by the stale bot, which asked for a new issue if still relevant) · #49141 · #40592 · #3874

Plugins

None

OpenCode version

2.2.1 (desktop app, @opencode-aidesktop)

Steps to reproduce

  1. Configure a custom provider with 2 models (below reproduced the bug with 2).

    {
      "provider": {
        "command123": {
          "npm": "@ai-sdk/openai-compatible",
          "options": { "baseURL": "http://127.0.0.1:8787/v1", "apiKey": "..." },
          "models": {
            "deepseek/deepseek-v4-flash": {},
            "deepseek/deepseek-v4-flash-fast": {}
          }
        }
      }
    }
  2. Open /models. The command123 group is listed with both models.
    / 打开 /models,command123 分组正常显示两个模型。

  3. Select one, then the other, in separate sessions so both enter Recent.
    / 分别在不同会话中选择这两个模型,使两者都进入「最近使用」。

  4. Open /models again.
    / 再次打开 /models。

Screenshot

No response

Operating System

Windows 11 (10.0.22631.5472), x64

Terminal

Not applicable (desktop app)

Activity

  1. opencodejr commented on Oct 29, 2026

    @opencodejr
    Contributor

    Thanks for the detailed write-up and the clear explanation of how it happens.

    You're asking for the desktop /models picker to keep every provider group complete, with Recent (and Favorites) as extra shortcuts rather than moving models out of their provider. That way small custom or local providers don't disappear from the list after normal use.

    From the code, the current behaviour is intentional. The picker removes favorite and recent models from their provider group so no model is listed twice, as in the TUI. A provider whose models are all in Recent is left with no rows, so its group isn't shown. Your models aren't lost, though: they're still under Recent, and the full group comes back when you search. So I've marked this as a feature request rather than a bug. Maintainers will consider it.

    The same thing has been requested before:

    This can't be done with a plugin today, because plugins have no way to change how the desktop model picker groups its list.

  2. 734208213 commented on Nov 5, 2026

    @734208213

    这确实有点反直觉,我以为是bug,原来是有意为之

  3. ko22009 commented on Nov 9, 2026

    @ko22009

    up

  4. amirsaam commented on Nov 18, 2026

    @amirsaam

    +1
    As described in #64638, at least you could give us an option to disable Recent Models completely

  5. Bopp77 commented on Nov 23, 2026

    @Bopp77

    Still reproducible on 2.4.0 (latest) in the TUI on Linux, with a provider that has only two models — which makes it look like the model was deleted from the config:

    • Provider deepseek exposes deepseek-flash and deepseek-v4-pro.
    • deepseek-flash is recent[0] in ~/.local/state/opencode/model.json.
    • Opening /models with an empty search shows the Recent section with "DeepSeek V4.1 Flash 1017", while the DeepSeek group only lists "DeepSeek V4 Pro".
    • Typing anything into the search field makes the missing model appear again.

    The data layer is fine — GET /api/model on 2.4.0 returns both models for the same location:

    {"providerID":"deepseek","id":"deepseek-flash","name":"DeepSeek V4.1 Flash 1017","status":"active"}
    {"providerID":"deepseek","id":"deepseek-v4-pro","name":"DeepSeek V4 Pro","status":"active"}

    The TUI model dialog in the 2.4.0 build still subtracts instead of copies: when the search filter is empty and no provider is preselected, any model whose providerID/modelID is in favorites or recent is dropped from its provider group. Favorites behave the same way, and a group left with zero rows disappears entirely (as described above).

    Practical impact: on a small provider (2 models) one of them vanishes after normal use, and the same model can be selected twice in a row from two different looking places. This is the same confusion the desktop reports describe, so the TUI is affected identically.

    Request (in line with the rest of this issue): keep provider groups complete and render Recent/Favorites as an additional shortcut, or add a setting to disable the de-duplication — either is fine, a model just should not disappear from its provider group.

    Note: #64638 and #64196 were closed as duplicates of this issue, so I'm adding the TUI/2.4.0 reproduction here instead of opening another report.

  6. neriousy commented on Nov 23, 2026

    @neriousy
    Member

    The picker moves Recent and Favorite models out of their provider groups on purpose to avoid listing them twice. Closing.

  7. amirsaam commented on Nov 23, 2026

    @amirsaam

    @neriousy Give us an option to disable this behaviour at least on demand, default is yours but users may want otherwise!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions