fix(agent): prioritize Cindy Skills before downstream Skills - #1650
Conversation
Signed-off-by: zqchris <chrisz83@gmail.com>
|
| Filename | Overview |
|---|---|
| apps/desktop/src/main/maker-host/runtime-configs.ts | 将静态 Skill 来源优先级段加入 Claude 与 Codex 的 system prompt 组装流程,并保持产品身份段位于最前。 |
| apps/desktop/src/main/maker-host/skill-source-precedence-prompt.md | 定义 Cindy 侧 Skill 优先于重叠下游 Skill 的通用来源级契约及无来源标注时的处理方式。 |
| apps/desktop/src/main/maker-host/tests/runtimeConfigs.test.ts | 覆盖 Claude/Codex 的规则注入、关键契约文本及具体 Skill、selector 和本机路径不泄漏的约束。 |
| apps/desktop/src/main/maker-host/tests/piSystemPrompt.test.ts | 验证 Claude/Codex 专属的来源优先级段不会扩展到 Pi prompt。 |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Identity[产品身份段] --> Precedence[Skill 来源优先级段]
Precedence --> Claude[Claude 专属段]
Precedence --> Codex[Codex 专属段]
Identity --> Pi[Pi 专属段]
Pi -. 不注入 .-> Precedence
Reviews (3): Last reviewed commit: "fix: make Skill source precedence resolv..." | Re-trigger Greptile
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea4e0a5c35
ℹ️ 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.
🟡 Not ready to approve
新增的下游 SKILL.md 注入内容会暴露本机绝对路径且 explicitSelectors 存在易碰撞的短选择器,属于需要先收敛的安全边界问题。
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
该 PR 修复在 Cindy workdir 内下游 Codex 官方 GitHub 插件 Skill(github:yeet)可能抢先生效、从而绕过 Cindy git-workflow 工作流门禁的问题;通过在 Cindy 隔离的 Codex plugin overlay 中引入“前置 Skill 绑定”策略,确保下游 Skill 只能补充、不能替代 Cindy 的前置规则。
Changes:
- 在 capability routing policy 中新增
prerequisiteSkills类型与路由字段,表达“下游 Skill 需先绑定 Cindy-owned 前置 Skill”的依赖关系。 - Desktop 侧为
github@openai-curated/github@openai-curated-remote的github:yeet设为 explicit-only,并在隔离 overlay 的下游SKILL.md前注入git-workflow(去 frontmatter)正文,同时把前置 Skill 内容 hash 纳入快照以支持自愈重建。 - 新增回归测试覆盖:provenance 精确匹配、BOM/CRLF 保真、内容变化/删除后的 fail-closed 与自愈重建。
File summaries
| File | Description |
|---|---|
| packages/maker-core/src/types/capability-routing.ts | 为 capability routing 增加 prerequisiteSkills 类型与字段,支持“前置 Skill”策略表达。 |
| apps/desktop/src/main/maker-host/codex-global-plugins.ts | 在 Codex 插件隔离 overlay 写入前置 Skill block,并把前置 Skill 内容 hash 纳入快照用于自愈重建。 |
| apps/desktop/src/main/maker-host/capability-routing.ts | 构建 Desktop routing policy:当 git-workflow 存在时,为 github:yeet 注入 prerequisite + explicit-only。 |
| apps/desktop/src/main/maker-host/auth-adapters.ts | 在 shared skills fan-out 成功后刷新 routing policy,确保 git-workflow 安装状态能影响路由。 |
| apps/desktop/src/main/tests/codexGlobalPlugins.test.ts | 覆盖前置 block 注入、自愈重建、BOM/CRLF/frontmatter 处理等行为。 |
| apps/desktop/src/main/tests/capabilityRouting.test.ts | 新增 routing policy 构建/刷新测试,验证仅在 git-workflow 存在时绑定 GitHub publish 路由。 |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 2
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
|
@zqchris 👋 这个 PR 还有 3 条 review conversation 没 resolve(apps/desktop/src/main/maker-host/capability-routing.ts / apps/desktop/src/main/maker-host/codex-global-plugins.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
Signed-off-by: zqchris <chrisz83@gmail.com>
Signed-off-by: zqchris <chrisz83@gmail.com>
There was a problem hiding this comment.
🟢 Ready to approve
变更范围小且有针对性单测覆盖,当前仅有注释表述与实际文件内容不一致的轻微问题需要可选修正。
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Review details
Suppressed comments (1)
apps/desktop/src/main/maker-host/runtime-configs.ts:29
- 这里的注释把 hostSystemPrompt 描述为“产品身份”,但当前仓库内的 host-system-prompt.md 是空文件(composeHostPrompt 运行时会被过滤掉)。建议把注释改成更贴近实际的“host 共用段”,避免误导后续读代码的人以为身份段一定来自该文件。
// Claude / Codex 的 host system prompt:产品身份 → Skill 来源优先级 → agent 专属段。
// Skill 优先级不放 host-system-prompt.md,避免把 #1645 的 Claude/Codex 行为扩到 Pi。
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 117b3075a2
ℹ️ 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".
|
@zqchris 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/main/maker-host/skill-source-precedence-prompt.md),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
Codex review 指出上一版 prompt 引用了 available-Skills 里并不存在的 provenance 字段,同时又禁止一切按名称/命名空间推断,导致这条来源优先级 规则对模型不可执行。 改为让模型读清单里已有的来源标注(插件 / marketplace / 内置命名空间为 下游,其余归 Cindy 自有来源),并在无可用标注时 fail-closed 视作下游、 仍先跑 Cindy 侧 Skill。产品代码依旧只表达来源级规则,不含任何具体 Skill、插件、marketplace、selector 或本机路径。 Signed-off-by: zqchris <chrisz83@gmail.com>
There was a problem hiding this comment.
🟢 Ready to approve
变更范围聚焦且有针对性单测覆盖注入与隔离边界,未发现会影响运行时行为正确性的阻塞问题。
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Review details
Suppressed comments (1)
apps/desktop/src/main/maker-host/tests/runtimeConfigs.test.ts:107
- 这里用整段
prompt做not.toMatch(/\$[\w:-]+|\/(?:Users|home)\/[A-Z]:\\/)会把断言范围扩到 host identity / agent-specific prompt;后续如果 Claude/Codex 专属段需要提到$HOME、$PATH等环境变量示例或其它合法$...文本,会导致与本测试目标(仅保证“Skill source precedence”段不包含具体 selector/本机路径)无关的脆弱失败。建议把负向断言收窄到## Skill source precedence这一段落本身。
/no usable source\s+label, treat the Skill as downstream and still run the applicable Cindy-side Skill first/u,
);
// 产品侧只表达来源级规则:不得出现具体 selector、Skill 名或本机路径。
expect(prompt).not.toMatch(/\$[\w:-]+|\/(?:Users|home)\/|[A-Z]:\\/u);
}
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0434598e5d
ℹ️ 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".
|
补一条 CI 说明,避免误判:本 PR 的 失败项只有一个文件:
回归点是 #1680( expect(source).toMatch(
/longMessageCollapsed\s*\n\s*\? renderContent\(\n\s*displayBubbleBody,/,
);
expect(source).toContain('bubbleAgentReferences,\n false,');两条都把 本 PR 只改了一段 system prompt 的 Markdown 文本和 这条 Windows 红需要在 |
MagicLizi
left a comment
There was a problem hiding this comment.
审查通过,零阻断项。两条 P2 建议(prompt 措辞、测试 DRY)均非阻断。架构正确:precedence prompt 正确插入 host 与 agent-specific 之间,Pi 路径正确排除,无运行时文件 I/O 风险。
|
Skill 来源优先级终于有了确定性的落地——从此 Cindy 侧规则不再被下游 harness 插件悄悄绕过,而且整个实现干净到只有一个 .md 静态注入,零运行时 I/O。合并了 🎉 |
* main: (36 commits) fix(mobile): 修复 iOS 推送点击任务跳转 (makecindy#1721) fix(desktop): stop retrying unavailable cursor styling (makecindy#1722) fix(codex): 强制退役时只对真实在飞的会话广播终态错误 (makecindy#1720) fix: 修复 Cindy Browser 与 Codex 浏览器能力冲突 (makecindy#1706) fix(agent): 统一 continuation 的执行结束与正文投影语义 (makecindy#1703) fix: 为 PI 接通离线 grep/find/ls 工具 (makecindy#1718) fix(codex): 熔断切模型后的上下文压缩风暴 (makecindy#1717) fix(desktop): 远程发送改为乐观收口 (makecindy#1615) feat(worktree): 新建 Worktree 使用 Cindy 分支命名空间 (makecindy#1682) fix(desktop): 修复新建对话语音输入无法停止 (makecindy#1663) fix: KIMI(kimi-k3) Claude Code 下空消息腐蚀——转录归一化+响应流撞车改名自愈 (makecindy#1327) fix(desktop): 修复远程任务侧边栏加载闪烁 (makecindy#1713) refactor(mobile): Android bundle 不再引用 expo-notifications 原生模块 (makecindy#1667) fix(codex): 屏蔽重复的 Sky Computer Use 能力 (makecindy#1693) feat(ghost): 插件新增权限后引导用户重新授权 (makecindy#1695) perf(desktop): 加速任务切换渲染 (makecindy#1684) fix(agent): prioritize Cindy Skills before downstream Skills (makecindy#1650) test(desktop): 修复 sentPastedTextPreview 源码扫描在 Windows 上的 CRLF 误红 fix(browser): 保留 OAuth 弹窗浏览上下文 (makecindy#1690) fix: 统一消息 chip 的乐观态与收起态渲染 (makecindy#1680) ... Signed-off-by: Kris <406048119@qq.com> # Conflicts: # apps/desktop/src/renderer/__tests__/chatInputSessionFocus.test.ts # apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsx
* main: (36 commits) fix(mobile): 修复 iOS 推送点击任务跳转 (makecindy#1721) fix(desktop): stop retrying unavailable cursor styling (makecindy#1722) fix(codex): 强制退役时只对真实在飞的会话广播终态错误 (makecindy#1720) fix: 修复 Cindy Browser 与 Codex 浏览器能力冲突 (makecindy#1706) fix(agent): 统一 continuation 的执行结束与正文投影语义 (makecindy#1703) fix: 为 PI 接通离线 grep/find/ls 工具 (makecindy#1718) fix(codex): 熔断切模型后的上下文压缩风暴 (makecindy#1717) fix(desktop): 远程发送改为乐观收口 (makecindy#1615) feat(worktree): 新建 Worktree 使用 Cindy 分支命名空间 (makecindy#1682) fix(desktop): 修复新建对话语音输入无法停止 (makecindy#1663) fix: KIMI(kimi-k3) Claude Code 下空消息腐蚀——转录归一化+响应流撞车改名自愈 (makecindy#1327) fix(desktop): 修复远程任务侧边栏加载闪烁 (makecindy#1713) refactor(mobile): Android bundle 不再引用 expo-notifications 原生模块 (makecindy#1667) fix(codex): 屏蔽重复的 Sky Computer Use 能力 (makecindy#1693) feat(ghost): 插件新增权限后引导用户重新授权 (makecindy#1695) perf(desktop): 加速任务切换渲染 (makecindy#1684) fix(agent): prioritize Cindy Skills before downstream Skills (makecindy#1650) test(desktop): 修复 sentPastedTextPreview 源码扫描在 Windows 上的 CRLF 误红 fix(browser): 保留 OAuth 弹窗浏览上下文 (makecindy#1690) fix: 统一消息 chip 的乐观态与收起态渲染 (makecindy#1680) ... Signed-off-by: Kris <406048119@qq.com> # Conflicts: # apps/desktop/src/renderer/__tests__/chatInputSessionFocus.test.ts # apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsx
这次改了什么
摘要
修复 #1645:Claude / Codex 会话现在在高于具体 Skill 内容的 Cindy system 段中,统一遵守通用来源优先级。
当 Cindy 管理、用户或项目来源的 Skill 与下游 harness / plugin Skill 对同一工作同时适用时:
上一版按具体 Skill、插件来源、selector 和本机路径绑定 Codex overlay 的实现已整体撤回。最终产品代码不认识任何具体 Skill、插件、marketplace、selector 或用户目录,也不修改下游插件包。
Skill 是否与当前工作重叠属于模型侧的语义判断;现有 Claude / Codex harness 没有通用的 source-aware invocation hook,也没有下发结构化 provenance 字段。因此本 PR 把来源契约放在高于后续 Skill 内容的静态 system 指令层,让模型读各 harness 列 Skill 时本来就带的来源标注(插件 / marketplace / 内置命名空间为下游,其余归 Cindy 自有来源),并在清单没给出可用标注时 fail-closed 按下游处理、仍先跑 Cindy 侧 Skill。不扩写 capability routing 的具体能力表。
变更类型
feat新功能fix缺陷修复refactor/perf重构或性能优化docs/test/chore文档、测试或工程维护范围
UI 变化
不涉及。
怎么验证的
自动验证
手工验证
不涉及 UI。已检查最终 compose 结果:Claude 与 Codex 均包含来源优先级段;Pi 仍只组合原有 host + Pi 专属段。
未执行的验证
最后一版(0434598e)只改了一个 system prompt 的 Markdown 文本和对应断言,未再本地重跑全仓
pnpm test:unit;完整门禁以本 PR 的client-ci结果为准。上一版 117b307 时曾本地跑过pnpm test:unit -- --workspace-concurrency=1,通过。未对真实 Claude / Codex 模型做线上 A/B。系统段的装配、顺序与作用范围由确定性单测覆盖;真实模型行为继续由 PR 自动 review 与正式版验收观察。
风险
风险分类
影响与回滚
提交前检查