Skip to content

feat(approvals): add policy-gated batch decisions (#403) - #410

Merged
PeterGuy326 merged 1 commit into
feat/402-multi-party-approval-policyfrom
feat/403-policy-gated-batch-decisions
Sep 20, 2026
Merged

PeterGuy326 merged 1 commit into
feat/402-multi-party-approval-policyfrom
feat/403-policy-gated-batch-decisions

Conversation

@Bindy-lbb

Copy link
Copy Markdown
Collaborator

Closes #403

Summary

  • add server-side policy classification and batch preflight for homogeneous low-risk tool approvals
  • settle accepted members in one pendingApprovals recovery turn with per-item audit/idempotency
  • add queue selection, IPC bridge, and boundary/count disclosure

Verification

  • npm run typecheck --silent
  • npm run build --silent
  • node --test apps/server/dist/test/approvals-center.test.js apps/desktop/test/approvals-center-ipc.test.cjs
  • npm run test:renderer --silent -- approval-queue.test.tsx

@waterbro-8 waterbro-8 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

代码方向对(服务端先全员预检再改写、只允许显式 tool+medium、同源、逐项 version/audit、客户端不能直接投 pendingApprovals),但现在不能合,也先不批。

Blocker:base 不是当前 main

  • PR base 是 feat/402-multi-party-approval-policy,head 相对 main diverged:ahead 2 / behind 1。
  • #409 已经 squash 进 main(48fd61affdee41d863aa5ddedc44fec355370f70)。本 PR 还带着 squash 前的 fee7ea7ec8,并落后 squash 带进来的 packaging/auth/config/errors 等文件。
  • 请 rebase 到最新 main 后再找我重审。不要在 feat/402 上叠。我推不了你的分支。

#403 AC 测试不够

Issue 要求 allowed homogeneous low-risk sets and every disallowed boundary。现在只有:

  • 同源 tool 批量成功 + replay
  • 无 batch 策略 / 不同来源 → 全员 rejected

还缺独立用例:write/exec/network、过期、version 冲突、threshold>1、run scope。rebase 后请补上。

非 blocker,但 rebase 时建议看一眼

decideBatch 预检是全员的,但后面 save 循环不是事务。成员 1 落盘后成员 2 失败,会留下半批准,且同 requestId 重试会走 “already used for another decision”。最好先全部 append 成功再对外可见,或失败时回滚/标 indeterminate。

非产品验收。CI 的 Node 24 我还在看,但 base 问题已经足够挡。

@PeterGuy326
PeterGuy326 merged commit f5e9af1 into feat/402-multi-party-approval-policy Sep 20, 2026
10 checks passed
@PeterGuy326

Copy link
Copy Markdown
Contributor

记录更正:这个 PR 的合并没有到达 main

GitHub 把本 PR 标为 MERGED(merge commit f5e9af18,2026-09-20T09:54:03Z),协作群里也按"已合入 merge SHA f5e9af1"记了一笔。实际状态不是这样,核对结果:

  • 本 PR 的 base 是 feat/402-multi-party-approval-policy,不是 main。f5e9af18 的父提交是 fee7ea7e,也就是 @waterbro-8 在 review 里明确要求不要继续叠的那个 squash 前提交。
  • git merge-base --is-ancestor f5e9af18 origin/main → false;compare/main...f5e9af18 → diverged(ahead 2 / behind 4)。
  • 在 origin/main(ac916af)上 git grep pendingApprovals 和 git grep decideBatch 均为零命中。

原因是时序:#409(feat/402 → main)在 07:40Z 已经 squash 进 main(48fd61af),本 PR 在 09:54Z 才合进 feat/402。承载它的那条 feature 分支在合并发生时已经不再是通往 main 的路径,所以这 29 个文件的改动停在了分支上。

结论:#403 在 main 上的交付量是 0。 issue #403 目前仍是 OPEN(closedAt 为 null)——这一点是对的,因为 "Closes #403" 只在合入默认分支时才会触发,所以 issue 状态没有跟着误导人。

同时受影响的还有引擎侧依赖:digital-employee#337 提供的就是本 PR 要消费的 pendingApprovals 批量结算能力。#337 目前 OPEN,我在上面提了一个 evidence 契约的阻塞项;即便它修好合入,main 上也没有它的消费方,所以 #403 不能被算作端到端打通。

重做路径

feat/403-policy-gated-batch-decisions 和 feat/402-multi-party-approval-policy 两条分支现在都还在远端。需要一个新的 PR,base = main,并且把 @waterbro-8 那轮 CHANGES_REQUESTED 里尚未解决的实质项一起带上——它们没有因为这次合并而消失:

  1. rebase 到当前 main。现在 behind 4 个提交:48fd61af(feat(approvals): govern multi-party decisions (#402) #409)、6e26755a(fix(desktop): space failed-turn error from the retry button (#412) #414)、e3c87013(feat(reports): flatten stream switcher and make audit rows traceable (#394) #394)、ac916af2(fix(org-workbench): keep stale employee panels on switch (#413) #417),其中 feat(approvals): govern multi-party decisions (#402) #409 的 squash 带进来了 packaging / auth / config / errors 等文件改动,和这里的 apps/desktop/packaging/runtime-layout.cjs、apps/server/src/auth.ts、config.ts、packages/shared/src/errors.ts 直接重叠。
  2. 补齐 feat(approvals): add policy-gated batch decisions for homogeneous low-risk requests #403 AC 要求的 "every disallowed boundary" 独立用例:write / exec / network、过期、version 冲突、threshold > 1、run scope。现有覆盖只有"同源 tool 批量成功 + replay"和"无 batch 策略 / 不同来源 → 全员 rejected"。
  3. decideBatch 的落盘不是事务:预检是全员一次过的,但后面的 save 循环逐个写。成员 1 落盘、成员 2 失败会留下半批准状态,而且同 requestId 重试会撞上 "already used for another decision"。要么全部 append 成功后再对外可见,要么失败时回滚 / 标 indeterminate。

这条我不代为 rebase 合并——第 2、3 项是实质实现工作,而且 reviewer 已经点名要作者处理。

@Bindy-lbb

Copy link
Copy Markdown
Collaborator Author

Replacement delivery is now #418, based on current main (ac916af). It carries the unresolved review items: independent coverage for each disallowed batch boundary and rollback on a partial persistence failure. Please review #418; #410 remains a historical merge into the orphaned feature base.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants