Skip to content

Dispatch start_url navigation asynchronously in chromium configure#287

Draft
yummybomb wants to merge 1 commit into
mainfrom
hypeship/async-start-url-nav
Draft

Dispatch start_url navigation asynchronously in chromium configure#287
yummybomb wants to merge 1 commit into
mainfrom
hypeship/async-start-url-nav

Conversation

@yummybomb

@yummybomb yummybomb commented Jun 11, 2026

Copy link
Copy Markdown

Summary

The batched configure handler blocks its response on the start_url navigation dispatch — a CDP dial + Page.navigate bounded by the 3s startURLDispatchTimeout. For sessions created with configuration (profile, viewport, extensions, …), the API awaits this handler synchronously inside ConfigureAndClaimActivity, so that dispatch time sits directly on POST /browsers latency.

This moves the navigation dispatch into a goroutine (same context.WithoutCancel pattern the handler already uses for recording restarts), kicked at the earliest safe point: after profile install and the chromium restart in the stop/start path (a restart would undo the navigation), and after the display patch in the display-only path. Navigation was already best-effort — errors are only logged — so the response contract is unchanged.

Companion to kernel/kernel#2380, which takes start_url-only creates off the synchronous claim path entirely.

Semantics

start_url owns the initial tab state: when the dispatch lands it closes all other page targets and navigates the survivor to the given URL — including tabs restored by a chrome profile. This is intentional. With the dispatch now async, the navigation lands shortly after the configure response instead of strictly before it, so a client that connects and starts driving immediately can have that work reset when the dispatch lands (measured locally: a navigation issued 11ms after the response was overridden ~120ms later; 500ms after was untouched). Clients passing start_url should treat the page as not theirs until the start URL is loaded.

Test plan

  • go build ./cmd/api/... / go test ./cmd/api/api/ -run Configure
  • Docker headless image, PR vs main: configure response 12.4ms (PR, nav lands ~100ms later) vs 93.7ms (main, nav inline) — ~80ms off the blocking path with no profile attached
  • Verified tab-reset semantics: late-landing dispatch closes extra targets and forces the surviving page to start_url
  • On a metro-deployed image: profile + start_url, page lands on start URL after profile load

🤖 Generated with Claude Code

The configure handler blocked its response on the start_url navigation
dispatch (CDP dial + Page.navigate, up to 3s on a slow dial). Kick it in
a goroutine instead: it still runs after profile install and chromium
restart, so ordering relative to profile loading is unchanged, but the
caller (the API's synchronous ConfigureAndClaimActivity) no longer waits
on it. Navigation was already best-effort — failures only logged.
@yummybomb yummybomb force-pushed the hypeship/async-start-url-nav branch from c6d45f0 to 20b4e7b Compare June 11, 2026 14:55
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