Merged
Conversation
新增全局 NotificationBus(asyncio fan-out pub/sub),SubAgent 任务完成/失败和 Cron 执行结束时向所有 WebSocket 订阅方广播事件。前端通过 useNotifications Hook 连接 /api/v1/notifications/ws,按类型 invalidate React Query 缓存, 移除 useTasks / useCron / DashboardPage 的定时轮询,降低无效请求。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
NotificationBus(backend/agentpal/services/notification_bus.py):基于asyncio.Queue的 fan-out pub/sub 总线,支持 256 消息缓冲、慢消费者丢弃、指数退避重连GET /api/v1/notifications/ws(notifications.py):每 30 秒无消息时发送心跳{"type": "ping"}保持连接notification_bus.publish()广播事件,失败不影响主流程useNotificationsHook +NotificationProvider:连接 WS 端点,按INVALIDATION_MAPinvalidate React Query 缓存;指数退避自动重连(1s → 30s)useTasks(5s)、useCron(10s)、DashboardPage(30s)改为 WS 事件驱动 +staleTime,减少无效请求Test plan
backend/tests/unit/test_notification_bus.py— 覆盖 subscribe/publish/unsubscribe/慢消费者/广播等 9 个场景backend/tests/integration/test_notifications_ws.py— WebSocket 连接、消息收发、心跳🤖 Generated with Claude Code