ccswitchmulti icon indicating copy to clipboard operation
ccswitchmulti copied to clipboard

[Bug][Codex V2] SSOT 恢复/启动接管后 Codex 模型菜单乱序(sortIndex 丢失)+ 工作区随机错乱

Open zhushihao opened this issue 3 months ago • 2 comments

症状

Codex 桌面端模型选择菜单(picker)顺序混乱:SSOT 恢复 / 启动接管 / 热切换后,模型顺序退化为默认供应商顺序,与用户在 MultiRouter 工作台里手动拖拽的顺序不一致。

同时存在偶发的工作区错乱:应用打开时随机落在错误的 provider 工作区(如公司 MultiRouter 而非当前激活的 provider)。

根因

两条独立链路:

  1. 菜单乱序(排序信息丢失):write_live_with_common_config(SSOT 恢复 / 启动接管)与 write_codex_takeover_live_for_provider(热切换)写 live config 时,从 router 的 raw settings_config.modelCatalog 读模型——那是无 sortIndex 的旧投影快照(投影 settings 从不写回 router)。sort_codex_catalog_specs_for_picker 读不到 sortIndex → 走默认供应商排序 → 菜单乱序。而 UI 显示正确(前端 projectCodexModelCatalog 实时投影从 target 读 sortIndex),造成"UI 对、菜单乱"的割裂。
  2. 工作区错乱:selectedPlan 兜底 routingPlans[0],其顺序来自 Object.values(providers)(对象键枚举序,不稳定),应用打开时随机落在错误的 provider 工作区。

修复(4 个 commit,均基于 v3.19.2-16)

  • 5ad6e6e3(1910de21):write_live_with_common_config 对 schema-v2 router 先 build_projection_artifact,用投影 settings(含 sortIndex + 依赖指纹)写 live,与 publish_codex_multirouter_projection 输出一致
  • 4fa86cbc(62316d8f):takeover 写路径同样改用投影产物(覆盖启动接管 / 热切换 / 回滚路径)
  • d5e1f1df(ef13f256):write_codex_takeover_live_for_provider 出口无条件用投影后的 modelCatalog 覆盖(修复 sync 标志注入 raw modelCatalog 导致投影替换被跳过的问题)
  • 7b341b46(65830284):workspace 默认选择改为「显式选中 plan → 激活的 codex provider → routingPlans[0]」,消除对象枚举序的不确定性

备注

  • build_projection_artifact 提升为 pub(crate) 供 services 层复用
  • 涉及文件:projection.rs / services/provider/live.rs / services/proxy.rs / CodexRouterWorkspacePage.tsx

zhushihao avatar Aug 23 '26 11:08 zhushihao

此 issue 已超过 60 天没有活动,已被标记为 stale。 如果此问题仍然存在,请回复以保持 issue 打开状态,否则将在 14 天后自动关闭。

This issue has been automatically marked as stale because it has not had activity for 60 days. Please reply to keep it open, otherwise it will be automatically closed in 14 days.

github-actions[bot] avatar Oct 23 '26 03:10 github-actions[bot]

此 issue 因长时间无活动已被自动关闭。如果问题仍然存在,欢迎重新打开。

This issue has been automatically closed due to inactivity. If the problem persists, feel free to reopen it.

github-actions[bot] avatar Nov 06 '26 05:11 github-actions[bot]