fix: launchpad correctly refelct browser state after browser closed#34179
fix: launchpad correctly refelct browser state after browser closed#34179emilyrohrbough wants to merge 2 commits into
Conversation
Cursor Bugbot risk assessment is no longer Low Risk. Auto-approval dismissed; manual review required.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3ec6417. Configure here.
| if (ctx.isRunMode) throw err | ||
|
|
||
| return null | ||
| } |
There was a problem hiding this comment.
Delay overwrites closed browser status
High Severity
In open mode, the new onError wrapper can set browserStatus to closed and invoke onBrowserClose while browsers.open is still in its post-launch wait. The function only checks whether instance is null before calling onBrowserOpen and setting status to open, so a window closed during that window can be reported as open again.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 3ec6417. Configure here.


Additional details
Note
Low Risk
Scoped to interactive open mode browser lifecycle; run mode behavior on open failure is unchanged (still throws).
Overview
Fixes #23798 where
cypress openLaunchpad could still show the browser as open after the user closed it, blocking relaunch until an extra Close click.In
packages/server/lib/browsers/index.ts, open mode (!ctx.isRunMode) now resets app browser state when launch or runtime close paths do not always fireexit:onErroris wrapped so a non-closedstatus becomesclosedandonBrowserCloseruns (covers macOS Chrome closing the window while the process stays alive);browserLauncher.openis in try/catch so failures setclosed, invokeonBrowserClose, callclearInstanceState, and returnnullinstead of leaving an opening spinner—run mode still rethrows.cli/CHANGELOG.mddocuments the fix under 15.18.1. Unit tests inbrowsers_spec.tscover open-mode open failure, run-mode rethrow, andonErrorreset.Reviewed by Cursor Bugbot for commit 3ec6417. Bugbot is set up for automated code reviews on this repo. Configure here.
Steps to test
yarn devfrom repo root, then open a project with both E2E and component testing configured. Use Chrome and Chrome Beta — these are the browsers named in the issue.Scenario 1 — Chrome closes after fully opening (the primary bug)
Verifies: exit event path, already worked
Scenario 2 — Chrome window closed during startup (Scenario A fix)
Verifies: try/catch around browserLauncher.open()
Repeat with Chrome — it's harder to time but try closing Chrome immediately after the window opens before Cypress finishes loading.
Scenario 3 — Chrome window closed with X button / ⌘W on macOS (Scenario B fix)
Verifies: onError wrapper for the macOS "process stays alive" case
Scenario 4 — Relaunch after window-close reset (regression for the fix)
Verifies: instance survives so kill() can clean up on relaunch
Scenario 5 — Normal close via launchpad button (regression)
Verifies: existing "Close Browser" button path is unaffected
PR Tasks
cypress-documentation?type definitions?