Find host CLIs outside PATH, and never show an empty model list - #608
Conversation
Switching the chat to Opencode showed no models: the service had been started without ~/.opencode/bin on PATH, so a CLI that is installed and authenticated looked "not installed" and the picker rendered blank with no explanation. - host_bins.find() searches PATH first, then the well-known install dirs each host uses (~/.opencode/bin, /opt/homebrew/bin, ~/.local/bin, …). Codex, Opencode, Node and `briefloop doctor` all resolve through it, and the not-found messages say where we looked. - The model picker explains an empty or failed catalogue instead of showing a blank list, both inline in the composer and in the searchable picker. - Tests: a binary outside PATH is still found; an empty catalogue renders a disabled explanation entry.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Review(已合入,作跟进记录)复现路径对:服务 PATH 里没有 跟进(不必回滚)1. 实际用 pdftotext / curl 的路径还在 2. 可搜索面板仍不像下拉那样说明原因。 3. 未覆盖的安装位置。 没有 nvm(
结论: 已合入的修复对「切到 Opencode 下拉是空的」够用。pdftotext 抽取和 browse 面板诊断值得另开一小笔。 |
| const models=modelCatalogs.get(modelTargetBackend(input?.id))?.models||[]; | ||
| const backend=modelTargetBackend(input?.id),catalog=modelCatalogs.get(backend),models=catalog?.models||[]; | ||
| for(const model of models)select.add(new Option(model.name+' · '+model.id,model.id)); | ||
| if(!models.length){const warn=new Option(emptyCatalogLabel(backend,catalog),'__empty__');warn.disabled=true;select.add(warn)} |
There was a problem hiding this comment.
内联下拉有禁用说明项,很好。可搜索面板(renderModelPicker)成功但 0 条时仍是「0 个模型」+「没有匹配的模型」,没用 catalog.diagnostic。PR 正文写了两处都解释,browse 还差这一截。
切到 Opencode 后模型下拉是空的。复现出来是
/api/models?backend=opencode返回 400「Opencode CLI 未安装」,而 CLI 明明装在~/.opencode/bin/opencode(1.18.30,服务也在跑)——服务启动时 PATH 里没有这个目录,于是"装好并登录过的宿主"被当成没装,功能静默消失。这次修的是这一类问题,不只这一例:
host_bins.find():先查 PATH,再查各宿主常用的安装目录(~/.opencode/bin、/opt/homebrew/bin、~/.local/bin、~/.bun/bin、~/.npm-global/bin、~/.dsh/bin等)。Codex、Opencode、Node 以及briefloop doctor全部走同一个解析,找不到时的报错也会说明查过哪些位置。实测:把服务的 PATH 设成只有/usr/bin:/bin,仍然能找到 opencode / codex / node / pdftotext。验证:
python -m pytest -q182 passed;node tests/frontend_model_selection.mjs通过;本机服务重启后/api/models?backend=opencode返回 396 个模型。