Repository navigation
Conversation
修复创建新 Worker 弹窗默认落回 Grok 等首个可用 Codex 模型的问题: - 桌面端、移动端与 @cindy/device-link 跨端同步均完整记忆上次提交的 Worker 模型路线,覆盖内置模型(含合并供应商路由)、插件引擎(ACP,含合并来源路由)与自定义智能路由,不再因非内置路线覆盖污染旧版逐 Agent 槽位。 - 当前账号与宿主机尚无已保存的 Worker 模型记忆时,弹窗默认跟随当前主任务(Lead)正在使用的模型(内置模型、插件引擎或自定义智能路由),并在无 Lead 信息回退收敛时优先使用模型声明的默认项。 - 修正合并供应商来源路由(onAttach)清空已选插件引擎的问题,以及远程 Lead 能力/插件目录加载竞态与不可用路由回退细节。 Assisted-by: Cindy (https://cindy.app) Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
zqchris
left a comment
There was a problem hiding this comment.
Auto-approved by Chris’s trusted-author rule for makecindy/cindy. This is an automated approval.
Confidence Score: 4/5
[Medium impact] The changes affect Worker creation and route memory across desktop, mobile, and linked devices. 应先修复已保存 ACP 模型失效时的静默替换,再合并。 Findings
Fix with agent prompt### Issue 1
apps/desktop/src/renderer/features/cc-agent/CreateWorkerPopover.tsx:1042-1046
用户上次保存了 ACP 模型 `pro`,但插件后来只列出 `basic` 时,`resolveActivePluginEngine` 会返回 `modelId: 'default'`,而不是空值。这里的 `!activePluginEngine` 因此为假,不会显示模型不可用提示,提交按钮也保持可用。提交还会把原先保存的 `pro` 覆盖为 `default`。
这违背了本次修复承诺的“已保存模型失效时不静默切模型”。请检查恢复的具体模型是否仍可用;失效时保留原选择、提示不可用并阻止提交。用户明确选择的 `default` 则继续允许。
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
|
| const restoredPluginEngineUnavailable = | ||
| pluginEngineOrigin === 'restored' | ||
| && pluginEngine !== null | ||
| && !activePluginEngine | ||
| && !pluginEngineLoading; |
There was a problem hiding this comment.
用户上次保存了 ACP 模型 pro,但插件后来只列出 basic 时,resolveActivePluginEngine 会返回 modelId: 'default',而不是空值。这里的 !activePluginEngine 因此为假,不会显示模型不可用提示,提交按钮也保持可用。提交还会把原先保存的 pro 覆盖为 default。
这违背了本次修复承诺的“已保存模型失效时不静默切模型”。请检查恢复的具体模型是否仍可用;失效时保留原选择、提示不可用并阻止提交。用户明确选择的 default 则继续允许。
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/renderer/features/cc-agent/CreateWorkerPopover.tsx
Line: 1042-1046
Comment:
**已保存模型被静默替换**
用户上次保存了 ACP 模型 `pro`,但插件后来只列出 `basic` 时,`resolveActivePluginEngine` 会返回 `modelId: 'default'`,而不是空值。这里的 `!activePluginEngine` 因此为假,不会显示模型不可用提示,提交按钮也保持可用。提交还会把原先保存的 `pro` 覆盖为 `default`。
这违背了本次修复承诺的“已保存模型失效时不静默切模型”。请检查恢复的具体模型是否仍可用;失效时保留原选择、提示不可用并阻止提交。用户明确选择的 `default` 则继续允许。
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 4 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7d5d02a. Configure here.
| if (remoteCatalogues.get(key) !== null && remoteCatalogues.get(key) !== undefined) return true; | ||
| const peer = selectableDevices.find((device) => device.deviceId === target); | ||
| return peer !== undefined && !peer.online; | ||
| }, |
There was a problem hiding this comment.
Lead plugin engine dropped early
High Severity
isDeviceSettled treats a plugin-engine device as settled when it is not yet in remoteSources. On open, the peer list is often still empty, so a Lead or restored engine on another computer looks missing. The Lead fallback then clears pluginEngine and does not restore it after the catalogue arrives, so the worker is created with the built-in model instead.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 7d5d02a. Configure here.
| setModel(fallbackPrefs.model); | ||
| setEffort(fallbackPrefs.effort); | ||
| setFast(fallbackPrefs.fast); | ||
| setProviderSource((leadDeviceId && !prefsFromHost) || leadLocation ? null : fallbackPrefs.providerId); |
There was a problem hiding this comment.
Unavailable Lead engine keeps stale model
Medium Severity
When the Lead model is an ACP engine, the built-in fallback is taken from stored[stored.lastAgent], which can still be the old per-agent slot such as xai/grok-4.7. If that engine is missing or not allowed, clearing pluginEngine leaves that stale model in place instead of the Lead model or the newSessionDefault model.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 7d5d02a. Configure here.
| deviceId: ctx.deviceLinkDeviceId, | ||
| agentDeviceId: leadSession ? (leadSession.agentDeviceId ?? null) : undefined, | ||
| leadPermissionMode: leadSession?.permissionMode ?? null, | ||
| leadModel: leadModelDefaultFromSession(leadSession), |
There was a problem hiding this comment.
Sidebar ignores effective Lead binding
Medium Severity
The session view follows the Lead model from effectiveManagedBinding, but the sidebar worker panel calls leadModelDefaultFromSession(leadSession) with the raw session binding. When the managed binding differs, creating a worker from the sidebar does not follow the model the main task is actually using.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 7d5d02a. Configure here.
| name: binding.routeName?.trim() || binding.selection.id.trim(), | ||
| ...(binding.isSourceRoute ? { isSourceRoute: true } : {}), | ||
| } | ||
| : null; |
There was a problem hiding this comment.
Mobile Lead route ignores device
Medium Severity
orcaLeadModelDefaultFromSession treats any route binding as a local Lead model group. Unlike the desktop helper, it does not ignore bindings that carry another computer's deviceId, so the worker form can follow a cross-device route that does not exist on the task host.
Reviewed by Cursor Bugbot for commit 7d5d02a. Configure here.


