♻️ refactor(realtime): 拆分会话编排职责 - #128
Merged
Merged
Conversation
This was referenced Sep 10, 2026
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.
关联 Issue
Closes #123
做了什么
SessionWebSocketHandler收敛为鉴权、帧解析、命令路由和关闭通知。RealtimeSessionCoordinator、RunnerLeaseManager、SessionEventDispatcher、HandoffSessionSubscriber与WebSocketEventSender,分离运行编排、租约、事件投送和只读 handoff 生命周期。实现与架构
session_started、source_sync_state、字幕、音频、纠偏、报告和错误事件保持不变。RunnerLeaseManager;续租失败会停止本机 runner、释放 owner 并尽力通知当前 socket。SessionEventHub再发送给主连接,handoff 只消费 replay/订阅,不能控制主 runner。实验记录
实验:本地 H2/Mockito WebSocket 回归,覆盖主连接启动、第二连接拒绝、Redis lease 已占用、handoff replay/runner relay、暂停恢复、media_clock 校验、结束和断连清理。
结果:
SessionWebSocketHandlerTest13/13 通过;完整后端mvn -B test132 tests 通过,5 个 opt-in 外部集成按预期跳过。结论:拆分后的协议事件与错误文案维持兼容,连接、lease、handoff 与报告收尾边界均有回归保护。本地替身不构成真实 Redis 多节点可用性、模型质量或线上 SLA 证明。
验证
风险与回滚
提交前检查