Skip to content

fix(desktop): keep sign-in popups working in the agent browser - #9506

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/desktop-browser-popups
Oct 31, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
fix/desktop-browser-popups

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • window.open('') / about:blank popups returned null in agent browser tabs, breaking blank-then-navigate sign-in and payment flows (e.g. MSAL's default popup). They are now adopted as tabs that keep window.opener, matching Electron's docs and Min; their first real navigation still passes the http-only and network guards
  • An adopted popup's session is read from the contents Chromium created, not its URL — a blank popup from a Sim page would otherwise have registered the app session as the agent partition
  • A target=_blank form POST that we would have to reissue (cross-session or background) is refused instead of silently resent as a GET with no body; reissued links keep their referrer
  • Closing a popup returns to its opener instead of the neighbouring tab, unless the user switched tabs since it opened (Chrome's ForgetAllOpeners rule)
  • mailto: links in the app window (chat links, the offline page's Contact support) open the mail client; attach=, unknown headers, and malformed addresses are refused

Type of Change

  • Bug fix

Testing

  • apps/desktop/e2e/browser-tools.spec.ts: blank popup keeps opener + postMessage round-trip + close returns to opener; opener forgotten after a manual tab switch; data: popup still denied; same-session form POST arrives as POST, cross-session POST opens nothing; Sim-origin blank popup keeps its opener
  • Red→green for each guard (blank adoption, opener activation, forget-on-switch, POST refusal, popup session)
  • navigation.test.ts + session.test.ts (90 pass), desktop tsc --noEmit, biome on changed files; full gate in CI

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Oct 31, 2026 8:13am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Keeps blank sign-in popups inside the agent browser while preserving their opener.

  • Blank sign-in popups stay connected to the page that opened them.
  • New-tab form posts keep their body or are refused.
  • Safe mail links open in the desktop mail client.

No actionable issues were found. Tests were inspected, not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Open[Page opens popup] --> Adopt{Blank or same-session HTTP URL?}
  Adopt -->|Yes| Contents[Adopt Chromium contents]
  Adopt -->|No| Post{Form POST?}
  Post -->|Yes| Deny[Refuse request]
  Post -->|No| Separate[Open checked HTTP URL in separate tab]
  Contents --> Navigate[First real navigation]
  Navigate --> Guards[Check scheme, network, and session]
  Guards -->|Same session and allowed| Load[Load page with opener]
  Guards -->|Different session, GET| Separate
  Guards -->|Unsafe or different-session POST| Deny
Loading

Reviews (1) · Last reviewed commit: "fix(desktop): keep sign-in popups workin..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 5 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/desktop/src/main/navigation.ts Resolved
- Adopt window.open('') / about:blank popups as tabs that keep window.opener (MSAL-style sign-in and payment flows got null)
- Read an adopted popup's session from its contents, not its URL
- Refuse a form POST into a new tab rather than resending it as a GET; forward the referrer on reissued links
- Closing a popup returns to its opener unless the user switched tabs since (Chrome's rule)
- mailto: links in the app window open the mail client, with attach/extra headers refused
- A background-tab popup with no Chromium-supplied contents now opens in the opener's session rather than the agent partition
- Driver tests expect the referrer options loadURL now receives
@waleedlatif1
waleedlatif1 force-pushed the fix/desktop-browser-popups branch from a40f60a to 245d363 Compare October 31, 2026 08:13
@waleedlatif1
waleedlatif1 merged commit 03b80f4 into staging Oct 31, 2026
46 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/desktop-browser-popups branch October 31, 2026 08:32

This branch was previously deployed

1 inactive deployment
Preview — 245d363f Deployed Oct 31, 2026 by vercel[bot]
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