feat(MOC-236): 池化模型路由后端引擎(exposeAllProviderModels)#476
Conversation
加 provider 后所有模型可进统一池,Codex 按模型选择,proxy 按 catalog slug `<provider>/<model>` 自动分流到对应上游;切模型不再重写 config / 重启 Codex。 - registry: unique_pool_slugs(确定性排序 + 碰撞 -N 后缀)/ pooled_model_ids (pooledModels → 回退槽位映射)/ build_catalog_slug_map - proxy: StaticResolver.catalog_slug_map 反查表,decide_provider 先精确查表 再回退;空表 = 行为与池化前一致 - codex_integration: catalog_models_for_pool(provider-qualified 显示名)+ ApplyConfig.pool + 泛化 root model 锚定 - src-tauri: snapshot build_pool_catalog 全 provider 构建 + 编排,proxy_runner 按开关建反查表,save_settings 翻开关 re-apply + needsCodexRestart(失败 surface) 默认关时行为零变化。catalog 生成端与路由端共用 unique_pool_slugs 保证 slug 逐字 一致、不错路由(含跨进程一致性单测)。Phase 0 已用真机 codex debug models 实证 catalog 接受斜杠 slug。前端(pooledModels 抓取持久化 + provider→model 级联选择)后续搭车。 Refs MOC-236
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 31f4c090c9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- 保留 [1m] 1M 信号:新增 pooled_models_with_one_m + PoolEntry.supports_one_m, 让仅靠 [1m] 标 1M 的自定义模型(无 modelCapabilities / 非 documented)在池模式 也拿 1M 窗口,与单 provider 模式一致 - 全新 pool config(config.toml 无 root model)锚到 pool_default_slug,避免 Codex 隐式默认 gpt-5.5 不在池 catalog(全是 <provider>/<model> slug) Refs MOC-236
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2047775233
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
bot review P2:池模式下 catalog/路由依赖**全部** provider,但原 CRUD 只在 active provider 变更时 re-sync —— 增删改 / autofill / reorder 一个**非 active** provider 后, Codex picker 漏新模型、被删 provider 的 slug 仍用陈旧 in-memory 凭据路由,直到下次 无关 re-apply / 重启才纠。 - 新增 providers::resync_pool_if_enabled(开池才动、单模式整体 no-op) - 接入 add_provider / update_provider / delete_provider / reorder_providers / save_draft / autofill_provider_models(均补 State<AdminState>,axum 自动注入、无需改路由) - update_models 改 was_active → was_active || pool_on 才 sync 单模式行为零变化(helper no-op、update_models 退回原 was_active 门)。 Refs MOC-236
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a63e3984c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
bot review P2:save_settings 之前返回的 needsCodexRestart / exposeAllProviderModelsWarning 被前端 CCApi.saveSettings wrapper 丢弃(它只透传 webFetchSyncWarning)。本 PR 后端 only, 故去掉这两个尚无前端消费方的响应字段;re-apply 失败改为后端 tracing::error 记录(不静默吞)。 用户面 toast / 「需重启 Codex」引导属池化前端 UX,随 follow-up 落地。 Refs MOC-236
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fa1d281f42
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
bot review P2:resync_pool_if_enabled 用 `let _ =` 丢弃 sync 结果 —— re-apply 失败 (proxy 重启绑定失败 / apply 出错)时 CRUD 仍报成功,Codex 被留在停掉 / 陈旧的 proxy+catalog 却无任何记录。改为检查 sync 结果,attempted 但 !success 时 tracing::error(POOL_CRUD_RESYNC_FAILED)。不阻塞 CRUD(config 已落盘,幂等补偿)。 Refs MOC-236
做了什么
Codex「池化模型路由」后端引擎:开启
exposeAllProviderModels后,所有 provider 的模型进一个统一池,Codex picker 选任意模型,proxy 按 catalog slug<provider>/<model>自动分流到对应上游 —— 切模型不再重写config.toml/ 重启 Codex(仅增删 provider / 改模型列表 / 翻开关才需重启一次)。用户影响
needsCodexRestart提示(catalog 变更需重启 Codex 读取);re-apply 失败会 surface 不静默。范围
仅后端引擎(registry / proxy / codex_integration / src-tauri)。前端(
pooledModels抓取持久化 + 编辑流解耦 + provider→model 级联选择 UX)后续搭车本 PR / 后续 PR。验证
codex debug models实证:app 实际生成的池 catalog 被接受、进 picker、可选、按 slug 路由正确。cargo fmt/cargo machete干净、新代码零 clippy 警告;3-agent 本地审查并修复(silent-failure surfacing 等)。Refs MOC-236
🤖 Generated with Claude Code