Submatter/plans/Plan-automation-foundation/Epic-fleet-dashboard/Task-convoy-activity-feed-sse.md

64 lines
2 KiB
Markdown
Raw Permalink Normal View History

---
kind: task
slug: convoy-activity-feed-sse
title: Live convoy activity feed (SSE)
plan_slug: automation-foundation
epic_slug: fleet-dashboard
status: draft
priority: P2
tenant_id: global
owner: unassigned
cursor_todo_id: null
updated_at: "2026-08-03"
---
# Task summary
Real-time activity stream from `convoy_events` for mission control and fleet dashboard — research/build/gate/health events without full page refresh.
## Description
**Benchmark:** Autensa live activity feed (SSE). Echodo already appends `convoy_events` for role completion, transitions, and (future) health events — this task exposes them as a **subscription surface**.
### Transport
- Prefer Next.js Route Handler `GET /api/convoys/activity/stream` with SSE (workspace-scoped via session)
- Alternative: tRPC subscription if infra already supports it — pick one, document in ADR addendum
### Event types surfaced
- `role_complete`, `transition`, `health`, `gate_action`
- Payload: `convoy_id`, `title`, `event_type`, `role`, `outcome`, `occurred_at`, `estimated_cost_usd` (when present)
### UI
- Mission control: collapsible **Activity** strip (last 20 events for current workspace)
- Fleet dashboard: global feed with product/repo filter
- Fallback: React Query poll every 30s when SSE unavailable
## Dependencies
- Epic 4 `convoy_events` (shipped)
- [Task-orchestrator-auto-nudge](../Epic-apps-orchestrator/Task-orchestrator-auto-nudge.md) for health events (soft — feed works without it)
## Subtasks
- [ ] SSE route with workspace membership check
- [ ] `convoy_events` tail query + fan-out on insert (LISTEN/NOTIFY or short poll server-side)
- [ ] `ActivityFeed` client component
- [ ] Rate limit / connection cap per user
## Estimation
M
## Acceptance criteria
- [ ] New `role_complete` event appears in mission control within 5s without refresh
- [ ] User cannot subscribe to another workspace's events
- [ ] Connection closes cleanly on navigation
## Links
- Epic: `./Epic-fleet-dashboard.md`