Repository navigation
app/: live updates over server-sent events for the pages and the CLI's --wait (sc-8897, sc-8900); CLI 0.2.23 - #149
Merged
Merged
Conversation
VisualCIdocspring/visualci · build #232 · 341 unchanged · no changes This PR vs base: 8 changed, 2 added since #211, across 2 builds docspring/visualci · journeys · build #230 · 14 unchanged · no changes This PR vs base: 2 added since #207, across 2 builds Updated as builds change. Agents can review with VisualCI's MCP tools. |
…s --wait (sc-8897, sc-8900); CLI 0.2.23
Every stream starts with a snapshot of the current state; streams authorize with the same Principal as the API and
MCP (vca_ tokens on their own resource); open streams are capped per principal, per build and per process (429 with
Retry-After); idle streams hold no database connection. The CLI's --wait follows /api/v1/live/builds/{id} and falls
back to polling when there's no stream. Supersedes #94.
Co-Authored-By: Claude <noreply@anthropic.com>
ndbroadbent
force-pushed
the
laravel-sse-v2
branch
from
December 3, 2026 21:52
e61fc4a to
998a8bc
Compare
This was referenced Dec 3, 2026
Merged
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.
Live updates over server-sent events for app/: the build and project pages, and the CLI's
--wait. Replaces #94, rebuilt on current main (the frontend infrontend/, app/ in the root workspace, settings inconfig.rs) and fixed against the review findings.What it does
GET /api/ui/live/orgs/{org}/projects/{project}and.../builds/{number}(app host, the session): the pages follow these and read their data again on each event.GET /api/v1/live/builds/{id}(API host, a token): the CLI's--wait. Each event carries the build exactly asGET /api/v1/builds/{id}answers it.BuildChangedlistener (listeners::tell_the_live_streams), plus a new build, a build starting to process, and each processing run that makes progress while waiting for renders. They go through Postgres LISTEN/NOTIFY (app/src/live.rs, already on main).The review findings
snapshot: the build's JSON for the CLI, and "read now" for the pages. The stream subscribes before it reads, so nothing falls between the two. A browser that reconnects, or a CLI that starts after the build finished, has the state at once. Tests:a_stream_opened_after_the_build_finished_has_its_final_state_at_once,a_reconnection_starts_with_the_current_state, and the frontend'slive.test.tsx.VISUALCI_LIVE_MAX_STREAMS_PER_PRINCIPAL(30, counting a person, a project token, or a visitor's IP),VISUALCI_LIVE_MAX_STREAMS_PER_BUILD(100) andVISUALCI_LIVE_MAX_STREAMS(2000). A stream over a limit is refused before it starts, with a 429 andRetry-After: 30in each endpoint's error format.VISUALCI_LIVE_STREAM_SECONDS, 30 minutes) or the server shuts down.READS), so a burst that reaches every stream can't take web's 20-connection pool.a_stream_past_a_limit_is_refused(its own test binary,live_limits.rs),each_limit_refuses_the_next_stream_and_a_closed_stream_frees_its_place,a_closed_stream_gives_its_place_back.Principalextractor. On the API stream, a token it doesn't recognise falls back tomcp::oauth_principal, so avca_token is checked against its own resource (<mcp url>/mcp, scopemcp).get_buildallows.a_project_token_follows_only_its_own_projects_builds,people_follow_their_organizations_builds_and_public_ones,an_mcp_clients_oauth_token_follows_on_its_own_resource(an admin-resource token and a revoked token both get a 401). The OAuth connect helper moved frommcp_admin.rstotests/oauth_client/.CLI (0.2.23)
waitfollows the stream and keeps its exit codes, because it still returns theBuildthattest_exit_codereads (0, 1, 3, 4). It falls back to polling in these cases:text/event-stream);A stream that goes silent for 45 s is reconnected. While it follows a stream,
waitalso reads the build once a minute, in case the stream only sends keep-alives. At the timeout it reads the build one last time.Tests (fake server):
wait_follows_the_live_stream_until_the_build_is_decided,a_wait_that_starts_after_the_build_finished_returns_at_once,wait_polls_when_the_server_has_no_live_stream,wait_polls_when_a_proxy_holds_the_stream_back,wait_reads_the_build_when_the_stream_only_keeps_alive,wait_answers_the_undecided_build_at_its_timeout.The docs'
VISUALCI_VERSIONpins stay on 0.2.22 until 0.2.23 is released.Frontend
useLivereads again onsnapshotandchanged. Pages poll only while no stream is open.Proxies, health and docs
Cache-Control: no-cache, no-transform(which stops Cloudflare and Envoy compressing them) andX-Accel-Buffering: no./statusgainslive_streams_openandlive_listener(idle,starting,okorstale)..env.exampleare regenerated,reference/api.mdhas a new "Follow a build" section, and design.md has a "Live updates" entry.Infra (talira-ai/infra), needed before streams last past a minute in production
visualci-subdomain-routessetstimeoutPolicy.response: 60s, so Envoy cuts every stream at 60 s. The fix is a route for the prefixes/api/ui/liveand/api/v1/livewithtimeoutPolicy.response: infinity, keepingidle: 300s(comments arrive every 15 s). Until then, clients reconnect each minute and get a fresh snapshot, which works but is wasteful.Supersedes #94.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.