Repository navigation
fix(teammates): 以少数风险确认替代自主白名单并显示授权状态 - #7782
Conversation
…mation Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
Security findingsAdvisory findings (6)
ℹ️ 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. |
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
[Medium impact] The changes affect autonomous teammate actions across desktop task and routine workflows. 合并前应修复代答许可的请求绑定,并补上例行任务恢复确认。 FindingsFix with agent prompt### Issue 1
apps/desktop/src/main/maker-ipc/register.ts:3372-3378
自主调用 `message_session_task(decision=approve)` 时,新授权卡只收到 `task_id` 和 `decision`,没有子任务请求执行的工具、参数或请求 ID。用户无法从卡片判断自己批准了什么。
确认期间,若用户直接回答了子任务的旧请求,子任务又提出新请求,后续 `reply` 会读取最新请求并批准它。现有检查只绑定父任务输入和调用参数,挡不住这种替换。
请在弹卡前读取并展示子任务的实际请求,将许可绑定到该请求 ID;请求变化后使许可失效。
**How this was verified:** 授权卡仅复制调用参数,而执行时通过 `pendingInteractions.get(delegationId)` 读取当前请求,再按该请求的 ID 放行。
### Issue 2
apps/desktop/src/main/maker-ipc/taskActionAuthorization.ts:127-129
`taskActionRisk` 只将 `schedule_resume` 和 `message_session_task(mode=resume)` 识别为恢复操作,但 `routine_save` 同样能恢复暂停的例行任务。自主轮可以读取已停用规则,再用同一个 ID 保存 `enabled=true`;保存服务会直接更新规则并重新安排触发,不显示风险确认卡。这也适用于仅修改启停状态的内置规则。
请按已保存规则的状态识别从停用到启用的变化,并在恢复前走同一确认流程,同时保留普通创建和编辑的现有行为。
**How this was verified:** `routine_save` 经保存服务直接写入 `enabled` 并安排触发,而新增风险判定没有覆盖这个入口。
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
|
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Here are some automated security review suggestions for this pull request.
Reviewed commit: 7617f01276
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
|
已核对:取消的 pr-design-basis 运行 40825235202 属旧提交 当前成功记录:https://github.com/makecindy/cindy/actions/runs/40827414916 |
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fcd11f0ef0
ℹ️ 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".
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
|
已在 旧运行 40827335055 的 11 个失败均来自 使用 Desktop 实际 vitest 配置定向运行该文件,16 项全部通过(执行 42ms);Desktop 类型检查和 diff 检查通过。当前提交已推送,等待新 CI,不重跑旧提交,不以本地通过代替全套 CI。 |
|
已补核对同一旧运行 40827335055 的 Windows unit tests (1/4):11 个失败同样全部来自 没有新的生产缺陷或 Windows 专属修复;不重复改码、测试或重跑旧提交。等待新提交的 Linux/Windows CI 结果,本地 16 项定向测试及 Desktop 类型检查已通过。 |
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Here are some automated security review suggestions for this pull request.
Reviewed commit: fcd11f0ef0
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e435a6ea85
ℹ️ 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 Security Review · Automatically triggered
Here are some automated security review suggestions for this pull request.
Reviewed commit: e435a6ea85
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 99b3845ca7
ℹ️ 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 Security Review · Automatically triggered
Here are some automated security review suggestions for this pull request.
Reviewed commit: 99b3845ca7
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4355d5607d
ℹ️ 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 Security Review · Automatically triggered
Here are some automated security review suggestions for this pull request.
Reviewed commit: 4355d5607d
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9273b93c1e
ℹ️ 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".
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b187d09536
ℹ️ 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".
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
|
Windows CI 的 证据:
后续:在相同 Windows 分片/单 worker 与 CI 负载下定位同步遍历成本及预算稳定性,保留现有模型覆盖与所有业务断言;不要通过跳过用例或删除断言消除失败。此问题独立于 #7782 的伙伴授权风险确认范围。 已单独记录:#7852 |
|
本次核对当前 head 所有 review threads 均已处理(未关闭0条)。PR 当前仍为 原有最新手机、IM、实体 iPhone 补验缺口继续保留,不以 CI 通过代替运行验收。 |
xd-bobo
left a comment
There was a problem hiding this comment.
Approved by compliance check: CI passed and no blocking reviews.
|
已核对:review 5695908184 的 代码审核批准不替代前述运行验收缺项:最新手机/IM及原实体 iPhone 验收仍未完成,也没有据此记录豁免或整体就绪。原说明和验收约束继续保留,由仓库管理处理后续;开发 owner 不执行合并、不重跑无关测试,等待新事件。 |
MagicLizi
left a comment
There was a problem hiding this comment.
PR #7782 独立代码审查报告(standard 档)
- PR:https://github.com/makecindy/cindy/pull/7782(fix(teammates): 以少数风险确认替代自主白名单并显示授权状态)
- head:
47a440ee8603a957143fc852eeb0c393ee7b7905/ base:5f0b5f42b46969c3ac21b0cd798a07e36b46e8fd(main) - diffHash:
46720e7131148caa5a363d7e1bf3755542cb55b7b268090988c87d08abdbe3e3
Findings
- [P1] apps/desktop/src/main/mcp-integrations/mcp-providers.ts:344 — 事实证据:该行
const { app } = await import('electron');是本 PR 新增代码(getScheduleDefinition整个为新函数,基线5f0b5f42b4中不存在),属 main 进程运行时动态import()。docs/dev-rules/architecture-invariants.md§2「main 进程静态依赖」明文规定「main 进程禁止运行时动态import();依赖一律使用顶层静态 import」,其增量适用原则明确「约束新增和正在修改的代码」。同进程先例为顶层静态 import(apps/desktop/src/main/maker-ipc/register.ts:236import { app, ... } from 'electron')。影响:动态 import 带来打包、加载时机与错误路径上的不确定性(规则原话),且属权威规范违反,按docs/dev-rules/development-workflow.md严重度为 P1,本次必须修。建议修复:改为顶层import { app } from 'electron'(或经既有 deps 注入 userData 路径),删除该动态 import;同文件resolveHookSessionWorkDir内随既有代码搬移的import('../maker-host/index.js')(基线mcp-providers.ts:508已存在)属存量模式,本条不要求一并重构。验证方式:改后pnpm --filter desktop run typecheck通过;pnpm exec vitest run src/main/mcp-integrations/__tests__/collabSendOutcome.test.ts及 provider/授权定向测试通过;grep -n "import('electron')" apps/desktop/src/main/mcp-integrations/mcp-providers.ts应只剩基线已存在的存量行(现第 561 行)。
Rule coverage — 读取的规则文件及逐项结论
AGENTS.md/docs/dev-rules/development-workflow.md(严重度、PR 模板事实、验证真实性):描述与 diff、测试一致;验证证据真实且区分了「未执行项」;P0/P1 口径按其定义执行。docs/dev-rules/architecture-invariants.mdReview 清单:① package 未新增对 render/main 的反向依赖(@cindy/mcps仅改字符串文案、@cindy/maker-scheduler仅 type import)——通过;② main 进程运行时动态import()——新增一处,违反,即上述 P1(存量搬移行不追责);③④ 布局树——未触及。docs/dev-rules/electron-security-and-process-boundaries.mdReview 清单:未新增 Renderer 特权、BrowserWindow/WebView/preload/IPC channel/CSP/Fuses 改动;风险确认复用既有Session.runHostInteraction+requestHostInteraction生命周期(与 register.ts:6577 既有模式一致),captureTaskActionPermissionRequest只读既有 pending interaction 并做快照绑定——通过(本 PR 无 §8 最小验证入口所指的 webview/CSP 改动,未跑那两个测试)。docs/dev-rules/credentials-and-local-storage.mdReview 清单:无凭证/落盘改动;homedir()/userData回退仅为既有 hook 安装目录解析的展示与绑定,不新增写盘——通过。docs/dev-rules/engineering-conventions.mdReview 清单:无裸 console.log;未新增 IPC handler;main 侧新逻辑带主路径 + 关键错误路径测试(taskActionAuthorization.test.ts新增 518 行,覆盖拒绝/许可失效/单次消费/快照替换等);i18n 五语齐全、无孤儿 key、pnpm check:i18n与pnpm check:i18n-glossary通过;跨平台仅用pathJoin/homedir——通过。docs/product-rules/teammate-authority.md/agent-user-parity.md/bot-routines.md/cindy-bots-runtime.md(本 PR 同步改写的规则正本,rules 触发已由 xd-bobo 经 GitHub Approve 放行):实现与新「少数明确风险」表逐行对应——删除自动化(routine_delete/schedule_delete)、代答(message_session_task带decision,绑定子请求快照)、恢复暂停(mode=resume/schedule_resume/停用规则启用/手动执行停用规则)、本机调度命令(script/前置命令/安装自测/独立 Agent 调度)、授予常驻指令(启用自定义新建或改写指令)——taskActionRisk判据与表格一致;helper/scheduler 两工具面同判据(测试双向覆盖);来源/账号边界保留(TASK_ACTION_SOURCE_UNAUTHORIZED与既有 group/lane 核验未动)。P2 级观察(不阻断、不发送):远端(device≠local)schedule_create的独立 Agent 判定未按表中「本机」排除,偏保守地多弹一张卡;start_team/create_worker在自主轮按表中未列为风险而走普通权限,Worker 默认权限仍由主人偏好与既有的 auto→bypass 升级确认兜底。- 其它固定问题:单一目的(一个权限合同)成立;共享符号清理干净(
NEEDS_OWNER_REQUEST、TEAMMATE_STANDING_GRANT_TOOLS、TEAMMATE_SCHEDULER_WRITE_TOOLS、isEntrustedTask、taskActionConfirmation.delegation全部无残留引用);无新增第三方依赖;无数据库/协议/native fingerprint 改动;权限边界除裁决明确移除的自主白名单外无放松,且风险门补齐了白名单原本漏掉的本机命令/常驻指令/完全访问新建等提权路径。
Verification — 实际运行的命令、结果、未执行项及原因
在审查 worktree(head 47a440ee86)实际执行:
pnpm install --frozen-lockfile:通过(11.5s)。pnpm exec vitest run src/main/maker-ipc/__tests__/taskActionAuthorization.test.ts src/main/maker-ipc/__tests__/botSystemPrompt.test.ts src/main/mcp-integrations/__tests__/collabSendOutcome.test.ts(apps/desktop,Desktop 配置):3 文件 173 项全部通过。pnpm exec vitest run src/main/maker-host/__tests__/mcpToolApprovalPolicy.test.ts src/main/routines/__tests__/service.test.ts src/main/scheduler-host/__tests__/schedulerQueueWiring.test.ts:3 文件 92 项全部通过。pnpm --filter desktop run typecheck:退出码 0。pnpm --filter @cindy/mcps run build(tsc --noEmit,该包无独立 typecheck script):退出码 0。pnpm check:i18n:五语 14260 key 一致,通过(存量 proposed 术语警告不阻断)。pnpm check:i18n-glossary:无新增违规,通过(harness/lead 待裁决告警为存量)。pnpm check:test-hygiene、pnpm check:dev-docs、git diff --check:均退出码 0。- 未执行:heavy 档专项与
security-scan.mjs(本 PR 为 standard 档,不适用);手机/IM/实体 iPhone 实测(PR 描述已如实记录该缺口,为人工验收项,本审查环境无法补做;不据此单独阻断);全量pnpm test:unit(交 CI,当前 head 全绿)。
Intent alignment
- 描述来源:PR body(当前版本,读取于 2026-10-29 审查时)+
docs/product-rules/teammate-authority.md的 2026-10-29 用户裁决正本;原目标=以少数明确风险确认替代自主工具白名单与静默NEEDS_OWNER_REQUEST,受阻可见、由本人一次性决定。 - 初始实现:
7eb991b79c8655cb11d4fc87a2e4f0620589bbb0(2026-10-29T05:19:59Z,PR 首个 commit,已实际读取其taskActionAuthorization.ts与teammate-authority.md):移除自主白名单,风险表3类(remove/permission/resume),可见确认卡 + 单次消费。基线8c15788c0a(其父提交)。 - 待合并 head:
47a440ee86;风险表扩为5类(+command/authority)并补快照绑定/失效/单次消费。
| 原目标/初始行为 | 最终行为与影响 | 代码/提交证据 | 变化依据或待确认问题 |
|---|---|---|---|
| 移除自主白名单与静默 NEEDS_OWNER_REQUEST,普通工作走任务权限 | 保持;NEEDS_OWNER_REQUEST 及白名单函数全删,测试断言普通操作免二次门 |
7eb991b79c → 47a440ee86,taskActionHost.ts |
一致 |
| 少数明确风险由本人一次性确认(初始3类) | 5类,新增本机命令、独立完全访问 Agent、常驻指令3行 | fcd11f0ef0、e435a6ea85、7b336298d9、9273b93c1e |
Codex/Greptile 安全审查指出的提权缺口(r4409127909 等),属同一权限合同内的安全加固,且已写入 maintainer 放行的规则正本风险表;保守方向(只多确认不放权),不判偏离 |
| 许可一次消费、快照失效 | 保持并加强(请求 ID/规则 revision/定义快照/输入代次绑定) | e0121b41eb、4355d5607d、b187d09536、47a440ee86 |
一致 |
| 不改 runner 默认值、普通权限档、全局自动审批器 | 保持(diff 无相关改动) | 全量 diff | 一致 |
- 已 Resolve 的14条 Codex/Greptile 意见逐条回看:均为绑定/展示/覆盖缺口的修复或同类加固;作者对「恢复自主白名单」类建议明确拒绝并保持用户裁决方向(见 taskActionHost.ts:387 thread 回复),多轮修复未改变原目标。无确认偏离;无待裁定的存疑项(手机实测缺口已在描述中如实声明,属人工验收而非目标分歧)。
Overall
changes-requested:发现 1 条 P1(main 进程新增运行时动态 import('electron'),违反 docs/dev-rules/architecture-invariants.md §2),按仓库严重度定义本次必须修;其余权限合同、测试、i18n、文档一致性核验通过,未发现其它 P0/P1。
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
|
已补齐本轮基线新鲜度:无冲突合入主干 合入后直接相关 168 项通过(授权133、provider16、session创建19),Desktop typecheck退出码0,五语14261个key一致(存量警告保留),diff检查通过。未运行无关全量或重启测试版。手机/IM/实体 iPhone 的既有验收缺口保留,等待当前 head 的 CI 和后续审核;本会话不合并。 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2911bc3a89
ℹ️ 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 Security Review · Automatically triggered
Here are some automated security review suggestions for this pull request.
Reviewed commit: 2911bc3a89
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f9bd4a6e00
ℹ️ 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".
|
当前 head 审核状态仍为 CI 全绿不消除已公开保留的风险:#7913 的 scheduler 队列内批准定义复核缺口仍未修复;#7912 的跨电脑风险策略仍未实现;最新手机/IM/原实体 iPhone 验收缺口继续保留。不宣称整体就绪或可合并。本轮没有代码、测试、实例或提交变化,不自行合并。 |
MagicLizi
left a comment
There was a problem hiding this comment.
PR #7782 独立代码审查报告(standard 档)
- PR: #7782
- head:
f9bd4a6e002d9b9852a709a1259abb31756c90b7/ base:727afb1ad6902176e2ec55254154b900c489a998(main) - 变更:以「少数明确风险 + 可见一次性授权请求」替代自主工具白名单与静默
NEEDS_OWNER_REQUEST - diffHash:
06f9cfb97678e298663633b3fad2c91cc749af935135603aab660d8d4de5f5e5
Findings
没有 P0/P1。0 条。
以下为审查中确认但不阻断的记录项(P2 / 范围外已登记项,不作为打回依据):
canBotContinueWorkbenchTask(apps/desktop/src/main/maker-ipc/botWorkbenchTools.ts:297)在本 PR 移除isEntrustedTask接线后已无调用方,成为未使用导出。属清理类 P2,不影响行为。- 已公开登记的存量缺口继续存在,非本 diff 可修复范围:#7913(
schedule_resume复核与 scheduler 串行 mutation 之间的竞态,可靠修复需改packages/maker-scheduler与packages/lizi-mcps/src/scheduler/resume.ts,均不在本 PR 文件清单)、#7912(跨电脑独立 Agent 是否追加二次确认的策略评估)。二者均在 PR 风险段与 review thread 中如实披露,处置见 Intent alignment。 - 确认卡的风险描述文案对「新建完全访问 Agent」使用
taskActionConfirmation.command(保存/运行命令)措辞,实际完整动作(含newTaskPermissionMode: 'bypassPermissions'、目录、指令)以完整 JSON 展示在同一正文,不误导审批对象,属措辞优化级。
Rule coverage
读取并逐项核对(按 rule-map 命中):
AGENTS.md/docs/dev-rules/development-workflow.md(P0/P1 口径、验证真实性):验证均在本 worktree 实跑并保留退出码(见下),描述与实际一致。docs/dev-rules/architecture-invariants.md(main 进程模块加载):先前 P1(getScheduleDefinition内新增import('electron'))已在e5657bdac0改为顶层静态导入,app.getPath仍在调用时执行;基线既有的install内import('electron')与 maker-host 动态导入未动,符合增量原则。docs/dev-rules/engineering-conventions.md:main 侧错误路径 fail-closed(HOST_NOT_READY/TASK_UNAVAILABLE/INTERACTION_STALE/TASK_ACTION_AUTHORIZATION_EXPIRED/USER_CANCELLED);i18n 五语 key 一致(taskActionConfirmation.{remove,permission,resume,command,authority}五语齐全,删除的delegation无残留引用);pnpm check:i18n-glossary无新增违规。docs/product-rules/teammate-authority.md(本 PR 重写的正本)与agent-user-parity.md/bot-routines.md/cindy-bots-runtime.md:文档风险表与taskActionRisk实现逐行一致(删除自动化=delete 两入口;代答=message_session_task(decision);恢复=schedule_resume/message_session_task(mode=resume)/routine_save启用停用规则/routine_run_now停用规则;本机命令=executionMode:'script'/preRunHook.command/schedule_set_pre_run_hook两工具面/routine_save新命令;新建完全访问=send_to_session缺省新建/独立 Agent 调度创建与执行范围改写/schedule_run_now;授予常驻指令=routine_save新建启用自定义规则或改写启用指令)。来源认证(lane && !lane.requesterIsOwner→TASK_ACTION_SOURCE_UNAUTHORIZED)与操作风险分开、错误文案不冒充「主人拒绝」,与「访问边界」条款一致。- 安全与隐私:阶段一扫描 0 hard/0 soft;本 diff 无新依赖、无凭证、无数据外发;确认请求只进入既有
Session.runHostInteraction/requestHostInteraction生命周期(桌面/手机/IM 同一请求),拒绝/取消/任务非 active 即中止,许可一次消费(admitTaskAction的consumed+ 指纹 +assertCurrent),旧回执重复消费被拒。 - 绑定与失效:代答许可绑定子任务实际
requestId+请求签名(替换即TASK_ACTION_AUTHORIZATION_EXPIRED,对应 Greptile r4408980899);routine_save启用停用规则走恢复确认并绑定 revision,保存经routineTools.save/runNow(..., expectedRevision)服务原子版本检查(对应 Greptile r4408980904);schedule/routine/hook 安装均展示并绑定已存定义、实际执行目录(含preRunWorkingDir解析与后备落盘目录),定义/目录/隔离值变化使旧许可失效,脚本落盘自测前再复核(assertTaskActionCurrent())。 - UI / i18n:无组件代码改动,复用既有权限卡;五语新增文案随 PR body 附 Dark 实测截图;双模式为纯文案 token 化资源,无硬编码颜色。
- Mobile 冷更边界:未触碰
apps/mobile原生输入,无指纹影响。 - 测试:
taskActionAuthorization.test.ts+530 行以真实withToolCallAuthority→Desktop admission→effect 覆盖裸参数完全访问转交、worktree 切换、暂停调度命令替换、绑定前置命令目录替换等失败输入,并保留普通路径不弹卡的反向断言;botSystemPrompt.test.ts同步静默拒绝断言为「同意后继续本次调用」;collabSendOutcome.test.ts仅补 mock 导出。
Verification
均在 PR worktree(HEAD=f9bd4a6e00)实跑,退出码如实:
pnpm install --prefer-offline:exit 0(pr-7782-pnpm-install.log)cd apps/desktop && pnpm exec vitest run src/main/maker-ipc/__tests__/taskActionAuthorization.test.ts src/main/maker-ipc/__tests__/botSystemPrompt.test.ts src/main/mcp-integrations/__tests__/collabSendOutcome.test.ts:exit 0,173/173 通过(授权 133、提示契约 24、协作 16)(pr-7782-test-targeted.log)pnpm --filter desktop run typecheck:exit 0(pr-7782-tc-desktop.log)pnpm check:i18n-glossary:exit 0,无新增违规(18 处待裁决术语为存量告警)(pr-7782-glossary.log)pnpm check:test-hygiene:exit 0(pr-7782-hygiene.log)git diff --check 727afb1ad6...HEAD:exit 0(pr-7782-diffcheck.log)- 未执行:heavy 档恶意代码专项与
security-scan.mjs重跑(standard 档不适用,阶段一已扫描干净);手机/IM/实体 iPhone 实机验收(PR 已如实标注缺口保留,不以 CI 通过替代运行验收);全量pnpm test:unit(交 CI,本 PR 仅定向验证)。
Intent alignment
- 原目标(PR 描述 +
docs/product-rules/teammate-authority.md2026-10-29 用户裁决):普通工作沿当前任务权限执行,缺少主人输入标记不再逐工具白名单/静默拒绝;自主轮仅对少数明确风险显示可操作的可见授权请求,由本人允许或拒绝后继续原调用,不逐入口增加放行例外。 - 初始实现:
7eb991b79c8655cb11d4fc87a2e4f0620589bbb0(2026-10-29,基线63394951c2),已实际读取该 revision:删除autonomousActionAllowed/NEEDS_OWNER_REQUEST/TEAMMATE_*白名单集合,引入taskActionRisk(初始remove|permission|resume三类)、confirmTaskAction风险卡与五语文案、重写 teammate-authority.md。 - 待合并 head
f9bd4a6e00:风险表扩为五类(新增command本机命令/完全访问执行、authority常驻指令),并把许可绑定到实际请求 ID/规则 revision/已存定义/执行目录快照。逐项对照核心行为:自主普通操作免额外卡(测试反向断言保留)、五类风险卡一次性本人决定、拒绝即停、旧许可随定义变化失效——与原目标一致,未删除、削弱或反转任何承诺行为。 - 变化依据:后续 10 个修复提交均对应本 PR 已 Resolve 的 Codex/Greptile thread(18 条全部 resolved,逐条有修复 commit 与实测回执),属同目标内的安全加固与绑定补全,非扩范围;先前 review 提出的动态 Electron 导入 P1 已在
e5657bdac0修复并核实。 - 范围处置(中性提醒,供用户知悉):thread r4413081997(跨电脑独立 Agent 二次确认)按风险表「仅本机」的既定边界转 #7912,该边界由维护者确认门放行的规则文档确立;thread r4413128307(mutation 边界内复核)确认了 scheduler 串行队列的存量竞态,可靠修复需改本 PR 授权文件清单之外的 scheduler 引擎,转 #7913。这两处 Resolve 仅表示范围处置,不代表缺口已修复;PR 风险段已如实保留,其中 #7913 使「批准 A 执行 B」在窄竞态窗口内仍可能,需要用户/维护者在知悉该保留风险的前提下决定是否接受合并。
- 结论:核心目标(自主白名单 → 少数明确风险的可见授权)可核实且与最终 diff 一致;无确认偏离。已 Resolve 意见均已落实或按披露的范围约定转 issue,未发现多轮修复改变原目标。
Overall
pass —— 没有 P0/P1。
|
已核对正式复审:MagicLizi review 5703775554 为 本轮无必改意见。未使用导出清理及风险描述措辞属于记录性的 P2,不为此扩大修改、增加测试或重新推送。 代码审查通过不消除已披露的边界:#7913 的 scheduler 串行队列竞态仍未修复,#7912 的跨电脑额外确认仍是策略评估;最新手机/IM/原实体 iPhone 验收缺口继续保留,不把 Approve 解释为这些缺项的豁免或整体运行就绪。本轮仅更新审核状态,开发会话不合并;后续由仓库管理按现有约束处理。 |
这次改了什么
摘要
伙伴普通工作沿当前任务权限执行,缺少“主人刚输入”的标记不再触发逐工具白名单和静默
NEEDS_OWNER_REQUEST。自主轮命中少数明确风险时,进入现有任务的可见授权等待,由本人允许或拒绝,再继续原调用。send_to_session缺省新建与独立 Agent 调度的新任务默认完全访问。自主转交新建时确认完整消息、继承目录和新任务权限;发给已有任务或带目录覆盖并继承原权限的创建仍沿普通权限。自主创建、改写指令/目录/worktree 隔离、解绑或开启可重建的持续模式、按 ID 手动运行,均确认完整指令、目录及新任务权限默认值。绑定现有任务并继承其权限的无命令跟进、独立调度的改名/时间编辑不多弹卡。未修改 runner 默认值、普通任务权限档或全局自动审批器。scheduleId解析;helper 保持只能安装到伙伴自己的任务目录。安装前再复核。按 ID 执行前置命令时展示并绑定实际执行目录;恢复暂停也展示和绑定完整已存定义。entrusted授权。禁用草稿和沿用原指令/命令的普通编辑不加锁;停用草稿手动运行只允许这一次,仍保持停用。恢复保存时展示实际沿用的前置命令,省略参数也不隐藏该命令。变更类型
fix缺陷修复refactor/perf重构或性能优化docs/test/chore文档、测试或工程维护范围
规模构成:17 个非测试文件新增 420 行,服务于同一个权限合同的共用门禁、现有卡接线、提示/能力索引、五语资源和四份规则;3 个既有测试文件新增 530 行覆盖可观察副作用与直接配套 mock。无独立功能、依赖升级或无关重构;拆开门禁和可见决定会留下静默拒绝或权限绕过,因此按一个完整目标交付。
UI 变化
复用原任务权限卡、按钮和等待状态;完整风险内容显示在说明中,避免通用工具预览截断。本批 macOS Dark 实测;旧版 Light 证据仍保留。以下为已验证的常驻指令卡外观,最新风险卡复用同一组件:
docs/design-rules/DESIGN.md§2 语义颜色与双主题、§4 复用组件/按钮、§12 键盘操作。没有独立授权界面或硬编码颜色。本批目检新建任务卡和长命令恢复卡,完整尾部在正文可见;没有将桌面目检当作手机实测。怎么验证的
自动验证
当前
f9bd4a6e00只补例行任务命令的实际目标/目录展示与快照复核。既有 helper/scheduler 手动命令用例补目录变更断言后,旧实现2项失败;修复后149项通过(10.23s,授权133/102ms、provider16/70ms),Desktop typecheck退出0、test-hygiene和diff检查通过。无新增用例/测试文件,无无关全量。首次类型检查发现漏导入getDbClient,已补齐静态导入后复验通过。合入最新主干后复验:授权133 + provider16 + 任务创建19,共168项通过(8.24s);Desktop typecheck退出0,i18n14261个key一致(存量1385处警告),diff检查通过。没有冲突,原权限合同和运行证据适用。
导入修复阶段 head
2911bc3a89已无冲突合入主干727afb1ad6;导入修复e5657bdac0:仅将新增 Electronapp依赖改为顶层静态导入,getPath()仍在原调用时执行,存量导入不动。Desktop 配置下授权133项和provider16项共149项通过(8.93s、执行155ms),Desktop typecheck退出码0、diff检查通过。没有新增测试或重跑无关全量;不改变行为,因此沿用下述47a运行证据,不为本条重启测试版。原手机、IM、实体iPhone缺口仍保留。先前恢复展示修复:Desktop 配置下授权133项通过(6.31s、执行98ms);原helper/scheduler恢复用例补已存命令断言后,在旧码2项失败,修复后全部通过。无新增用例或测试文件。Desktop typecheck、test-hygiene和diff检查通过。以下为未受该展示补齐影响、已完成的上一批266项证据,不为小修重跑无关全量:
未受后续展示补齐影响的先前定向证据保留:例行工具/授权200项、provider配套16项、提示/路由及主干投递回归、mcps build、i18n/glossary均通过(保留既有i18n warnings),不重复无关全量。
测试价值(均在现有文件,无新增测试文件):
taskActionAuthorization.test.ts:unit,真实withToolCallAuthority→ Desktop admission → effect。本批4个最小失败输入分别为裸参数 Full Access 转交、useWorktree: true → false、暂停调度的命令替换、绑定前置命令的实际目录替换。保留普通发送/继承权限创建、元数据编辑、主人原权限及既有绑定/撤权覆盖;旧夹具只补真实useWorktree=false。无新测试文件;单文件133项/4.93s,执行92ms;最终 Desktop 组合中授权执行99ms。botSystemPrompt.test.ts:原有提示契约 unit,同步与实现矛盾的静默拒绝断言,24项执行4ms,无新增模块加载/等待。collabSendOutcome.test.ts:既有 CI 缺失 mock export,仅补captureTaskActionPermissionRequest空返回模拟,保留全部行为断言;Desktop 配置下16项/8.99s、执行46ms。此后没有改变它调用的协作行为或 mock 契约。基线已更新至
727afb1ad6;本轮合并未改变授权/provider源码及测试;恢复场景运行证据提交47a440ee86;该次仅补恢复卡的已存命令展示,当前隔离测试版已加载该内容。此前b187d09536的其他路径未改。没有为无关主干变更重开运行验收。初次根配置混跑 provider 测试未加载 Electron 的original-fsalias,改用仓库 Desktop 配置后194项通过,未改生产代码或断言规避;首次类型检查发现旧夹具缺必填字段,补齐后通过。手工验证
当前
f9bd4a6e00,隔离 Desktop / Pi / Auto:已有持久例行任务的命令确认正文完整展示真实任务与目录 A(Dark 实际目检)。拒绝后无新运行;另一张卡等待期间用产品入口将同一任务改到 B,规则版本不变,旧卡允许返回TASK_ACTION_AUTHORIZATION_EXPIRED,无运行记录/文件副作用。独立新卡展示 B,允许后只新增1条 skipped 前置检查与1次 B 标记,A 无标记、重复回执拒绝。已通过产品入口删除本批规则、伙伴及两个任务,调度不存在、工作目录不存在、待处理为空,退出本任务隔离实例并保留登录。命令以 exit2 结束,不启动后续模型。此证据未覆盖手机/IM/原实体 iPhone;相应缺口继续保留。当前
47a440ee86的隔离 Desktop / Pi / Auto 恢复场景:routine_save参数省略preRunHook,实际 Dark 卡片仍展示已存命令、超时、指令及版本。拒绝后 enabled=false/rev1;独立新卡允许后 enabled=true/rev2,原命令和超时保持不变,重复旧回执拒绝。远期规则无运行记录;测试规则、伙伴、任务与目录已清理并读回,隔离实例退出、登录保留。既有版本替换失效的执行逻辑未改,沿用其原实测。此前
b187d09536,隔离 macOS Desktop / Pi / Auto,实际工具调用、Dark 界面与持久结果:TASK_ACTION_AUTHORIZATION_EXPIRED、仍暂停。新卡正文1186字符,超过通用预览长度的尾部在实际界面可见;新卡允许后 active,远期规则未执行。false,重复回执拒绝,无残留请求。没有运行该远期独立调度。此前独立 Agent 调度风险的 Pi/Auto 实测(
9273b93c1e,本批未改变这些成功路径):newTaskPermissionMode=bypassPermissions;拒绝后无规则,新请求允许后保存远期规则、尚未运行;重复旧回执拒绝。bindToCurrentSession=true的远期纯回复跟进实际保存成功,绑定正确任务,无额外风险卡;未运行该规则。TASK_ACTION_AUTHORIZATION_EXPIRED,运行记录0条。新卡展示新指令,允许后只1条 success、返回指定纯回复;子任务为原有完全访问策略,伙伴本身仍 Auto,重复旧回执拒绝。仍适用的既有 Desktop/Pi 运行证据:
4355d5607d:例行任务前置命令拒绝无运行,新许可自测一次;安装目标/目录变更使旧许可失效,旧脚本未覆写,新许可只自测一次;helper只写自身目录,不挂载任意调度。7b336298d9:启用指令改写确认后保存;同指令改名/停用草稿编辑无额外卡;停用草稿拒绝无记录、允许一次且仍停用。Pi空ID独立数据问题见 #7784,正向用产品生成的有效种子,不冒称模型成功新建有效规则。e0121b41/fcd11f0e:子权限请求替换、例行恢复、脚本保存/执行及已存定义替换失效,均有真实拒绝/允许和持久读回。未执行的验证
63394951c:本分支 iPhone 模拟器 → 已认证 Device Link → 隔离 Desktop/Pi,自然输入的 routine_save/start_session_task 未遇NEEDS_OWNER_REQUEST;有效删除卡的拒绝、手机重启同请求恢复、允许一次及旧回执拒绝通过。Metro属本 worktree,native fingerprint匹配,测试后关闭并还原远控设置。这是旧版共享链证据,不能替代最新常驻授权、安装目标及独立 Agent 风险的手机实测。风险
已登记但未解决
schedule_resume的 Host 锁外快照复核与 scheduler 串行 mutation 之间存在竞态;排队前批准 A 后,前方更新可能提交 B,恢复入口会激活 B。所需 scheduler 引擎与 MCP 入口不在本 PR 文件清单,按范围外只开 issue 处理,尚未修复。线程 Resolve 仅代表范围处置,不能声称已实现确认与最终 mutation 的原子绑定,不能据此宣称整体就绪或可合并。风险分类
影响与回滚
提交前检查