Repository navigation
fix(auth): @ 同机 Bot 交接时沿用本回合已有的委托身份 - #2439
Merged
deepcoldy merged 5 commits intoOct 28, 2026
Merged
Conversation
botmux send --mention 的 mention-prepare 只在当前回合由真人直接触发时签委托, 本回合本身就是委托(例如主编排收到某个 Bot 带委托的回报)时直接返回 no_direct_human。botmux dispatch 的 deliver 路径则会取本回合已验证的委托继续 下派。于是「真人 → 主编排 → A → A @主编排回报 → 主编排 @b」这条常见链路里, B 拿不到原用户身份,--as user 报 requesting user unverified。 - mention-prepare 与 deliver 对齐:先取本回合已验证的委托,按当前群重新校验原 用户的访问权限(delegated_caller_not_allowed),工具只能收窄(no_shared_tool); 定时任务和不带委托的机器人消息仍不签。 - 不签委托时记一条 [dispatch-user:audit] mention-prepare skipped 及原因,之前 这种情况没有任何日志。 - ADR 同步更新。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
iluhcm
requested review from
47seek,
LucasIcarus,
deepcoldy,
xiaoxueSunn and
xiongz-c
as code owners
October 27, 2026 12:02
This was referenced Oct 28, 2026
This was referenced Oct 28, 2026
Owner
|
已合并,感谢贡献!🎉 这个修复让多 Bot 编排链路里的触发人身份可以连续传递:真人 → 主编排 → Bot A 回报 → 主编排再 @ Bot B 时, 合入前在最终 head 上确认:双审可合、CI 首跑全绿(含 bun-test)、相对原版实现逐字未变。 合后跟进(都不阻塞本 PR,已记录):
以上是自动评审与维护者复审的共同结论,最终以维护者审阅为准。欢迎继续贡献。 |
This was referenced Oct 28, 2026
deepcoldy
pushed a commit
to darylchen97/botmux
that referenced
this pull request
Oct 28, 2026
This was referenced Oct 28, 2026
|
🚀 Released in v3.55.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
botmux send --mention <同机 Bot>的/api/dispatch-user/mention-prepare只在当前回合由真人直接触发时签委托;本回合本身就是一条委托(例如主编排收到某个 Bot 带委托的回报)时,直接返回delegated:false, reason:"no_direct_human",而且不打日志。botmux dispatch走的/api/dispatch-user/deliver会用dispatchUserForTurn取本回合已验证的委托,作为inherited传给authorityForDispatch继续下派(ADR 第 2 条)。两条路径行为不一致,所以下面这条常见的编排链路会断:no_direct_human,不签--as user时报requesting user unverified实际排查时,只能翻
dispatch-user-delegations.json才能发现这条派活消息没有委托,daemon 日志里没有任何记录。改动
src/daemon.tsmention-prepare:与 deliver 对齐,先用dispatchUserForTurn取本回合已验证的委托:targetUserForDelegation),不通过时 skip,原因为delegated_caller_not_allowedauthorityForDispatch({ inherited })收窄工具,签发方仍是原应用;交集为空时 skip,原因为no_shared_toolno_direct_human);schedule 能力本来就不继承,这里不变[dispatch-user:audit] mention-prepare skipped source=… chat=… reason=…影响面:只改 mention 交接的签发条件,安全边界与已有的
botmux dispatch多跳下派一致(每跳重新检查目标群访问权限,工具只收窄)。接收端、bind 校验、deliver 路径都不变。验证
npx tsc -p . --noEmit:通过npx vitest run --project unit test/dispatch-user-mention-route.test.ts test/cli-send-mention-handoff.test.ts test/dashboard-ipc.test.ts test/trigger-user-auth.test.ts test/turn-cli-identity.test.ts:5 files,492 passed / 3 skippedappId仍为原应用,工具收窄到继承的集合,第三个 Bot 能在交接消息上解析到身份no_direct_humansrc/daemon.ts的改动后,上面新增的 4 个用例全部变红🤖 Generated with Claude Code