Skip to content

fix(browser): stop failing goto when a redirect or download aborts the load - #9822

Merged
brennanb2025 merged 3 commits into
mainfrom
brennanb2025/fix-goto-err-aborted
Jul 22, 2026
Merged

brennanb2025 merged 3 commits into
mainfrom
brennanb2025/fix-goto-err-aborted

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

What

Embedded-browser goto no longer reports a spurious failure when Electron loadURL rejects with ERR_ABORTED (-3) for a superseded or download-triggered load.

The abort path now distinguishes three outcomes:

  • If another navigation is already loading, wait for it to stop and return its actual URL/title.
  • If no replacement is loading, return the still-usable current page (the download-triggered case).
  • If the page vetoed unload, the replacement failed, or the bounded wait timed out, fail closed.

Every non-abort loadURL error remains unchanged.

Why

#9633 moved embedded goto from the daemon helper to direct WebContents.loadURL. Electron rejects with ERR_ABORTED when that load is superseded, even though the browser can continue to a usable replacement page. Surfacing that rejection directly caused successful SSO/login flows to report Failed to navigate browser page ...: ERR_ABORTED (-3).

Testing against the pinned Electron 43.1.0 runtime also showed why a bare catch-and-ignore is unsafe:

  • the rejected promise can settle before the replacement navigation lands, so immediately reading getURL() returns the old page;
  • a page that blocks navigation in beforeunload also produces ERR_ABORTED, but the requested navigation did not happen.

The bridge therefore waits only when an aborted load has an in-flight replacement, uses did-stop-loading rather than polling, keeps the existing 30-second total budget, cleans up its timer/listeners on success, timeout, and destruction, and re-checks BrowserManager load state before reporting success.

Tests

Added coverage for:

  • superseding navigation abort → waits and returns the landed URL/title;
  • download-triggered abort → returns the unchanged usable page;
  • beforeunload veto → fails closed;
  • failed replacement navigation → fails closed;
  • replacement that never settles → times out, removes listeners/timer, and releases the command queue;
  • ordinary non-abort navigation failure → still fails closed.

Verification:

  • agent-browser-bridge.test.ts: 103/103
  • related browser-manager/offscreen/runtime RPC suites: 83/83
  • all TypeScript projects
  • repository-wide oxlint (0 errors)
  • oxfmt and git diff --check
  • max-lines ratchet

A full local suite under unsupported Node 26 completed 33,665 passing tests; its unrelated failures were Node-24/environment-sensitive localStorage, inherited Git environment, and timeout tests. PR CI runs the supported Node version.

…e load

Electron's loadURL rejects with ERR_ABORTED (-3) when the initial
navigation is superseded — a client-side/meta redirect (common in SSO
flows) or a download-triggered load. Since #9633 drives goto through
wc.loadURL directly, that rejection surfaced as a spurious
'Failed to navigate' browser_error even though the page landed fine.

Treat ERR_ABORTED like offscreen-browser-backend already does: resolve
with the page's actual URL/title. Every other loadURL failure still
fails closed.
@coderabbitai

coderabbitai Bot commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@brennanb2025, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 7 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 73db99b1-9dc3-41a8-a250-5f48800d2222

📥 Commits

Reviewing files that changed from the base of the PR and between 0588489 and 5030936.

📒 Files selected for processing (2)
  • src/main/browser/agent-browser-bridge.test.ts
  • src/main/browser/agent-browser-bridge.ts
📝 Walkthrough

Walkthrough

AgentBrowserBridge.goto() now recognizes ERR_ABORTED and errno -3 navigation errors as non-fatal when the target page remains available. It continues to return the resulting URL and title without invoking agent-browser. Other navigation errors still produce browser_error failures. Tests cover client-side redirects, download-triggered aborts, and ERR_NAME_NOT_RESOLVED failures.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the change and tests, but it omits several required template sections like Screenshots, AI Review Report, Security Audit, and Notes. Reformat the PR text to match the template and add the missing Screenshots, Testing checklist, AI Review Report, Security Audit, and Notes sections.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title clearly and concisely summarizes the main change: treating aborted goto navigations as non-fatal for redirects/downloads.

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

Comment @coderabbitai help to get the list of available commands.

@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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 994c30f8-00e5-404f-8ebd-3acb3664078b

📥 Commits

Reviewing files that changed from the base of the PR and between 44f77a3 and 0588489.

📒 Files selected for processing (2)
  • src/main/browser/agent-browser-bridge.test.ts
  • src/main/browser/agent-browser-bridge.ts

@brennanb2025
brennanb2025 merged commit b81e782 into main Jul 22, 2026
1 check passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…e load (stablyai#9822)

* fix(browser): stop failing goto when a redirect or download aborts the load

Electron's loadURL rejects with ERR_ABORTED (-3) when the initial
navigation is superseded — a client-side/meta redirect (common in SSO
flows) or a download-triggered load. Since stablyai#9633 drives goto through
wc.loadURL directly, that rejection surfaced as a spurious
'Failed to navigate' browser_error even though the page landed fine.

Treat ERR_ABORTED like offscreen-browser-backend already does: resolve
with the page's actual URL/title. Every other loadURL failure still
fails closed.

* fix(browser): settle replacement navigation after abort

* fix(browser): clean up aborted navigation destruction race
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