Skip to content

fix(report): 继承自然会话位置并兼容跨机器回传 - #690

Open
Gundam98 wants to merge 1 commit into
deepcoldy:masterfrom
Gundam98:task/botmux-20260731-review-handoff-routing/botmux/9e9daf96
Open

fix(report): 继承自然会话位置并兼容跨机器回传#690
Gundam98 wants to merge 1 commit into
deepcoldy:masterfrom
Gundam98:task/botmux-20260731-review-handoff-routing/botmux/9e9daf96

Conversation

@Gundam98

Copy link
Copy Markdown

背景

botmux report 同时承担“唤醒原 Reviewer / orchestrator”和“决定消息可见落点”两项职责。此前在没有 dispatch registry 时固定回退群顶层,导致从话题中发起的普通开发 Review、返工或复审脱离原对话;但 legacy / 跨机器 --bot dispatch 又必须保留无 registry 时回到群顶层的兼容行为。

根因

report 的接收者与消息落点耦合,且无 registry 的普通 report 和跨机器 legacy dispatch 缺少可区分的路由信号,因此无法同时满足自然会话继承和旧 dispatch 回传语义。

改动

  • 解耦 report 的接收者解析与消息落点解析。
  • 默认落点优先级调整为:显式 --into / --top-level → dispatch registry → legacy dispatch 顶层回退 → 当前轮次位置 → 会话安全默认。
  • 复用 currentReplyTarget,并校验其 turnId 与当前轮次一致,避免旧话题目标污染新一轮 report。
  • 为 legacy / 跨机器 dispatch 注入尾置 --legacy-dispatch 标记:本机 registry 命中时仍回原 orchestrator session,无 registry 时保持群顶层兼容回退;尾置形式兼容旧版 parser 对正文的读取。
  • 保持显式位置覆盖只改变消息落点,不改变接收者。
  • 更新 CLI 帮助和结构化输出,补充 deliveryrecipientplacementSourcemessageTarget
  • 补充群顶层、话题、quote-only、过期 turn、显式覆盖、dispatch registry 及跨机器 legacy fallback 的单元测试。

用户影响

  • 从群顶层发起的普通 Review / 返工继续留在群顶层。
  • 从话题发起的普通 Review / 返工继续留在原话题。
  • 多话题编排仍按 registry 回到原 orchestrator 会话。
  • 跨机器 legacy dispatch 在接收端没有 registry 时仍按旧协议回到群顶层。
  • 不新增生命周期状态机、按钮验收或流程门禁。

验证

  • pnpm vitest run --project unit test/dispatch.test.ts test/reply-target-fallback.test.ts test/session-marker-resolve.test.ts:106/106 通过。
  • pnpm exec tsc --noEmit:通过。
  • pnpm build:通过,runtime build id f3fa843a3356
  • node dist/cli.js report --help:通过。
  • git diff --check:通过。
  • 使用已安装 Botmux v2.111.0 做只读兼容探针:尾置 marker 命令保留前置正文并到达 session 校验;未发送消息、未修改安装产物。

已知限制

  • 未执行真实飞书 E2E,因为真实 report 会产生外部消息;本次以纯函数测试、类型检查和构建验证为主。
  • 首次 Review 前的全量测试结果为 11,394 通过、6 失败、6 跳过;6 个失败均来自未修改的 v3 worker/fence Linux 进程发现或恢复测试,单独复跑失败形态不变,与本改动无调用链关系。
  • 未修改本机 npm 安装产物,未重启 daemon。

@Gundam98
Gundam98 marked this pull request as ready for review July 31, 2026 15:25
@Gundam98
Gundam98 requested a review from deepcoldy as a code owner July 31, 2026 15:25
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.

1 participant