ENG-1940: Finish an in-progress build when the live build connection is refused - #3844
Conversation
…available When the build-log-streamer WebSocket is denied for an in-progress build, complete the build without it: poll the build to completion, read the resolved artifact download URLs from a re-fetched commit, and drive the existing download/install path off them. A build that fails during polling is surfaced as a failure. The runtime gains a WithBuildPlanPoller option -- a caller-supplied closure, so pkg/runtime takes no buildplanner dependency -- which the runbits layer wires for in-progress builds. Together with the graceful-degradation change this sits on, a denied stream no longer stops state checkout / install from completing. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR adds a fallback path to complete a runtime setup when the build-log WebSocket stream is refused/denied, by polling the build to completion and then proceeding with the normal download/unpack/install flow using resolved artifact URLs.
Changes:
- Add a configurable build-plan poller (
Opts.PollBuildPlan) and option helper (WithBuildPlanPoller) for non-stream completion. - In
setup.update(), treat build-log stream denial as non-fatal and complete the build via polling + normal obtain/install. - Add unit tests covering URL resolution behavior and poller error propagation.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| pkg/runtime/setup.go | Adds denial fallback logic plus completeWithoutStream/resolveDownloads helpers. |
| pkg/runtime/setup_denial_test.go | Adds tests for URL resolution and poller failure behavior. |
| pkg/runtime/options.go | Adds WithBuildPlanPoller option wiring into Opts. |
| internal/runbits/runtime/runtime.go | Wires the build-plan poller for in-progress builds using the buildplanner model. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Failing tests are known and unrelated to this PR. |
|
As discussed on Zoom, I'm comfortable putting this in because we won't hit it until we start restricting access on the Platform side. We can test properly in another release cycle. |
| if !buildlogstream.IsStreamDenied(err) { | ||
| return errs.Wrap(err, "errors occurred during buildlog streaming") | ||
| } |
There was a problem hiding this comment.
At this time, the Platform is not denying build log streams, so the code below won't get hit yet.
…l/eng-1940 # Conflicts: # pkg/runtime/options.go # pkg/runtime/setup.go
https://activestatef.atlassian.net/browse/ENG-1940
When you check out or install a project that still has to build, the State Tool follows the build over a live connection. If that connection is refused, it used to give up. This makes it finish the job another way: it waits for the build to complete by polling, then downloads and installs the results just as it normally would — you just don't see the live build log.
This is the counterpart to the earlier change that made a refused connection show a clear message instead of failing; together they mean a refused connection no longer stops a checkout or install from completing.
Based on version/0-48-1-RC3 rather than master; it reaches master through the normal release flow.
🤖 Generated with Claude Code