Skip to content

fix: scope automatic task notifications to the current session - #554

Merged
x-lixu merged 2 commits into
mainfrom
codex/fix-549-session-notifications
Oct 15, 2026
Merged

x-lixu merged 2 commits into
mainfrom
codex/fix-549-session-notifications

Conversation

@zzasdf

@zzasdf zzasdf commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

变更说明

同一 owner 的会话 A 结束后,异步任务完成留下的 pending 通知,会在会话 B 就绪时被自动领取,并把 A 的结果注入 B 的模型播报输入。已用 v2.0.1 的真实 session runtime + 模拟模型边界复现;最新 main 仍有相同默认行为。

将 SessionTaskCoordinator.claimPendingNotifications() 的 includeOtherSessions 默认值设为 false,使连接、唤醒和恢复路径默认只领取当前 owner/session 的通知。同一 session 重连仍可恢复待播报结果;可信宿主确认接收人一致后,仍可在代码中显式 opt in 跨 session 领取,owner 校验保持生效。

回归覆盖任务在 A 关闭后完成、已领取但未确认播放时关闭、B 不领取且原 A 可恢复、显式 task ID 不绕过 session 限制,以及显式跨 session opt-in 不跨 owner。同步更新中英文协议文档与 Changelog。

Refs #549。该 PR 处理已确认的跨 session 自动领取问题;补充评论中的同会话投递停滞仍需实际事件序列定位,故不自动关闭 issue。

验证

  • 相关测试:node --test server/test/session-task-coordinator.test.mjs server/test/realtime-session-runtime.test.mjs server/test/announcement-window.test.mjs server/test/task-notification-queue.test.mjs server/test/task-manager.test.mjs — 72/72 通过。
  • 将默认值临时恢复为旧实现后,新增的两个 session-runtime 防泄露用例和 coordinator 防泄露用例均失败;恢复修复后通过。
  • npm run lint
  • npm run build
  • npm run audit:release(在 release:check 中通过)
  • git diff --check
  • npm test / npm run release:check:本机完整检查未全绿。沙箱外 root suite 为 267 通过、2 跳过、1 失败,失败是复用的本机 Electron 43.6.0 与最新 lockfile 43.7.9 不匹配。
  • 独立 server 全量测试(限制并发 4):1719 通过、6 跳过、1 个文件失败;openclaw-delegation.test.mjs 单独诊断也以 exit 137 终止,未得到断言结果,终止原因未确定。
  • 行为变化已补充自动测试。测试使用 Node 26.6.0、隔离配置目录和现有本机依赖;没有调用真实语音模型或播放音频。

兼容性与安全

  • 未提交密钥、用户数据、日志或内部地址。
  • 用户可见行为变化已同步更新文档;无新配置或依赖变化。
  • 无 examples 变更,示例规范不适用。
  • 安全影响:默认阻止同 owner 的新 session 自动播报旧 session 结果;不把 session ID 当作认证边界。personal 模式仍假设单一可信用户,共享设备应使用独立认证 owner,并避免不同用户复用同一个 session。

兼容性变化:新建 session 不再自动接收旧 session 的结果;恢复原 session 的结果投递保留。不改变任务执行、结果保存、通知确认或网络入口。回滚此提交会恢复旧的跨 session 默认领取行为,同时恢复本 issue 的风险。

Copilot AI balanced review requested due to automatic review settings October 15, 2026 09:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI balanced review requested due to automatic review settings October 15, 2026 10:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@x-lixu x-lixu 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.

复核通过,感谢修复及回归测试。默认领取范围限定当前 owner/session,保留原会话重连恢复和显式跨会话 opt-in 的 owner 校验;不取消旧任务或删除结果。相关测试本地复跑通过,最新跨平台 CI 和 release-check 全部通过。后台协调 Session 生命周期一致性另行排查,不扩大本 PR 范围。

@x-lixu
x-lixu merged commit 571254e into main Oct 15, 2026
11 checks passed
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