Skip to content

fix(omp): qualify model choice labels with their provider - #78

Merged
DimoADE merged 1 commit into
DimoADE:masterfrom
moxi-2534:fix/omp-model-picker-label
Nov 18, 2026
Merged

DimoADE merged 1 commit into
DimoADE:masterfrom
moxi-2534:fix/omp-model-picker-label

Conversation

@moxi-2534

Copy link
Copy Markdown
Contributor

问题

OMP 把每个已配置 provider 的全部模型塞进 ACP 的同一个 model 选择项里,同时:

// @oh-my-pi/pi-coding-agent src/modes/acp/acp-agent.ts:2165
options: models.map(model => ({
  value: this.#toModelId(model),                  // provider/id
  name: model.name,                               // 裸模型名
  description: `${model.provider}/${model.id}`,   // provider 只在这里
}))

而仓库里已接入的 Pi 是 name: \${provider}/${name}``,picker 原样渲染。结果就是配了多个中转的机器上,OMP 会话的模型菜单是一串无法区分的重名模型(本机 16 个 provider / 102 个模型),provider 只能靠悬停 tooltip 看到。

改法

放在 OMP 自己的供应商修补模块里,紧挨已有的 ensure_omp_yolo_config_option,只在已经判定为 OMP 的两个调用点触发:

文件 改动
manager/protocol/vendor.rs 新增 qualify_omp_model_labels:只处理 category=model 的 select;只处理 description 以同一个 provider/ 开头且 label 还没有前缀 的选项,把它写成 provider/模型名
manager/protocol/session_update.rs config_option_update 路径,在已有的 is_omp 分支里调用
manager/runner/controls_emit.rs 会话建立路径,在已有的 is_omp 分支里调用

前端一行没改(git diff master -- frontend 为空)—— picker 继续渲染 agent advertised 的 label,所以 Pi(mcgrx/…)、Claude(sonnet)都不受影响,headless/mobile 等其它客户端也自动一致。

验收

  • cargo test -p agents --lib:888 passed / 0 failed
  • 新增两个测试:qualifies_omp_model_labels_with_their_provider(含 cc-switch-open-router/stealth/ox-alpha 这种嵌套 id)、leaves_labels_that_already_name_their_provider_alone(Pi 已带前缀 / Claude 别名都不动)
  • 真机:本机 16 provider 的 OMP 会话,菜单现在显示 deepseek/DeepSeek V4.1 Flash 1017、xai-oauth/Grok 4.20 (Non-Reasoning) 等

注意:预会话的模型列表来自 10 分钟 TTL 的能力目录缓存,改完要等缓存刷新(或新建会话)才看得到新标签。

OMP lists every model of every configured provider in one `model` select and
names each choice with the bare model name, keeping the provider in the
description. Pi — the multi-provider agent this repo already ships — names its
choices `provider/model`, and that is what the pickers render, so a machine with
several providers showed OMP models that could not be told apart.

Qualify the labels in the OMP vendor module beside `ensure_omp_yolo_config_option`
and call it from the two places that already gate on the OMP agent, before any
config options leave the manager. The pickers keep rendering the advertised
label, so Pi and Claude are untouched.
@moxi-2534

Copy link
Copy Markdown
Contributor Author

CI 说明:这个 PR 的 12 个 job 全部在 actions/checkout 阶段失败,与本改动无关。

fatal: No url found for submodule path '.agents/skills/bilibili-cli' in .gitmodules
  • .gitmodules 目前只有 mobile/ios、mobile/android;
  • 但 tree 里 .agents/skills/bilibili-cli 是 160000 gitlink(由 da70ae94 加入);
  • 因此任何 submodules: true 的 checkout 都会挂。master 自己的 run 43175276267(同一提交)同样失败。

本分支相对 master 只多 3 个 crates/agents 文件,后端测试在本地 cargo test -p agents --lib 为 888 passed / 0 failed。修掉那个悬挂 submodule 后 CI 即可恢复。

@DimoADE
DimoADE merged commit eac498a into DimoADE:master Nov 18, 2026
0 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants