fix(pi): SuperGrok Grok 4.6 可热切,并收紧 live catalog 刷新 - #2818
Conversation
|
| Filename | Overview |
|---|---|
| packages/maker-core/src/agents/pi/index.ts | 为运行中 Pi 会话增加受限的 xAI 目录刷新、switch_session 重载、失败回滚和未确认状态下的 fail-closed 终止。 |
| apps/desktop/src/main/maker-host/pi-host.ts | 生成 ChatGPT/xAI 模型别名、xAI 占位凭证、Grok 4.6 catalog addition,并校正官方推理能力。 |
| apps/desktop/src/main/maker-host/active-catalog.ts | 将 Grok 4.6 discovery 与官方推理梯子合并,同时保留其他 xAI 模型的账号 discovery 能力。 |
| apps/desktop/src/main/maker-host/catalog-to-descriptors.ts | 在 Pi descriptor 投影中保留 xAI Grok 4.6 的显式推理档位。 |
| packages/model-providers/catalog/pi-model-catalog.json | 将 Grok 4.6 标记为支持 reasoning effort,并补齐包含 xhigh 的 thinkingLevelMap。 |
| tools/pi/xai-catalog-corrections.mjs | 为目录同步提供 Grok 4.6 官方推理能力校正,防止后续同步覆盖 xhigh 和默认 high。 |
Sequence Diagram
sequenceDiagram
participant UI as 模型选择器
participant Host as PiAgent
participant Catalog as Native Provider Resolver
participant File as models.json
participant Pi as Pi 进程
UI->>Host: setModel(xai/grok-4.6)
Host->>Catalog: 解析最新 SuperGrok provider
Catalog-->>Host: xAI provider + 占位 env
Host->>Host: 校验 endpoint/header/env 未变化
Host->>File: 写入 Grok 4.6 catalog addition
Host->>Pi: switch_session(sessionPath)
alt 重载成功
Pi-->>Host: success
Host->>Pi: set_model(xai, grok-4.6)
else 明确失败
Pi-->>Host: "success=false"
Host->>File: 恢复旧目录
Host-->>UI: 切换失败
else 结果未确认
Pi--xHost: 超时或连接异常
Host->>Pi: 终止会话
Host-->>UI: PI_CATALOG_RELOAD_UNCONFIRMED
end
Reviews (14): Last reviewed commit: "fix(pi): 钉回网关时不要按 xai/ 前缀热刷目录" | Re-trigger Greptile
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f6d4812d7
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2a450c4ef2
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ddd2bc08f
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 21721556b7
ℹ️ 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".
MagicLizi
left a comment
There was a problem hiding this comment.
- P1 packages/maker-core/src/agents/pi/index.ts:2552-2555 — 新增用户可见错误文案「已终止本会话」「重开会话」违反 docs/product-rules/task-and-conversation-naming.md §6.0.2 的 forbidden 译法(session 面向用户一律叫「任务」),且该错误无错误码:renderer 的 extractIpcError 只认 [CODE] 形态,落到主展示路径上只会弹泛化「切换失败」toast——「任务已终止、需重开」的可行动解释根本到不了用户眼前,这正是 §6.0.4「一句一句追展示路径」点名的漏判。建议:仿照同 handler 的 CREDENTIAL_SWITCH_BUSY 模式,抛带错误码的错误(如 [PI_CATALOG_RELOAD_UNCONFIRMED])并在 renderer 补五语 i18n;文案用「任务」口径(如「模型目录重载未确认,已终止本任务,请重新打开任务后再切换模型」)。
MagicLizi
left a comment
There was a problem hiding this comment.
审查发现 1 个 P1:
P1 — packages/model-providers/src/tests/piCatalogCorrections.test.ts:6
新测试 import { applyKnownXaiCorrections, preferredDefaultEffort } from '../../../../tools/pi/xai-catalog-corrections.mjs' 引入的根目录工具没有类型声明,在 model-providers 自己的 tsconfig(strict)下 pnpm --filter @cindy/model-providers run build(tsc --noEmit)新增一个 TS7016(implicit any)。该命令此前已有 2 个存量错误(catalog.test.ts:684/686,与 main 逐字节一致),本 PR 让它变成 3 个。诚实口径:不破坏任何强制门禁(该 package 没有 typecheck script,提交门禁自动跳过,CI 只 typecheck desktop/mobile,typecheck-merged 只跑 desktop tsconfig,desktop typecheck 通过)——但你触碰的 package 比来时更不可编译,且之后修存量 2 错的人会踩到这颗新雷。
建议(便宜):给 tools/pi/xai-catalog-corrections.d.mts 补一份匹配声明;或把 corrections 表挪进 packages/model-providers/src/、由同步工具从那里读。
验证方式:pnpm --filter @cindy/model-providers run build 应只剩 catalog.test.ts:684/686 两条存量错误。
其余无 P0:live catalog 收紧的端点/header/env 相等守卫、switch_session 失败原子回滚、未确认 reload fail-closed、remote 路径拒绝启动后才加的 xAI 代理等全部核实通过;我实际跑过 desktop typecheck(pass)、piNativeProviders/activeCatalogDiscovery(65/1)、maker-core pi-provider-routing(47)、model-providers catalog+corrections(58)全部通过,DCO 通过。ghostInstallReceipt.test.ts 的 2 个失败与 main 一致、与本 diff 无关。
|
@dashhuang 👋 这个 PR 目前与 请在本地 merge 最新的 |
当前 head 已修复此前 CR 指出的问题(格式门/安全门已通过),自动 dismiss 以解除合并阻塞
e82d2e0 to
d708d97
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d708d9715e
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4c8a9ecd49
ℹ️ 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".
|
@dashhuang 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/main/maker-host/active-catalog.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
|
@dashhuang 👋 这个 PR 目前与 请在本地 merge 最新的 |
4c8a9ec to
77a118e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 77a118e6b6
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b1acd5bc63
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fa5cd15d65
ℹ️ 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".
合并前不变量(第 10 轮后冻结)本 PR 不再给 live catalog 热切加 RPC / precheck / 复水。人审可按下面核对:
Claude/Codex 静态目录留给 #2601。 |
afa3978 to
ee20056
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ee20056744
ℹ️ 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".
MagicLizi
left a comment
There was a problem hiding this comment.
Code review passed (heavy): SuperGrok hot-switch and catalog tightening are correct. All 10 rounds of prior bot-flagged bugs verified fixed. No malicious code or exfiltration patterns found.
Pi 0.83 自带 xAI 目录没有 grok-4.6。订阅 inheritModels 块此前既没有 占位 apiKey,也不会把缺失模型写成 catalog addition,set_model 会报 Model not found。补上 apiKey、xai/ 别名,并把未探测到的 grok-4.6 写成 openai-responses catalog addition。 热刷新只允许 SuperGrok 在占位 env / endpoint / header 未变时补模型; switch_session 失败会回滚 maps 与 models.json。ChatGPT 别名改回指向 chatgpt/gpt-* spec id,避免回落到 cindy 网关。 Signed-off-by: Dash <dashhuang@gmail.com>
success:false 仍回滚 models.json。reject/超时无法判断 Pi 是否已加载新目录, 回滚和放行都会分叉,按未确认 set_model 一样关掉进程,要求用户重开任务。 Signed-off-by: Dash <dashhuang@gmail.com>
inheritModels 里没有 api/catalogAddition 的行是 Pi 自带目录,热切不应 走 live refresh。远端会话启动时若没有 session token / 代理登记,登录后 新出现的 hostProxyForward 会建隧道但鉴权失败,改为拒绝并要求重开任务。 Signed-off-by: Dash <dashhuang@gmail.com>
Pi and SuperGrok still advertised only low/medium/high because the bundled Pi snapshot and inheritModels overlay never published xhigh. Keep Claude/Codex static catalog out of this change so it does not collide with #2601. Signed-off-by: Dash <dashhuang@gmail.com>
readPiBundledModels 超时返回 null 时,不能把 grok-4.3 / grok-build-0.1 默认改成 openai-responses。只在探针成功且明确缺 grok-4.6 时合成 addition,保留 xhigh 那条 official thinking overlay。 Signed-off-by: Dash <dashhuang@gmail.com>
官方梯子是 low/medium/high/xhigh。toDescriptor 给 Pi 自动前置 minimal, 但 thinkingLevelMap.minimal 是 null,setEffort 会失败。xAI grok-4.6 保留目录里的显式档位,不合成 minimal。inheritModels overlay 不动。 Signed-off-by: Dash <dashhuang@gmail.com>
与 origin/main 的 listed-models 缺席证明对齐,不再用 bundled 表推断 xAI addition。未确认 switch_session 抛 [PI_CATALOG_RELOAD_UNCONFIRMED], 用户文案改用「任务」。给 xai-catalog-corrections.mjs 补声明,消除 model-providers 新增的 TS7016。 Signed-off-by: Dash <dashhuang@gmail.com>
SuperGrok discovery 给 4.5 等其它模型报出的缩水档位不再被静态目录并回 low/medium/high/xhigh。4.6 仍用已知官方梯子补 xhigh。inheritModels overlay 不动。 Signed-off-by: Dash <dashhuang@gmail.com>
官方 high / xhigh 只作用于 Grok 4.6。其它模型若 discovery 给出且落在 其档位列表里的 defaultEffort,不再被 registry / 静态目录盖掉。 Signed-off-by: Dash <dashhuang@gmail.com>
listedIds 证明缺席时不再给任意 xAI 行打 catalogAddition。目录回滚先写盘再 改内存;写失败与未确认 switch_session 一样终止任务,避免磁盘/内存分叉。 Signed-off-by: Dash <dashhuang@gmail.com>
switch_session 只带 sessionPath,会丢 navigateTree 的非最新叶。本 PR 不引入分支/plan mode 复水;当前叶不是 JSONL 重载默认叶时回滚目录并 拒绝热切,要求重开任务。 Signed-off-by: Dash <dashhuang@gmail.com>
This reverts commit fa5cd15. Signed-off-by: Dash <dashhuang@gmail.com>
ee20056 to
c4efd6a
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c4efd6a99f
ℹ️ 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".
MagicLizi
left a comment
There was a problem hiding this comment.
审查结果:P1×1
P1: switchModel — null 与 undefined 混淆导致 gateway-pin 请求误触 xAI 热加载路径
位置: packages/maker-core/src/agents/pi/index.ts:2763-2794
问题: 新增的 xAI hot-reload 触发器使用 ?? 判断 requestedProviderId:
const sourceHint = requestedProviderId
?? (model.startsWith('xai/') ? 'xai' : undefined);当调用方传入 requestedProviderId: null(代码中已明确注释为"固定走默认路由 cindy,绝不按模型自动挑 BYOM"语义,见 index.ts:1038-1044)且 model 以 xai/ 开头时,?? 不会短路(null 不被跳过),sourceHint 仍解析为 'xai',导致:
- 一个明确要求走网关的请求被误导入 xAI native catalog 刷新路径
- 执行不必要的
resolvePiNativeProviders()异步探测 + 磁盘写入 + switch_session RPC - 若刷新失败(如无 SuperGrok 登录)进入
restoreNativeCatalogOrTerminate(),磁盘回写再失败时调用terminateUnconfirmedCatalogReload终止会话 — 该请求本身与 xAI 完全无关
修复建议: 将 requestedProviderId ?? 改为显式判断 requestedProviderId === undefined,使 null(gateway-pin)永远不触发 xAI reload 逻辑。
其余改动(effort 合并、catalog corrections、capability wiring、i18n)审查通过,无其他问题。安全扫描未发现凭证泄露或恶意代码。
switchModel 用 ?? 取 sourceHint,providerId=null(钉回 Cindy 网关)会落到模型名前缀回退,误进 SuperGrok live catalog 刷新;刷新失败还可能终止任务。只在未传 providerId 时才按 xai/ 推断。 Signed-off-by: Dash <dashhuang@gmail.com>
|
已修 MagicLizi 的 P1:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 451415bdfe
ℹ️ 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".
MagicLizi
left a comment
There was a problem hiding this comment.
✅ 自动审查通过(heavy tier + 安全扫描)
审查范围:SuperGrok Grok 4.6 热切 + live catalog 刷新收紧。
验证项:
- 测试通过:pi-provider-routing (66/66), activeCatalogDiscovery/catalogDerivedModels/piNativeProviders (104/105), catalog.test + piCatalogCorrections (58/58)
- typecheck clean
refreshLiveXaiCatalogfail-closed 设计验证:reload 成功/拒绝+回滚/回滚失败→terminate/RPC 超时→terminate 四分支均有测试- 安全检查:无凭证泄露、无 eval/外发路径、env var 符合 spawn-env-stability 不变量
P2(不阻断):
isOfficialGrok46Id在 3 个文件中重复硬编码,建议后续统一refreshLiveXaiCatalog的 memory-then-disk 写入顺序与同文件 disk-first 惯例不一致(当前有自愈兜底,不影响正确性)
|
合并了 🎉 SuperGrok 热切的 fail-closed 四分支设计很扎实——reload/rollback/terminate 的边界划得干净利落,用 |
这次改了什么
摘要
Pi 任务切到 SuperGrok Grok 4.6 会报
Model not found。原因是 pinned Pi 0.83 自带 xAI 目录没有 grok-4.6,订阅 inheritModels 块又不会把它写成 catalog addition,getAvailable()看不到这个模型。本 PR 把未探测到的 grok-4.6 写成
openai-responsescatalog addition,给 xAI 补占位 apiKey 和xai/grok-4.6别名。登录后热刷新只允许 SuperGrok 在占位 env / endpoint / header 未变时补模型;switch_session失败会回滚。ChatGPT 别名改回指向chatgpt/gpt-*spec id,避免订阅路由掉回 cindy 网关。另外补上官方推理档:Grok 4.6 支持
low / medium / high(默认)/ xhigh。Pi 快照和 inheritModels 以前没发布 xhigh,选择器只有低/中/高,选了也不会发给 xAI。现在缺失模型和档位过期的 bundled 行都会带上官方梯子。Claude/Codex 静态目录留给 #2601,本 PR 不碰。变更类型
fix缺陷修复feat新功能refactor/perf重构或性能优化docs/test/chore文档、测试或工程维护范围
getAvailable()能看见已配置的 xAI 模型models[].id,UI 的xai/grok-4.6落到 wire idgrok-4.6xhigh,默认highUI 变化
不涉及:档位条目由目录驱动,没有新的视觉 / 交互 / 文案规则。
怎么验证的
自动验证
pnpm test:unit里ghostInstallReceipt.test.ts有 2 条失败。已在干净origin/main复现,与本 diff 无关,交给 CI 兜底。手工验证
隔离沙箱
Cindy-dev2-pi-live-catalog(--region=cn --isolated=pi-live-catalog)里,新建 Pi 任务后切到 Grok 4.6 可通过。用户已确认热切。xhigh 档位未再做真机目检。未执行的验证
未用真实 SuperGrok 账号跑完整带工具回合;未验证远端 SSH Pi;未在实机点选「超高」发一回合。
风险
风险分类
影响与回滚
models.json热写。热刷新故意不改已 spawn 进程的 env,避免把旧 BYOM 凭证带到新 endpoint。xhigh 进入 inheritModels overlay 与 Pi 快照。models.json启动,回退后重开会话即可。提交前检查
git commit -s,见 DCO)