Skip to content

Comments

feat(web): real-time dashboard with SSE and optimistic UI updates#94

Open
AgentWrapper wants to merge 1 commit intomainfrom
feat/realtime-sse-dashboard
Open

feat(web): real-time dashboard with SSE and optimistic UI updates#94
AgentWrapper wants to merge 1 commit intomainfrom
feat/realtime-sse-dashboard

Conversation

@AgentWrapper
Copy link
Collaborator

Summary

  • SSE subscription: Dashboard subscribes to /api/events on mount and patches status/activity/lastActivityAt in real-time — no more page reloads needed when agent state changes externally
  • Optimistic UI: Kill, merge, and restore actions update local state immediately before the API call resolves, with automatic rollback on failure; SSE reconciles true state within 5s
  • Session detail page: Replaces unconditional 5s polling with SSE-driven instant status updates + 30s fallback poll for PR/CI data refresh
  • Live stats: Stats bar recomputes from live session state on every SSE event and every optimistic action

Test plan

  • Open dashboard — session status badges update without reloading when an agent starts/stops working
  • Click "terminate session" — row immediately moves to the DONE zone; if the kill API fails, it snaps back
  • Click "merge PR" — PR row disappears from the PR table immediately; if merge fails, it reappears
  • Click "restore session" — row immediately moves out of DONE zone
  • Open a session detail page — activity badge updates when agent state changes without a full page reload
  • Kill the dev server briefly, verify SSE reconnects after 3s without a page reload
  • Verify stats bar (sessions / working / open PRs / need review) reflects changes made via optimistic updates

🤖 Generated with Claude Code

@AgentWrapper AgentWrapper force-pushed the feat/realtime-sse-dashboard branch 2 times, most recently from b17d6c9 to b287922 Compare February 19, 2026 14:54
@AgentWrapper AgentWrapper force-pushed the feat/realtime-sse-dashboard branch from 6a14da4 to 3b5facf Compare February 20, 2026 14:10
- SSE subscription: Dashboard subscribes to /api/events and patches
  status/activity/lastActivityAt in real-time — no page reloads needed
- applySSESnapshot: bail-out optimization (returns original array ref when
  unchanged), skips sessions with pending optimistic updates
- Optimistic UI with ref-counted pending guard (Map<string,number>):
  kill/merge/restore update local state immediately with rollback on failure
- pr.state synced when SSE delivers status:"merged"
- Session detail page: useSSE for instant status + polling for full data
- computeStats in types.ts (client-safe); deduplicated from serialize.ts
- CI: pnpm strict audit now distinguishes registry outages from vulnerabilities

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@AgentWrapper AgentWrapper force-pushed the feat/realtime-sse-dashboard branch from 3b5facf to 8aa91ad Compare February 21, 2026 13:24
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

status: update.status,
activity: update.activity,
lastActivityAt: update.lastActivityAt,
};
Copy link

Choose a reason for hiding this comment

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

Session detail SSE misses pr.state sync on merge

Medium Severity

The session detail page's SSE handler patches status, activity, and lastActivityAt but doesn't sync pr.state when status becomes "merged". The Dashboard's applySSESnapshot correctly mirrors pr.state to "merged" in this case, but the session detail page omits this. SessionDetail relies on pr.state === "merged" to render the "Merged" badge and to suppress stale "Merge conflicts" warnings — so for up to 30 seconds (until the next poll), the detail page shows contradictory information: session status says "merged" while the PR card still appears open with possible false conflict warnings.

Additional Locations (1)

Fix in Cursor Fix in Web

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.

1 participant