Repository navigation
fix(bots): 自主跟进区分观察责任与行动授权 - #6399
Conversation
b8c45f2 to
0430098
Compare
Codex Review SummaryThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0430098037
ℹ️ 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".
[High impact] The changes reach companion task actions across local and linked computers. 修复用户编辑后丢消息和 Orca 回报后无法继续派活的问题前,不建议合并。 FindingsFix with agent prompt### Issue 1
apps/desktop/src/main/maker-ipc/taskActionAuthorization.ts:180-185
用户在界面中修改已获授权的排队消息后,消息会被丢弃。`bindTaskActionInput` 把原始正文固定在闭包里,但 `INPUT_UPDATE_TEXT` 和 `INPUT_UPDATE_CONTENT` 保存编辑时会保留这个旧闭包。任务消费消息时,新正文会触发 `TASK_ACTION_AUTHORIZATION_EXPIRED`,协调器随后丢弃消息。
请在可信用户编辑入口为新正文更新授权证据,不能只在工具侧的 `updateQueuedMessage` 中重新绑定。
### Issue 2
apps/desktop/src/main/maker-ipc/taskActionHost.ts:51-58
普通 Orca 协作中,Lead 收到 Worker 回报后会变成 `ownerInput=false`、`automatic=true`,因为回报来源是 `origin.kind='orca'`。这里因此不再保留普通任务流程,而现有委托检查只接受 `message_session_task` 和 `stop_session_task`。即使用户要求团队完成多轮工作,Lead 此时调用 `send_to_worker`、`create_worker` 或 `end_team` 也会被拒绝,必须等用户重新输入。
请为用户已授权的 Orca 工作保留可核验的委托范围,区分团队回报与自主观察唤醒。
### Issue 3
apps/desktop/src/main/mcp-integrations/sessionHandoffRemote.ts:169-171
成功送达的跨电脑消息也会一直占用待处理回执额度。接收端固定传入 `forceQueue: true`,现有任务路径因此始终返回 `wakeKind: 'queued'`;这里却只在结果不是 `queued` 时释放回执,后续消费也没有释放入口。
一小时内累计发送 256 条消息后,即使它们已全部送达,后续发送仍会报 `Too many pending remote task actions`。建议在确认消费完成后释放待处理额度,同时单独保留防重放记录。
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
|
0430098 to
c24ffc6
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c24ffc6e26
ℹ️ 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".
c24ffc6 to
cf41c7b
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cf41c7b1c5
ℹ️ 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".
|
本轮收敛检查点(e1946c2a38):授权不能仅在 admission 检查;跨异步准备后必须在副作用前复查。
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e1946c2a38
ℹ️ 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: Dash <125997726+dashhuang@users.noreply.github.com>
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
e1946c2 to
8b6149f
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8b6149fce8
ℹ️ 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: Dash <125997726+dashhuang@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: 32c9edbbe0
ℹ️ 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: Dash <125997726+dashhuang@users.noreply.github.com>
PR #6399 独立代码审查报告(heavy 档)
Findings没有 P0/P1。逐项核过以下候选疑点后均不构成可证实问题(按口径不发 P2):
Rule coverage
Verification实际运行(worktree
security-scan verificationLine(原样): 本 PR 全部 26 个改动测试文件均已实际执行且通过(合计 2522 项)。CI:head 未执行(如实声明):整仓 Intent alignment
结论:一致 / 已获明确同意的调整。无确认偏离、无需要用户裁定的核心方向问题;剩余实机验收事项已在 PR 中如实保留。 Overallpass —— 没有 P0/P1。 |
这次改了什么
摘要
宿主自动唤醒伙伴查看进度时,原模板要求卡住就继续、出错就换路线;工作台责任身份与本机工具免审批又使这些建议成为实际干预。本 PR 将默认改为“自动检查,按授权行动”:自动轮次可以读取与提醒,没有具体授权就拒绝跨任务写入。
主人请求使用普通任务原有的权限流程:私聊输入,以及经 Chat Server 实时核验的群内主人请求,不额外弹行动确认卡。群里 @ 自己伙伴后
start_session_task被当作自动操作拒绝的问题已补回归修复;访客、转入输入和定时跟进不获得同样放行。已转为正式 PR 进入评审;下列剩余工程与验收事项仍未完成,不代表已通过合并验收。 本次未安装、部署、重启或替换客户端,未修改现用配置、规则、队列或用户数据,未改动产品中在用的自动跟进规则。
变更类型
fix缺陷修复docs/test/chore文档、测试或工程维护范围
cindy_helper直接/渐进工具与cindy_orca写操作接入同一 Host admission。Full Access、自动审阅、creator/follower/scheduler、suggested route 均不能生成行动授权。taskActionHost复用authorizeGroupTool(sessionId, botId, 'owner-action'),仅将通过 Chat Server 实时核验、仍在当前执行中的 owner 群授权视为主人输入。chat/tools访客、过期/错误伙伴授权及GROUP_AUTHORIZATION_UNAVAILABLE不放行。confirm;仍沿用原 Agent 权限档/审批。复用原有单次调用上下文保留来源、目标和正文证据,使工作台行动检查、消息队列与新建委托继续正常工作;没有新增通用权限体系。本轮修复的不变量
set_workbench_task_responsibility同样经过 Host 写入门,自动轮次不能先接手再扩大读取范围。released: true才释放接收端认领。重复、取消、未知结果/断线分别保持拒绝或原 TTL 兜底;旧端普通验证成功不算释放确认。没有新增缓存、数据库、锁或重试系统。插话授权收敛检查点
不变量:一次写入在 admission 后跨越异步等待,仍须在产生副作用前复核同一 Host 授权。已有队列正文的投递证据,不能替代本次“提前插话”动作的授权。
taskActionHost/ 调用上下文持有;输入队列、插话标记与失败清理由现有AgentInputCoordinator持有,没有新增状态存储、锁或重试机制。sessionControlService的插话、队列编辑/撤回、停止与运行设置复用combineInputGuards,把原调用方检查与当前行动检查组合起来。新插话把组合检查继续交给expectedTurn。MCP_APP_MESSAGE_GUARD传到最终beforeProviderStart。授权失败沿用原拒绝与清理分支,不生成重发。元数据写入与回执收敛检查点
不变量仍是“异步准备结束后、产生副作用前复查同一授权”。本轮
e1946c2a38复用现有assertTaskActionCurrent和既有写入回调,没有新增权限档、锁、缓存或重试系统。远程状态工具的检查不等于已经覆盖连接建立后到接收端最终写入的所有撤销窗口;这一限制在下方保留。既有已提交副作用不回滚,未新增自动重发。
创建与 Orca 共用授权检查点(第四轮)
不变量:已经通过 admission 的操作,在异步准备返回后仍须持有原调用的有效授权;授权失效不能产生新的子任务执行或 Orca 派发。授权事实仍由
taskActionHost持有,资源和失败收口仍由原创建/Orca 服务持有。本轮将同族问题收拢到既有边界:
start_session_task使用openSession的提交回调;Orca 将当前调用的校验闭包接入所有生命周期/控制入口已共用的captureOrcaPluginAuthority。无需给每个 MCP adapter 另造状态,也没有新锁、缓存、数据库或重试机制。闭包在调用上下文结束后的排队接受中仍检查原授权。重复调用仍由现有单次 admission 拒绝;超时、断连与部分已提交结果仍走原服务的失败/回执分支,不自动重试或伪造撤回。范围复核:上一轮增长主要来自授权回归测试与既有写入/回执回调的接线;本轮继续使用这些生命周期,没有扩展成通用权限系统。删除本轮接线会使已复现的撤销后创建/派发再次发生,因此只保留这些必要检查点。
委托控制与 transport 收敛检查点(第五轮)
两条 P1 同属“异步等待后沿用旧来源”失败族。唯一授权 owner 仍为
taskActionHost:来源输入代次、账号、群执行和委托范围由它判断;委托状态与补偿仍归既有botDelegationService,发送排队归既有 device-link。没有增加锁、缓存、持久化或重试机制。本轮把行动检查组合进
resolveCaller返回的既有 mutation authority,使代答、消息/队列、暂停/取消、恢复、路线变更共享原检查点与原补偿分支,并删除创建路径的重复行动检查;不为每个工具另建判据。延迟接受处将行动失效转换为原有取消派发信号,防止普通回调异常被吞掉后继续发送。远程状态复用 transport 的同步preSend,捕获原调用的同步来源检查;逐项异步完整检查仍保留。对称审计覆盖成功、拒绝、暂停/撤销、输入替换、迟到与重复。范围复核:本轮收拢到原 coordinator 回调,没有新状态存储;若删除这些接线,已定位的私聊控制与 transport 等待窗口会重新出现。接收端最终事务前的来源撤销窗口仍列为限制,不为补齐该窗口新增远程权限机制。
UI 变化
docs/design-rules/DESIGN.md§2 与 §10,复用既有语义 token 和双主题组件,没有新布局、颜色或尺寸。Orca 写入口分类收敛检查点(第六轮)
不变量:会修改协同持久状态或恢复 Worker 的工具必须进入同一行动授权门,工具名里的 focus 不代表只读。唯一授权判据仍为
taskActionHost;焦点写入与恢复仍由原 Host adapter / Orca 生命周期负责。本轮生产代码仅将switch_focus加入既有集合,无新状态、锁、缓存、持久化或重试机制。核对全部 20 个 Orca 注册工具:14 个写工具受同一门保护;
list_workers、get_worker_queue_status、list_available_models、get_workspace_info、worker_status、read_worker6 个读取入口保留原可见范围。焦点 adapter 已复用captureOrcaPluginAuthority,在列表返回后、写焦点前及恢复空闲 Worker 前复查来源,无需另加检查体系。switch_focus结果回归通过真实
createOrcaMcpServer注册的DirectToolSinkhandler 验证自动拒绝及主人请求放行,并扩展现有群授权/委托矩阵;修复前有 11 项失败,能识别上一版仅遍历行动集合却漏掉工具的缺口。当前剩余验收事项见下方,未因本轮修复宣称全部完成。怎么验证的
自动验证
2026-10-20 第六轮 review 跟进:只补齐
switch_focus的已有写操作分类,处理一个 P2 技术 thread。pnpm --filter desktop exec vitest run src/main/maker-ipc/__tests__/taskActionAuthorization.test.ts src/main/maker-ipc/__tests__/orcaTeamService.test.ts --maxWorkers=2:222 项通过,2.88s。taskActionAuthorization.test.ts最终夹具独立 25 项通过,1.63s;修复前同文件 11 失败 / 14 通过。生产入口、最小输入、覆盖缺口及 unit tier 见上方检查点与测试注释。pnpm check:test-hygiene368 文件基线通过;pnpm check:dev-docs10 项通过;git diff --check通过。首次 Desktop typecheck 抓到新测试夹具的缺失依赖与上下文字段,已补全为类型完整的依赖;最终pnpm --filter desktop run typecheck通过,退出码 0。2026-10-20 第五轮 review 跟进:修复两条 P1 和 Linux/Windows 单测分片暴露的测试装配遗漏,基线仍为
064354193a,本轮未重做 rebase。botCanonicalSession.test.ts581 项通过,26.06s。此前其它 6 文件无需重跑;不把两个运行的重复用例相加。pnpm --filter desktop run typecheck再次通过(退出码 0)。orcaWorkerCreationService.test.ts和pluginStartTeamAdmission.test.ts提取真实注册函数时未绑定新增captureTaskActionGuard;均接入真实 helper,保留所有原断言。旧 HEAD 的 CI 仍红,新提交结果待 CI。check:test-hygiene368 文件基线通过,check:dev-docs10 项通过,git diff --check通过。未运行整仓或实机端到端测试。以下为此前验证记录,保留其对应范围与限制:
2026-10-20 第四轮 review 跟进(
8b6149fce8):同步至已获取的origin/main064354193a,原 5 项提交range-diff均为相同补丁;集中修复当前两条技术反馈。vitest run:4 文件、906 项通过,25.95s,覆盖botCanonicalSession、orcaLifecycleService、orcaTeamService、taskActionAuthorization。最终 Orca 小幅接线整理后,两文件 314 项再次通过(3.30s)。pnpm --filter desktop run typecheck退出码 0。pnpm check:test-hygiene通过(368 files within baseline),pnpm check:dev-docs10 项通过,git diff --check通过;DCO 6 个提交通过,preflight 无 BLOCK;upstream 分叉仅来自已核对的 rebase。e1946c2a38的 Linux/Windows 单测分片均已通过,上一轮飞书上传的 Windows 失败未重现;本轮新 HEAD 仍以新 CI 为准。admitTaskAction→ 实际startSessionTask+ SQLite 创建事务;原覆盖只撤销权限档,未撤销行动来源。准备/事务返回时撤销,验证无新行或已提交失败、无启动及预建资源清理。2026-10-20 第三轮 review 跟进(
e1946c2a38):处理两条现有技术反馈,并核查同类本机 / 远程批量入口。vitest run:8 文件、246 项通过(11.51s);最终回执保留矩阵补一个未知 timeout 输入后,两文件 47 项通过(687ms),回执文件最终单独 18 项通过(765ms)。合计当前覆盖 247 项,不把重复运行累加。pnpm --filter desktop run typecheck:退出码 0。pnpm check:test-hygiene:368 files within baseline;pnpm check:dev-docs:10 项通过;git diff --check通过;DCO 5 个提交通过,preflight 无 BLOCK。cf41c7b1c5的 Windows unit (2/4) 在outboundFile.test.ts首个上传用例超出 5s;同文件注明 Windows 会启动 PowerShell 编译辅助程序,失败文件与本轮主干一致,PR 没有修改 lizi-im。没有 Windows 本地复现证据,不能宣布该 CI 已修复;不混入飞书代码改动,不盲重跑,等待新 HEAD CI。2026-10-20 第二轮 review 跟进(历史 HEAD
cf41c7b1c5):同步到已获取的origin/main82cf0119e0,原三项提交的range-diff均为相同补丁;本轮只修插话期间授权撤销和两处旧签名守卫。pnpm --dir apps/desktop exec vitest run <sessionControlService / agent-input-coordinator / taskActionAuthorization / sessionQueueControl / mobileClientPromptNote.contract / sessionRuntimeControlWiring> --maxWorkers=2:6 文件、683 项通过,12.64s。stampQueuedEditProvenance(updated, ...)签名更新为带目标sid的签名;未跳过或削弱检查。上一提交的 Linux / Windows 全部 8 个单测分片已通过;本次推送后仍以新 HEAD CI 为准。pnpm --filter desktop run typecheck:rebase 后最终代码通过,退出码 0。pnpm check:test-hygiene通过(368 files within baseline),pnpm check:dco4 个提交通过,git diff --check通过,preflight 无 BLOCK。2026-10-20 第一轮 review 跟进(历史验证):基于
origin/main5bf0a6e353rebase,保留主干 #6514 的用户原话封装及本 PR 授权边界,修复 6 个技术 review thread(远程回执问题有两条重复反馈)。pnpm --filter desktop exec vitest run <以下 17 个文件> --maxWorkers=2:1258 项通过,15.91s。覆盖本轮 CI 报错文件、Host 授权、群授权、队列、Orca、消息来源和远端投递。pnpm --dir packages/lizi-mcps exec vitest run <以下 6 个文件>:80 项通过,1.06s,验证 helper 的直接/渐进调用与 Orca 工具路径。pnpm --filter desktop run typecheck:通过(退出码 0);最终生产代码再运行一次仍通过。pnpm check:test-hygiene:通过(368 files within baseline);pnpm check:dev-docs:10 项通过;git diff --check:通过。pnpm check:dco:3 个提交签名通过;git skill preflight 无 BLOCK。taskActionAuthorization.test.ts单文件 21 项,1.06s;sessionHandoffIpc.test.ts单文件 15 项,779ms。新用例并入既有文件,模块只加载一次,无真实等待。bindTaskActionInput/assertTaskActionCurrent/getTaskActionInputState缺失来自生产代码切片/模块 mock 未提供新依赖;本轮接入真实 helper 或对应宿主事实,保留原有权限与来源断言。sessionControlService的 runtime patch 断言包含新增的beforeMutation,没有删弱测试。Desktop 文件:taskActionAuthorization、agent-input-coordinator、sessionHandoffIpc、sessionHandoffRemote、messageSourceNote、pluginTaskAuthorshipWiring、botDirectMessageService、sendToSessionLazyResumePermission、sessionControlService、collabSendOutcome、botGroupToolAuthorization、botWorkbenchAccess、taskToolCallAuthorizer、mcpToolApprovalPolicy、chatServer、orcaLifecycleService、orcaInterAgentDispatcher。
MCP 文件:botWorkbenchTool、lizi_xdtHelperMcpServer、botCapabilitiesTool、getCapabilitiesTool、startTeamTool、createWorkersTool。
本轮回归价值:
以下为上一轮已完成的验证记录,不替代上面当前 HEAD 的结果:
本次基于 fetch 后的
origin/main(6a6ad571ad)完成 rebase;解决语言文件和协议文档冲突时保留双方新增内容。pnpm --dir apps/desktop exec vitest run … --maxWorkers=2:907 项通过(14.69s):taskActionAuthorization、botGroupToolAuthorization、botWorkbenchAccess、taskToolCallAuthorizer、agent-input-coordinator、sessionHandoffIpc、sessionHandoffRemote、mcpToolApprovalPolicy、chatServer。pnpm --dir packages/lizi-mcps exec vitest run …:80 项通过:botWorkbenchTool(10,558ms),lizi_xdtHelperMcpServer / botCapabilitiesTool / getCapabilitiesTool / startTeamTool / createWorkersTool(70,1.95s)。taskActionAuthorization.test.ts单独 19 项通过,1.82s。pnpm --filter desktop run typecheck:最终提交前再次运行通过(退出码 0)。pnpm --filter @cindy/mcps run --if-present typecheck:该包无此脚本。本次仅改工具说明,类型依赖由 Desktop typecheck 覆盖;该包首版build的 10 条既有类型诊断曾在当时 main 副本复现,本轮未重跑该独立 build,不声明它已修复。pnpm check:test-hygiene:通过(368 files within baseline)。pnpm check:dev-docs:10 项通过。git diff --check:通过。pnpm check:dco:2 个提交签名通过;git skill preflight 无 BLOCK。本轮实际定向命令:
其中
toolCallAuthority.test.ts在当前仓库不存在,第一条 MCP 命令实际只选中 botWorkbenchTool;共享权限入口的覆盖来自 Desktop taskActionAuthorization,以及 MCP server 的直接/渐进调用测试,不把未选中的文件计为通过。测试价值(均 unit):
手工验证
自审完整 diff、DCO 与公开内容;未读取或修改真实消息队列、用户待办、运行规则和模型配置。仅在隔离工作区及临时测试目录操作。
未执行的验证与剩余事项
上述剩余工程与验收事项继续保留,进入正式评审不表示这些事项已经完成;不扩大产品授权。PR 跟进仅按用户另行授权执行,不改产品中的例行跟进规则。
风险
风险分类
影响与回滚
ensureBuiltin保留 enabled 选择;旧 follower 不变成授权;已发送记录不删除,无用户数据脚本。提交前检查