Skip to content

fix(browser): Server (streamed) pages ask for permissions, sign-in and opening apps on the desktop - #47150

Merged
AmoabaKelvin merged 1 commit into
mainfrom
fix/streamed-page-prompts
Nov 22, 2026
Merged

AmoabaKelvin merged 1 commit into
mainfrom
fix/streamed-page-prompts

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

When a page in a Server (streamed) browser tab asked for your location, camera or a password, or tried to open your mail app, nothing happened: the request was quietly refused. Now the same Allow/Block, Sign in and "Open this link?" prompts you get on local pages show up on your desktop, and your answer goes back to the server.

Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​43 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​43
Prod 28 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​413 $\color{#cf222e}{\Huge{\mathbf{−}}}$​46 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​367

What Changed

Before: a Server (streamed) page lives in an offscreen guest on the paired server. resolvePagePromptTarget found no window for it, so openBrowserPagePrompt returned no-window. Site permissions were denied, an HTTP basic-auth 401 stood, and mailto:/zoommtg: links were dropped, all without a word.

After:

  • The paired devices streaming a page become its prompt target (stream-viewers). A viewer opts in with pagePrompts: 1 on browser.screencast. Only a subscriber with a pairedDeviceId counts, so its answer can be checked.
  • The prompt goes out as a pagePrompt screencast event carrying the same request the local window gets. pagePromptClosed follows when it's answered, times out, or the page navigates. Prompts that are still open are replayed to a viewer that joins later, so a stream restart doesn't lose them.
  • The desktop asks with the local prompt handlers (askBrowserPagePrompt, the same dialogs as local pages). It answers with a new browser.pagePromptAnswer {requestId, answer} RPC.
  • The server takes an answer only from a paired device that is streaming the page that asked. It then settles the prompt through the same code as a local answer: grants are remembered per site, the page goes quiet after a decline, and other viewers close their copy.
  • Open-app links never launch anything on the server. The desktop opens the link itself, through a new IPC that reuses the local scheme deny list. Streamed pages get no "Always allow", because a remembered answer on the server would launch apps there.
  • JavaScript dialogs still use their existing dialog event. On the desktop, the stream's RemoteBrowserPagePrompts now owns that dialog too, so one object holds what a stream is asking.

Why

This reuses the local prompt owner (openBrowserPagePrompt) and the local prompt UI. Neither gets a remote-only copy. The JS dialog relay (#41960) already sends dialogs as screencast events and takes answers by RPC, so the new prompts follow the same pattern.

Answers are matched by request id plus the streaming device, like browser.screencast.ack. An agent on the server, or another paired device, can't grant a site the camera on your behalf. The page sits on the server, but you are at the desktop, so the desktop opens app links.

Considered and rejected: launching the app on the server. A headless server has nothing to launch, and a Mac server would open Mail on the wrong screen.

Linked Issue

No issue. This is gap M6 from the remote browser parity audit. Downloads (M21) and the phone (M44) follow in separate PRs.

Visual Proof

Paired setup: a hidden dev desktop paired to a worktree-built orca serve, with the page in a Server (streamed) tab.

Before: the page asks for its location. No prompt appears and the page gets "denied".
before-location.png

After: location prompt. Allow makes navigator.permissions report granted on the server.
after-location.png

After: a mailto: link. "Open link" opened it on the desktop. A stubbed shell.openExternal recorded mailto:[email protected] on the client and nothing on the server.
after-mailto.png

After: HTTP basic auth. Signing in loads the protected page ("Signed in").
after-sign-in.png

Testing

  • Real paired run on macOS (Playwright, hidden Electron client paired to a headless orca serve built from this branch, ORCA_BACKGROUND_LAUNCH=1). On main, the location request ended "denied", the mailto: link did nothing and the 401 stood, all with no prompt. With this branch, the location prompt appeared and Allow left the permission granted. The mailto: prompt appeared, and Open launched the link on the client only. The sign-in prompt appeared, and the credentials loaded the page.

  • browser-page-prompts-streamed.test.ts covers the security boundary. A device streaming another page, or a caller with no paired device, can't answer a streamed prompt. The streaming device can answer once. The test fails if the device check is removed (checked).

  • remote-browser-stream-lifecycle.test.ts passes. pnpm check:changed passes.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

Performance

None, because work happens only when a page asks for something. Each opted-in viewer adds one Set entry per stream and one event per prompt.

Risk

Mixed versions:

  • An older desktop never sends pagePrompts: 1, so a new server keeps refusing as before.
  • An older server strips the param and sends no events, so a new desktop sees what it saw before.
  • Phones don't opt in yet, so they see no change.
  • Headless agent tabs with nobody streaming them still get no-window, as before.

Riskiest part: local prompts now share answerPending with the streamed path. Local behaviour (renderer id check, quieting, settles) is unchanged and was exercised by the paired run's desktop prompts.

Known gap: a prompt raised before the first stream subscribes, such as a brand-new Server tab whose first load is a 401, is still refused. Reloading once the tab is showing asks as expected.

Backing out is a plain revert.

Level: Medium

AI Disclosure

Review

One review-loop round (Codex + Claude): no P0/P1. P2 left as a known gap (above): prompts raised before the first stream subscribes. P3s not taken: a guard for prompt kinds a future server might add (a new kind would need its own opt-in), and moving the viewer release out of the frame-retry cancel helper.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Security: answers are bound to the request id and the streaming paired device. Links opened on the desktop go through the same scheme deny list as local pages.
  • Cross-platform: no platform branches. Linux keeps appName null, as before.
  • SSH: not involved. Mobile: no change until the phone PR opts in.
  • orcad's Electron provider doesn't proxy screencast, so it's unchanged.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Files ignored due to path filters: 1

  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 09d105f6-2e4b-4976-93ba-b753af8e013a
Commits

Reviewing files that changed from the base of the PR and between 92168ee and 9214f2a.

Files ignored due to path filters: 1

  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
Walkthrough

The change adds streamed page-prompt support to browser screencasts. Guests direct supported prompts to registered viewers, and the host checks paired-device authorization before accepting answers. The remote browser handles prompt events and closure, submits answers through RPC, and can open external-app links on the viewer’s computer.

Merge Risk: Low · previous review 92168

Streamed page prompts for permissions, sign-in and app links are opt-in and have sound authorization. Two edge cases can leave a user without feedback: an external-app answer that fails to reach the server, and a prompt left on screen after a failed subscription. Both are small, localized fixes worth making before merge but unlikely to cause broad impact.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: streamed (Server) browser pages can now show desktop prompts for permissions, sign-in, and opening apps. The changeset matches this: prompt routing to paired viewers, …
Description check Passed The description follows the repository template closely. It has ELI5, What Changed, Why, Visual Proof with before and after images, Testing with checked boxes, Performance, Risk with a level, Review, …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: streamed (Server) browser pages can now show desktop prompts for permissions, sign-in, and opening apps. The changeset matches this: prompt routing to paired viewers, a new pagePromptAnswer RPC, and external-app link opening on the desktop. The title uses the fix() prefix and a clear subject, and it is somewhat long at 98 characters.

Full details: Description check

Explanation

The description follows the repository template closely. It has ELI5, What Changed, Why, Visual Proof with before and after images, Testing with checked boxes, Performance, Risk with a level, Review, Notes, and Checklist. It also covers the security boundary, mixed-version behaviour, and a known gap. The Linked Issue section says 'No issue', which the template requires for outside contributors, but the author is a maintainer tracking a parity audit gap, so the special case may apply. The AI Disclosure section is empty, which the template allows for internal contributors.

Finishing Touches

Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Minor · Close replayed prompts when the screencast… · remote-browser-screencast-subscription.ts:77

src/renderer/src/components/browser-pane/stream-remote/remote-browser-screencast-subscription.ts:77
Minor · Stability & Availability · Quick win

Close replayed prompts when the screencast subscription rejects.

subscribe can forward a pagePrompt to the renderer before its promise settles. The document layer forwards responses during its post-subscribe checks. If assertSubscriptionPairingCurrent then throws, the renderer receives a rejection and no onClose. The prompt stays on screen with no stream that can answer it. Close the page prompts in the rejection path before rethrowing.

Suggested fix

-  )
+  ).catch((error: unknown) => {
+    events.pagePrompts.closeAll()
+    throw error
+  })
   return {
Nitpick comments: 1

src/renderer/src/components/browser-pane/stream-remote/remote-browser-stream-lifecycle-test-harness.ts: 1

216-218: Trivial · Maintainability & Code Quality · Quick win

Add controllable page prompts to the lifecycle harness.

Record each request, signal and answer resolver, as dialogAsks already does for JavaScript dialogs. Add pagePrompt and pagePromptClosed emitters to FakeScreencastStream.

The current stub cannot exercise prompt answers or assert cancellation during close, resize and reconnect. These controls would let lifecycle tests check that an old stream cannot leave an active prompt.

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0aa3ce6b-b0ec-450c-b458-a648e05a967c
Commits

Reviewing files that changed from the base of the PR and between ea5310f and 92168ee.

Files ignored due to path filters: 1

  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
Files selected for processing: 28

  • src/main/browser/guest-lifecycle/manager/browser-manager-state.ts
  • src/main/browser/guest-lifecycle/prompts/browser-external-app-launch.ts
  • src/main/browser/guest-lifecycle/prompts/browser-page-prompt-viewers.ts
  • src/main/browser/guest-lifecycle/prompts/browser-page-prompts-streamed.test.ts
  • src/main/browser/guest-lifecycle/prompts/browser-page-prompts.ts
  • src/main/ipc/browser/browser.ts
  • src/main/runtime/browser/screencast/browser-screencast-contracts.ts
  • src/main/runtime/browser/screencast/browser-screencast-page-prompts.ts
  • src/main/runtime/browser/screencast/browser-screencast-subscriber-frame-delivery.ts
  • src/main/runtime/browser/screencast/browser-screencast-subscriber-test-harness.ts
  • src/main/runtime/browser/screencast/browser-screencasts.ts
  • src/main/runtime/browser/screencast/runtime-browser-screencast-controller.ts
  • src/main/runtime/rpc/methods/browser/browser-screencast.ts
  • src/preload/api/browser/browser-api.ts
  • src/preload/api/browser/browser-bridge-guest-registration-and-downloads.ts
  • src/renderer/src/components/browser-pane/page-prompts/browser-page-prompts.tsx
  • src/renderer/src/components/browser-pane/stream-remote/remote-browser-page-prompt-asks.ts
  • src/renderer/src/components/browser-pane/stream-remote/remote-browser-page-prompts.ts
  • src/renderer/src/components/browser-pane/stream-remote/remote-browser-screencast-subscription.ts
  • src/renderer/src/components/browser-pane/stream-remote/remote-browser-stream-lifecycle-deps.ts
  • src/renderer/src/components/browser-pane/stream-remote/remote-browser-stream-lifecycle-test-harness.ts
  • src/renderer/src/components/browser-pane/stream-remote/remote-browser-stream-lifecycle.ts
  • src/renderer/src/components/browser-pane/stream-remote/use-remote-browser-page-lifecycle.ts
  • src/shared/browser/prompts/browser-external-app.ts
  • src/shared/browser/prompts/browser-page-prompt.ts
  • src/shared/browser/runtime/runtime-browser-contracts.ts
  • src/shared/rpc-contract/browser/browser-params.ts
  • src/shared/rpc-contract/browser/browser-screencast-params.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

}
// Answered: the host's own close for it must not cancel the answer on its way.
this.open.delete(request.requestId)
void this.answerOnHost(page, request, answer).catch(() => {})

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.

Minor · Functional Correctness · Quick win

Report failed external-app answer RPCs.

If the user selects “Open link” and browser.pagePromptAnswer rejects, the desktop does not open the link. This empty catch also suppresses failure feedback.

For an affirmative external-app answer, report the failure instead of discarding it. Preserve the current behavior for declines and successful launches. Do not automatically retry an answer that the server might have consumed.

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