这次改了什么
摘要
修复协同模式「创建新 Worker」弹窗在未记忆内置模型时默认落到
Grok 4.7等首个可用 Codex 模型的问题。原先存在三处叠加缺口:
codex+codex/gpt-5.5起步;若当前账号未连接提供该模型的默认 OpenAI 渠道,收敛逻辑会回退到activeModels[0](按内置供应商序可能落到 xAI 的xai/grok-4.7)。modelSelectionByHost,反而把底层未生效的旧内置模型写进workerCreationPrefs,重开时又清空了modelGroup。onAttach挂载合并来源路由(src:...)时会清空已选pluginEngine,且提交插件引擎时直接返回未落盘/未同步角色与宿主机记忆。本次在桌面端、移动端与
@cindy/device-link跨端同步链路统一补齐:newSessionDefault),而非盲取列表首项。变更类型
feat新功能fix缺陷修复refactor/perf重构或性能优化docs/test/chore文档、测试或工程维护范围
packages/device-link/src/orcaWorkerRoles.ts:向后兼容地追加pluginEngine、modelGroup与model.modelGroup协议字段,并校验单条目/单次提交路线互斥。workerCreationPrefs.ts、CreateWorkerPopover.tsx、usePluginEngines.ts、usePickerPluginEngines.ts,以及CCAgentSessionView.tsx、OrcaWorkerPanel.tsx、OrcaWorkersTabBody.tsx、NewMakerDraftRoute.tsx传入当前 Lead 模型默认值。orcaWorkerPrefs.ts、orcaWorkerRoles.ts、useSessionOrcaCollab.ts、apps/mobile/app/sessions/new.tsx同步对齐三类路线记忆与 Lead 默认跟随。create_workers非内置模型工具默认值扩展(readLocalWorkerCreationSelection仅继续输出归一化后的内置模型路线)。UI 变化
不涉及。
怎么验证的
自动验证
新增/更新单测价值与实测耗时(
engineering-conventions.md§3.2):packages/device-link/src/__tests__/orcaWorkerRoles.test.ts(单文件实测782ms,unit):生产入口parseOrcaWorkerRoles/parseOrcaWorkerRolesMutation;验证追加的pluginEngine、modelGroup、model.modelGroup跨端往返与路线互斥拒收,防止协议字段静默丢弃或写入冲突路线。apps/desktop/src/renderer/state/workerCreationPrefs.test.ts(单文件实测5ms,unit/jsdom):生产入口applyWorkerRolesMutation/toRemoteWorkerRoles/readLocalWorkerCreationSelection;验证三类路线持久化、跨端往返、非内置路线不污染旧槽、不泄漏至 MCP 工具默认路由,以及仅更新权限的choice语义。apps/desktop/src/renderer/features/cc-agent/__tests__/CreateWorkerPopover.test.tsx(单文件实测5.09s,unit/jsdom):生产入口CreateWorkerPopover;覆盖无保存模型时跟随 Lead(内置/插件引擎/自定义路由)且忽略旧污染槽、newSessionDefault优先收敛、提交插件引擎(含onAttach合并来源路由)与自定义智能路由后重开恢复,以及已保存路线失效阻断 vs Lead 路线失效安全回退。apps/desktop/src/renderer/hooks/__tests__/usePickerPluginEngines.test.tsx(单文件实测9ms,unit/jsdom):生产入口usePickerPluginEngines;验证enabled=false时不再触发usePluginEnginesSettled订阅。apps/mobile/src/__tests__/useOrcaWorkerForm.test.tsx(单文件实测219ms,unit):生产入口useOrcaWorkerForm;覆盖移动端无宿主记忆时跟随 Lead 三类模型、提交插件引擎(含onAttach不清空acp)与自定义路由写回宿主机并重开恢复,以及旧宿主不支持supportsOrcaWorkerAgentDevice时省略agentDeviceId。读写与订阅开销说明(
engineering-conventions.md§8):usePluginEnginesSettled(enabled)严格受enabled && !hostDeviceId门控,弹窗关闭或处于远端控制时不建立额外订阅、不发额外 IPC;DeviceCatalogue.isSettled()仅在首次失败/不支持状态跃迁时触发一次本地订阅者通知,不增加任何新的远程调用或轮询。maker:worker-roles:get/maker:worker-roles:apply单次调用,单条角色或defaults仅增加可选pluginEngine/modelGroup字段(推导增量 < 200 字节/条目),无新增通道与额外往返。手工验证
不涉及(已通过桌面端与移动端核心交互单测及类型检查覆盖完整状态机;未启动真实 Electron / iOS 模拟器手工点测)。
未执行的验证
未执行真实 Electron 客户端界面与 iOS/Android 真机/模拟器端到端手工联调(本任务在隔离 worktree 中完成代码与自动化回归验证,等待 PR CI 流水线进一步校验)。
风险
风险分类
影响与回滚
@cindy/device-linkmaker:worker-roles:get/apply可选字段解析。pluginEngine、modelGroup、model.modelGroup)均为可选追加字段。新控制端连旧宿主机时,choice.agent仍携带合法内置 Agent,旧宿主机忽略未知字段且不报错;旧控制端连新宿主机时,旧端忽略新增可选字段并沿用原有内置回退行为。提交前检查
git commit -s,见 DCO)apps/docs或说明自动同步会从哪些来源更新(本次无新入口或文案变化)。Assisted-by: Cindy (https://cindy.app)
Note
Medium Risk
Touches cross-platform Orca worker creation, optional device-link role sync fields, and ACP/model-group state machines; regressions could mis-default models or block create, but behavior is guarded by tests and backward-compatible optional protocol fields.
Overview
Creates new Worker and enable collab flows now default the model picker to the Lead task’s current model (built-in, plugin engine, or smart route) when there is no saved per-host Worker route, instead of falling back to stale per-agent prefs or the first Codex entry (e.g. Grok).
Persistence and restore are extended so submitted routes are stored and synced as a single discriminated shape: built-in (optional merged
src:route), ACP plugin engine (including merged source routes without clearing the engine ononAttach), and custom model-group-only routes. Non-built-in choices do not overwrite legacylastAgent/ per-agent slots; invalid saved routes block submit with saved model unavailable, while invalid Lead-inherited routes fall back cleanly.Wiring passes
leadModelfrom session/draft intoCreateWorkerPopover/OrcaWorkerPanel(desktop) anduseOrcaWorkerForm(mobile).usePickerPluginEnginesexposesisDeviceSettledso restore does not treat loading catalogs as “engine missing.”Reviewed by Cursor Bugbot for commit 7d5d02a. Bugbot is set up for automated code reviews on this repo. Configure here.