Skip to content

Serve the live view connect bounds instead of compiling them in - #472

Open
robertjamesprior wants to merge 1 commit into
mainfrom
hypeship/live-view-bound-budget
Open

robertjamesprior wants to merge 1 commit into
mainfrom
hypeship/live-view-bound-budget

Conversation

@robertjamesprior

@robertjamesprior robertjamesprior commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The per-stage connect bounds the live view client arms while connecting are now served with the page instead of compiled into the bundle, so a region can retune one without a browser image release. This follows review feedback on the earlier revision of this branch, which shortened the media bound in the client.

The bounds are read at load from window.KERNEL_LIVE_VIEW_CONNECT_TIMEOUTS_MS, which the live-view proxy injects ahead of the first script in the page from its own environment (kernel/kernel#4889, kernel/infra#1693). A stage the proxy does not name, or names with a value that is not a positive number of milliseconds, keeps the default the image ships, so the client behaves the same on a proxy that injects nothing.

The defaults stay transport 15s, signaling 3s and media 30s, a worst case of 48s across the three, and a test pins them so a silent change fails CI.

Why the media default stays at 30s

The bound covers the connect through ICE connected, and that stretch is unmeasured in every region: 44 of the 130 probe runs stopped at checking, all 30 ap-southeast runs among them. The measured paths land in 1-16ms direct and ~90ms relay-only, which is what made a shorter default tempting, but an expired bound is terminal and the client does not retry, so the default stays at the ceiling the data supports rather than the shortest value that fits the measured regions. A region with the timings lowers it through the override.

Transport stays at 15s: the live-view proxy can spend ~12s waking a browser before the socket opens, so shortening it would report a slow wake as dead.

Testing

bun test tests in images/chromium-headful/client, 235 pass, 0 fail, including cases for a partial override, values that are not positive milliseconds, an unknown stage, and the shipped defaults being the documented 15 / 3 / 30. tsc --noEmit clean.

Related

browsers/live-view.mdx moves with this in kernel/docs#704: the example watchdog goes from 15s to 50s, above the 48s budget, and the sentence claiming KERNEL_CONNECTION_TIMEOUT stops firing once negotiation begins, which describes the pre-kernel-images#417 client, is corrected.

@robertjamesprior
robertjamesprior marked this pull request as ready for review October 16, 2026 19:36

@Sayan- Sayan- left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

rather than tuning this timeout internally the change in this PR should be the plumbing required to accept this as an env var we can control externally (e.g. as we add more regions or data for timeouts, etc changes)

@robertjamesprior
robertjamesprior force-pushed the hypeship/live-view-bound-budget branch 2 times, most recently from 36a10b2 to e94d47c Compare October 19, 2026 18:09

Copy link
Copy Markdown
Contributor Author

moved the value out of the client. it reads window.KERNEL_LIVE_VIEW_CONNECT_TIMEOUTS_MS at load and falls back to the image defaults, and metro-api injects it per region from KERNEL_LIVE_VIEW_CONNECT_TIMEOUTS (kernel/kernel#4889, kernel/infra#1693). no image release to retune. is metro-api the surface you meant, or did you want the api appending it to the live view url?

@robertjamesprior robertjamesprior changed the title Bring the live view connect budget inside the embedder watchdog Serve the live view connect bounds instead of compiling them in Oct 19, 2026

@Sayan- Sayan- left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

overall looks good, and the external timeout config is what i was asking for. can we keep the default media timeout at 30s for now? the 10s default hasn't been validated across regions; 44 of 130 probes never recorded connected, including all 30 ap-southeast runs.

The per-stage bounds added in #417 run in sequence, so they sum to a budget an
embedder has to outlast to see why a viewer stalled, and tuning them in the
client means every adjustment, and every new region, waits on a browser image
release.

The bounds are read at load from window.KERNEL_LIVE_VIEW_CONNECT_TIMEOUTS_MS,
which the live-view proxy serves with the page from its own environment. A stage
the proxy does not name, or names with a value that is not a positive number of
milliseconds, keeps the default the image ships, so the client behaves the same
on a proxy that injects nothing.

The defaults are unchanged: transport 15s, signaling 3s, media 30s. The media
bound stays at its interim ceiling because the stretch through ICE `connected`
is unmeasured in every region — 44 of 130 probe runs stopped at `checking`, all
30 ap-southeast runs among them — and the override is what a region with the
timings uses to lower it. A test pins the shipped defaults so a silent change
fails CI.

`bun test tests`: 235 pass, 0 fail. `tsc --noEmit` clean.
@robertjamesprior
robertjamesprior force-pushed the hypeship/live-view-bound-budget branch from e94d47c to 4a1031d Compare October 20, 2026 04:17

robertjamesprior commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor Author

yeah, that makes sense. put the media default back at 30s and the override is the only path to a shorter one and a region changes it with its own timings.
docs now arm the sample watchdog above the 48s budget. underlying plumbing is unchanged.

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.

2 participants