fix(server): keep browser input responsive during slow navigation #16691
main fromrefs/pull/16691/head·merged by juliusmarminge View on GitHubA slow address in the server-hosted Browser panel held its input queue until navigation committed or timed out. A corrected URL and subsequent typing could wait up to 15 seconds.
Start viewer navigation immediately and track only outstanding navigations for release/disconnect. Handoffs still drain that work before agents act; completed promises leave the tracking set. Agent navigation ordering and hard reload behavior are unchanged.
Fixes #16641. Based on @josephv123’s #16691; original commits retained.
Verification:
- Focused ServerBrowser/SessionControl suites: 56 → 57 passing. Four responsiveness regressions fail promptly with base production code; release and actual viewer-disconnect ordering remain covered.
- Server typecheck, targeted lint, format check and diff check passed.
- Independent Claude Opus 5.5 and Codex GPT-6 Sol whole-PR reviews: one clean round.
- Live headless Linux Chromium, actual Browser panel: start a response that stalls for 40 seconds, submit a corrected address, then type. Base remains on the stalled address with no input; head loads the correction and receives the text immediately. Matching captures use isolated state and an explicit test font.
- Not verified: macOS, Windows, iOS, Android, or Electron desktop. Agent handoff ordering is unit-tested, not exercised with a live provider.
Before (actual base):

After:

Before interaction recording · After interaction recording
Implemented with Codex GPT-6.1 Sol; regression tests with Codex GPT-6 Astra; reviewed with Claude Opus 5.5 and Codex GPT-6 Sol through T3 Code.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
Approvability#
Verdict: Approved at
97533beMacroscope's review found this PR approvable — This is a focused server-browser bug fix that decouples viewer input from stalled navigations while retaining navigation draining during control handoff. The production change is small, isolated, and covered by targeted regression tests.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
c50e03b6-dd97-4c8e-8ac0-23eccd547566
📥 Commits
-
Reviewing files that changed from the base of the PR and between bfec2387b8102975c84690f99be0f5f834fd0cbe and a2b8540419591ba51ecc05d051136cd9d40590e0.
📒 Files selected for processing (3)
-
apps/server/src/preview/ServerBrowser.test.tsapps/server/src/preview/ServerBrowser.tsapps/server/src/preview/SessionControl.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
📝 Walkthrough
-
Viewer navigation, history, and soft reload now track navigation promises without awaiting commit. SessionControl keeps this work separate from pending work and waits for handoff work before calling afterDrain. Tests cover follow-up navigation and text input while the initial navigation remains pending.
Changes: Viewer Navigation
Layer / File(s) Summary Track navigation until handoff
apps/server/src/preview/SessionControl.tsSessionControl adds a separate settled-work chain for handoff tracking. releasewaits for that chain before callingafterDrain.Wire viewer navigation to handoff tracking
apps/server/src/preview/ServerBrowser.ts,apps/server/src/preview/ServerBrowser.test.tsViewer navigation, history, and soft reload pass navigation promises to trackUntilHandoff. Tests check that follow-up navigation and text input run while the initial navigation remains pending.Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~15 minutes
Change: Bug fix · Severity of issue fixed: Low
Suggested reviewers:
maria-rcks
Merge Risk: ⚪ Minimal · up to
a2b85-
Later viewer input can proceed while navigation is pending, and session release still waits for that navigation. No actionable merge-blocking risk was identified.
Security architecture risk: 🔵 Low · up to
a2b85-
Ownership checks and navigation handoff ordering remain intact, and no new authorization bypass was identified. Risk is limited, but interruption and shutdown behavior has not been validated against a real browser in this review.
Retained concerns No architecture-level concerns identified.
Security review details
-
Security Blast Radius
- inferred — The changed control path affects navigation and input timing on the selected browser tab. Its inspected authorization scope remains the controlling viewer and assigned agent; the new handoff method does not itself grant additional tab or service authority.
Security Findings and Attack Paths
- inferred — A controlling viewer can now send further navigation or input before an earlier navigation settles. This newly permitted overlap does not establish a cross-owner attack path: capability checks, owner checks, and the queued release barrier remain enforced.
Trust Boundaries and Controls
- observed — Viewer identities are generated server-side. Raw viewer messages reach navigation through the capability-gated input closure and human-owner check; strings supplied as addresses retain HTTP/HTTPS normalization. The upstream source of the operation capability was not assessed.
Resilience and Maintainability Implications
- observed — Disconnect awaits owner-checked release before removing the viewer, and release cleanup clears pressed input state. Close marks the control closed without independently awaiting the handoff chain; terminal tab removal also removes the tab and closes its page or connection. This differs from transferring ownership to a live tab.
-
Pre-merge checks:
5-
Check name Status Explanation Linked Issues check Issue [ #16641] requires later viewer input to proceed while a slow server-browser navigation is pending. The PR starts viewer goto, history, and soft reload without holding the serialized input queue.…Out of Scope Changes check The reported changes are limited to viewer navigation handling, SessionControlhandoff tracking, and focused tests. Each change supports issue [#16641] by allowing later input during a pending navig…Approvability The diff changes only ServerBrowser.ts,SessionControl.ts, andServerBrowser.test.ts. It implements a focused fix for viewer navigation that blocks later input and adds regression coverage. It d…Title check The title clearly and concisely describes the primary fix: keeping browser input responsive during slow navigation. Description check The description explains the problem, implementation, linked issue, verification results, limitations, screenshots, recordings, and agent usage. It is mostly complete, although it does not include an … Full details: Linked Issues check
-
Explanation
Issue [
#16641] requires later viewer input to proceed while a slow server-browser navigation is pending. The PR starts viewer goto, history, and soft reload without holding the serialized input queue.SessionControl.trackUntilHandofflets later input run while keeping release and disconnect behind navigation completion. New tests cover pending goto, goBack, goForward, and reload followed by corrected navigation and text input. This meets the linked coding requirement.
Full details: Out of Scope Changes check
-
Explanation
The reported changes are limited to viewer navigation handling,
SessionControlhandoff tracking, and focused tests. Each change supports issue [#16641] by allowing later input during a pending navigation while preserving control handoff behavior. No unrelated changes are identified.
Full details: Approvability
-
Explanation
The diff changes only
ServerBrowser.ts,SessionControl.ts, andServerBrowser.test.ts. It implements a focused fix for viewer navigation that blocks later input and adds regression coverage. It does not change a product default, suppress static-analysis diagnostics, add a subsystem or user workflow, alter contracts or persisted data, change authentication or external side effects, modify dependencies, or change CI, release, contributor, agent, or review configuration.
Full details: Description check
-
Explanation
The description explains the problem, implementation, linked issue, verification results, limitations, screenshots, recordings, and agent usage. It is mostly complete, although it does not include an explicit maintainer approval comment for scope.
-
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
coderabbitai[bot](GitHub profile, opens in a new tab) approved these changes
juliusmarminge added labelsmacroscope-review
juliusmarminge assignedjuliusmarminge
Taking over this one. I'll keep your commits and push the maintainer rebuild on top of this branch.
juliusmarminge changed the title
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
juliusmarminge merged thisa946feb
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed