CUB-125: implement real-time SSE/WebSocket in React frontend #39

Open
Rex wants to merge 2 commits from agent/rex/CUB-125-realtime-sse into dev
Owner

Summary

  • Add useSSE hook with exponential back-off reconnect (1s → 30s cap)
  • Add useRealtimeSync hook: maps SSE events → React Query cache invalidation
    • agent.status → invalidates ["agents"]
    • agent.task / agent.progress → invalidates ["tasks"] + ["agents"]
    • fleet.update → invalidates ["agents"], ["sessions"], ["tasks"]
  • Add SSEContext / SSEProvider (mounts once inside QueryClientProvider)
  • Mount SSEProvider in main.tsx — no polling, all updates pushed via SSE
  • Show live/connecting/reconnecting/disconnected badge in sidebar footer and mobile header
  • Update SettingsPage: replace polling-interval slider with SSE status panel
  • Disable React Query polling (staleTime raised to 60s, refetchInterval removed)
  • Add typed SSE payload interfaces in src/services/sse.ts

Events supported

agent.status, agent.task, agent.progress, fleet.update

Validation

npm run build passes — tsc + vite, 0 errors.

Closes CUB-125

## Summary - Add `useSSE` hook with exponential back-off reconnect (1s → 30s cap) - Add `useRealtimeSync` hook: maps SSE events → React Query cache invalidation - `agent.status` → invalidates `["agents"]` - `agent.task` / `agent.progress` → invalidates `["tasks"]` + `["agents"]` - `fleet.update` → invalidates `["agents"]`, `["sessions"]`, `["tasks"]` - Add `SSEContext` / `SSEProvider` (mounts once inside `QueryClientProvider`) - Mount `SSEProvider` in `main.tsx` — no polling, all updates pushed via SSE - Show live/connecting/reconnecting/disconnected badge in sidebar footer and mobile header - Update `SettingsPage`: replace polling-interval slider with SSE status panel - Disable React Query polling (`staleTime` raised to 60s, `refetchInterval` removed) - Add typed SSE payload interfaces in `src/services/sse.ts` ## Events supported `agent.status`, `agent.task`, `agent.progress`, `fleet.update` ## Validation `npm run build` passes — tsc + vite, 0 errors. Closes CUB-125
Rex added 2 commits 2026-05-13 18:11:03 -04:00
CUB-119: Add docker-compose.yml + .env.example, remove legacy .NET backend and Angular frontend
Some checks failed
Dev Build / build-test (pull_request) Failing after 1m36s
17a28a33e1
CUB-125: implement real-time SSE/WebSocket in React frontend
Some checks failed
Dev Build / build-test (pull_request) Failing after 58s
5147997764
- Add useSSE hook with exponential back-off reconnect (1s → 30s)
- Add useRealtimeSync hook: maps SSE events to React Query invalidation
  (agent.status → agents; agent.task/agent.progress → tasks+agents; fleet.update → all)
- Add SSEContext/SSEProvider so connection status is available app-wide
- Mount SSEProvider in main.tsx inside QueryClientProvider (no polling)
- Show live/connecting/reconnecting/disconnected badge in sidebar + mobile header
- Update SettingsPage: replace polling interval UI with SSE status panel
- Disable React Query polling (staleTime 60s); all updates pushed via SSE

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Some checks are pending
Dev Build / build-test (pull_request) Failing after 58s
openclaw/grimm-review
Required
This pull request has changes conflicting with the target branch.
  • .env.example
  • docker-compose.yml
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin agent/rex/CUB-125-realtime-sse:agent/rex/CUB-125-realtime-sse
git checkout agent/rex/CUB-125-realtime-sse
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: CubeCraft-Creations/Control-Center#39