Skip to content

fix(desktop-browser): ask the user before a page's alert, confirm, or leave-site prompt is answered - #8432

Merged
waleedlatif1 merged 4 commits into
stagingfrom
fix/browser-page-dialogs
Oct 9, 2026
Merged

waleedlatif1 merged 4 commits into
stagingfrom
fix/browser-page-dialogs

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Let users answer alerts and confirmations on their visible browser page through a single native Electron dialog. Preserve the complete website message and restore keyboard focus after dismissal.
  • Prevent automation and Stop from answering a dialog owned by the user. Agent actions, unclaimed tabs, hidden pages, and older renderers retain their existing automatic behavior.
  • Ask before browser-chrome navigation discards a draft. Stay is the default, Escape keeps the draft, and Leave replays the navigation once. Clear stale decisions after navigation or a renderer crash.
  • Keep the renderer modal limited to the leave-page decision, using the existing shared modal and browser focus lifecycle.

Type of Change

  • Bug fix

Testing

  • All 1,070 desktop tests, 41 browser/store tests, all workspace type checks, lint, all 58 audits, docs-manifest, and block-registry checks pass. Both full repository test shards pass in CI.
  • Real Electron coverage exercises renderer compatibility, user/agent ownership, complete dialog messages, automation cancellation, unsaved drafts, stale decisions, and hidden pages. Reports support DESKTOP_BROWSER_DIALOGS_REPORT_PATH.
  • Isolated macOS CI: 91 Electron E2E tests passed (15 environment-specific skips), including browser dialogs, keyboard focus, themed shell dialogs, and password autofill. All 12 real Sim desktop E2E cases passed, along with universal packaging and packaged smoke tests.
  • Physical macOS QA reproduced lost keyboard focus before the fix and verified typing after native alert dismissal and confirmation cancellation with the fix.
  • Electron currently resolves a CDP dialog answer without necessarily closing its native sheet. The unchanged agent/fallback path retains that upstream limitation; the new user path lets Electron own both the answer and physical dismissal.

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 Sep 29, 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 9, 2026 12:21am UTC

Request Review

@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 8 files

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

Fix all with cubic | Re-trigger cubic

Comment thread apps/desktop/src/main/browser-agent/session.ts Outdated
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge based on the reviewed changes; no outstanding finding was established.

Summary

The PR gives users control of dialogs on their visible browser page: Electron presents alerts and confirmations, while the renderer asks whether to leave a page with unsaved changes. Agent-owned and hidden-page dialogs retain automatic handling, with end-to-end coverage for ownership and navigation decisions.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Page opens dialog] --> B{Visible user-owned page?}
  B -- No --> C[Shell answers automatically]
  B -- Yes: alert or confirm --> D[Electron native dialog]
  B -- Yes: beforeunload --> E[Renderer asks Stay or Leave]
  E -- Stay --> F[Keep page]
  E -- Leave --> G[Replay navigation once]
Loading

Reviews (5) · Last reviewed commit: "fix(desktop-browser): preserve native di..." · Reviewed by Greptile

Comment thread apps/desktop/src/main/browser-agent/session.ts Outdated
Comment thread apps/desktop/e2e/browser-page-dialogs.spec.ts Outdated
Comment thread apps/desktop/src/main/browser-agent/session.ts

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

No issues found across 8 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

Comment thread apps/desktop/src/main/browser-agent/session.ts Outdated
Comment thread apps/desktop/src/main/browser-agent/session.ts Outdated
Comment thread apps/desktop/e2e/browser-page-dialogs.spec.ts Outdated
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

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

No issues found across 8 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@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 8 files

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

Fix all with cubic | Re-trigger cubic

Comment thread apps/desktop/src/main/browser-agent/session.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

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

No issues found across 9 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 51cdbe6 into staging Oct 9, 2026
52 of 53 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/browser-page-dialogs branch October 9, 2026 00:54

This branch was previously deployed

1 inactive deployment
Preview — 41040be9 Deployed Oct 9, 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