feat: add run SSE events#397
Merged
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a run-scoped Server-Sent Events (SSE) API for streaming (and replaying) run progress events, updates the dashboard Live View to consume the per-run SSE endpoint, adds a Playwright integration test for Live View, and documents the SSE endpoint/event schema.
Changes:
- Add
/api/v1/runs/{runId}/eventsSSE replay endpoint (plus legacy/api/eventsmapped to newest run) and event generation helpers. - Update the dashboard Live View SSE hook/UI to understand the new event types and connect to the per-run endpoint.
- Add Playwright coverage for Live View and document the SSE endpoint/schema in the dashboard guide.
Show a summary per file
| File | Description |
|---|---|
| web/src/hooks/useSSE.ts | Switch Live View to fetch the latest run id and connect to the per-run SSE endpoint; add handling for new event types. |
| web/src/components/LiveView.tsx | Render badges/descriptions for the new run/task/step event types. |
| web/e2e/live-view.spec.ts | Add Playwright test that mocks EventSource and validates Live View rendering. |
| site/src/content/docs/guides/dashboard.mdx | Document the new per-run SSE endpoint, replay semantics, and event schema/types. |
| internal/webapi/handlers.go | Add SSE routes/handlers for per-run events and legacy /api/events; update CORS to allow Last-Event-ID. |
| internal/webapi/events.go | Define SSE event schema, replay filtering via Last-Event-ID/lastEventId, and SSE write helpers. |
| internal/webapi/events_test.go | Add unit tests for event sequencing, replay filtering, legacy endpoint behavior, and concurrent clients. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 8
- Review effort level: Low
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.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
/api/v1/runs/{runId}/eventsServer-Sent Events stream with sequenced replay andLast-Event-ID/lastEventIdrecovery support/api/eventsby replaying the newest run in the same SSE formatCloses #178
Validation
go test ./...npm run buildinweb/npx playwright test e2e/live-view.spec.ts --project=chromiuminweb/npm run buildinsite/golangci-lint run ./internal/webapi ./internal/webserverNote:
make lintcurrently fails on stale paths from a different local worktree (../spboyer-glowing-goggles), while the changed Go packages lint cleanly.