Skip to content

fix(updater): stop release HEAD probes from crashing main behind an authenticating proxy - #48556

Merged
nwparker merged 1 commit into
mainfrom
bugbash/issue-47027
Nov 24, 2026
Merged

nwparker merged 1 commit into
mainfrom
bugbash/issue-47027

Conversation

@nwparker

@nwparker nwparker commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When Orca starts it quietly asks GitHub whether a newer release exists. On networks whose proxy asks for a password (a 407 reply), Electron reported that reply and then threw a second error on it. Nothing in Orca was listening for that second error, so the whole app quit about a second after launch. Now Orca reads the status and closes the request right away, so the late error never arrives and the app keeps running.

Files Added Deleted Net
Test 0 0 0 0
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​25 $\color{#cf222e}{\Huge{\mathbf{−}}}$​34 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9

What Changed

  • Before: behind a proxy that answers CONNECT with 407 Proxy Authentication Required, the startup update check crashed the main process with an uncaught net::ERR_TUNNEL_CONNECTION_FAILED, and Orca exited shortly after the window appeared.
  • After: the update check logs nothing scary. It treats the release as unavailable and the app stays open. Update checks with a direct connection or a working proxy behave as before.

How it works: with a 407, Electron first emits a response and then destroys that response with net::ERR_TUNNEL_CONNECTION_FAILED. Two probes in src/main/updater/releases/ left that response unread and with no error listener:

  1. requestGitHubReleaseHead (the stable-release HEAD) settled on the response but never released it.
  2. The release-asset readiness probe for non-GitHub asset URLs used net.fetch HEAD, which leaves its response the same way.

Both now go through a single net.request helper, requestReleaseHead(url, redirect). It calls request.abort() as soon as it has the status code. GitHub release assets keep redirect: 'manual', because the redirect proves the asset exists without fetching the signed storage URL. Other asset URLs use redirect: 'follow', which matches the old net.fetch behaviour. The readiness mapping is now shared: 404 means not-ready, 2xx or a manual 3xx means ready, and anything else means unavailable.

Why

The crash comes from an error event on a response object that our code never subscribes to. The cleanest fix is to stop holding that response at all once we have its status. A HEAD probe has no body we need. We rejected two alternatives:

  • A global uncaughtException swallow would hide real bugs.
  • Adding an error listener to net.fetch's response is not possible, because that response is internal.

Handling the app login event for proxy credentials, as the issue suggests, would be a separate feature. This PR only stops the crash.

Linked Issue

Fixes #47027

Visual Proof

N/A: there is no UI change. The bug is a main-process crash with no visible state besides the app quitting. Behavioural evidence from a real Electron run is in Testing below.

Testing

Repro and verification were done on macOS (remote M-series Mac, Electron 43.8.10). A harness loaded the old and new updater-release-readiness / updater-prerelease-feed modules into a background Electron main process. A local proxy answered CONNECT with 407, or acted as a MITM for the GitHub host while returning 407 for the redirect target:

Scenario Old New
Startup checks behind a 407 proxy (atom feed, stable HEAD, fetchLatestStableReleaseTag, manifest readiness) 2 uncaught ERR_TUNNEL_CONNECTION_FAILED, exit=1 0 uncaught, exit=0, results null / unavailable
macOS asset readiness via MITM: ok / missing / redirect-to-407 host / absolute asset on 407 host ready / not-ready / unavailable + uncaught / unavailable + uncaught ready / not-ready / unavailable / unavailable, 0 uncaught
Windows asset readiness via MITM, same cases 1 uncaught 0 uncaught, same readiness results
Direct connection to github.com 302 to v1.4.274, manifest ready identical

A control run confirmed that raw net.fetch HEAD still throws the uncaught error behind a 407 proxy. That is why the asset probe no longer uses it.

Local checks: vitest run src/main/updater passed. One unrelated serve-update-handoff test timed out under load and passed when run alone. The other local checks were oxlint, oxfmt, the anti-slop and code-quality native plugins, ast-grep and the changed-code quality gate.

  • 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

No unit test was added. The failure only shows up in Electron's real network stack, where the loader emits an error after the response, so a mocked net would only assert our own stub. The Electron harness above covers it.

Performance

None. This runs only during the background update check at startup and on its normal schedule, not on a hot path. The number of requests is unchanged and there is no new sync I/O. Aborting after the status arrives releases each request earlier. Measured over a direct connection on the same Mac: stable HEAD took 92/26/28 ms new vs 210/27/23 ms old, and manifest readiness took 128/74/77 ms new vs 143/64/67 ms old, which is within network noise.

Risk

The riskiest part is that non-GitHub asset URLs moved from net.fetch to net.request with redirect: 'follow'. If a CDN behaved differently under that request, readiness could come back unavailable. That would only defer an update offer, and it cannot crash the app. A plain revert backs this out.

Level: Low

Review

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

Cross-platform: the change uses only Electron net and is the same on macOS, Windows and Linux. The Windows asset path was exercised in the harness. There is no SSH, remote or mobile impact.

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)

Reported by @Mahmoud-Shereif

…uthenticating proxy

Behind a proxy that answers CONNECT with 407, Electron delivers the 407 as a
response and then destroys it with net::ERR_TUNNEL_CONNECTION_FAILED. The
stable-release HEAD probe settled on that response without reading it or
listening for its errors, and the asset probes used net.fetch HEAD, which
leaves its response the same way, so the startup update check quit the app.

Route every release HEAD through one net.request helper (requestReleaseHead)
that aborts the request once the status is known, using manual redirects for
GitHub release assets and followed redirects for other asset URLs.

Fixes #47027

Co-authored-by: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Release asset readiness checks now use a shared HEAD request helper with manual redirects for GitHub release assets and followed redirects for other assets. The helper records responses and aborts the request after a response. Readiness results distinguish missing responses, 404 responses, redirect responses, and direct responses. The prerelease feed uses the shared helper for its latest-release redirect request.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 182e3

This change stops startup update checks from crashing the app when a proxy answers with a 407 response. No merge-blocking risk remains in the reviewed code.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix and its scope: the updater stops release HEAD probes from crashing the main process behind an authenticating proxy. The raw summary and objectives confirm the change routes the…
Description check Passed The description covers the template sections: ELI5, What Changed, Why, Linked Issue (Fixes #47027), Visual Proof (N/A with reason), Testing, Performance, Risk with level, and Checklist. It explains th…
Linked Issues check Passed Issue #47027 requires that a failed main-process network request does not quit the app at startup, with proxy-auth handling and direct-connection fallback described as ideal only. The reported crash p…
Out of Scope Changes check Passed All changes are in src/main/updater/releases/. updater-release-readiness.ts replaces requestGitHubReleaseHead with requestReleaseHead(url, redirect), removes the separate GitHub readiness help…
Full details: Title check

Explanation

The title names the fix and its scope: the updater stops release HEAD probes from crashing the main process behind an authenticating proxy. The raw summary and objectives confirm the change routes these probes through requestReleaseHead and aborts after the status arrives, so the title matches the main change. It is somewhat long at 88 characters, but it is specific and accurate.

Full details: Description check

Explanation

The description covers the template sections: ELI5, What Changed, Why, Linked Issue (Fixes #47027), Visual Proof (N/A with reason), Testing, Performance, Risk with level, and Checklist. It explains the before and after behaviour, the mechanism, and the rejected alternatives. Some template items remain unchecked: the test anti-pattern checkbox, and the pnpm lint/typecheck/test/build checklist item. The AI Disclosure section is left empty, which the template allows for internal contributors. The description is mostly complete, so it passes.

Full details: Linked Issues check

Explanation

Issue #47027 requires that a failed main-process network request does not quit the app at startup, with proxy-auth handling and direct-connection fallback described as ideal only. The reported crash path is the startup updater check. At head, requestReleaseHead in src/main/updater/releases/updater-release-readiness.ts calls request.abort() in the response handler after settle, which releases the 407 response before its later ERR_TUNNEL_CONNECTION_FAILED error. The stable-release HEAD probe (updater-prerelease-feed.ts) and the non-GitHub asset probe (previously net.fetch) now both use this helper, so the probes the PR identifies no longer leave an unhandled response. The PR's Electron harness results are author-reported and were not re-run here. Limitation: the issue's general wording ('a failed main-process network request (updater, telemetry, etc.)') is broader than the updater probes this PR covers. Telemetry or other main-process callers were not inspected. The issue reporter could not identify the failing URL, so the updater cause is the best-supported link.

Full details: Out of Scope Changes check

Explanation

All changes are in src/main/updater/releases/. updater-release-readiness.ts replaces requestGitHubReleaseHead with requestReleaseHead(url, redirect), removes the separate GitHub readiness helper and the net.fetch path, and unifies the readiness mapping. updater-prerelease-feed.ts changes only the import and call to the renamed helper. The GitHub asset path keeps redirect: 'manual', and other assets use 'follow', which the PR describes as matching prior net.fetch behaviour. No unrelated files are changed in the reviewed summary. No tests were added, which is a stated author choice and not an out-of-scope change.

  • 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

Recent 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: 5519731e-e016-467b-b5e3-af6612dbee48
Commits

Reviewing files that changed from the base of the PR and between 9dad101 and 182e36c.

Files selected for processing: 2

  • src/main/updater/releases/updater-prerelease-feed.ts
  • src/main/updater/releases/updater-release-readiness.ts

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

@nwparker
nwparker merged commit bbfbcc3 into main Nov 24, 2026
54 checks passed
@nwparker
nwparker deleted the bugbash/issue-47027 branch November 24, 2026 23:12
Jinwoo-H pushed a commit that referenced this pull request Nov 24, 2026
…uthenticating proxy (#48556)

Behind a proxy that answers CONNECT with 407, Electron delivers the 407 as a
response and then destroys it with net::ERR_TUNNEL_CONNECTION_FAILED. The
stable-release HEAD probe settled on that response without reading it or
listening for its errors, and the asset probes used net.fetch HEAD, which
leaves its response the same way, so the startup update check quit the app.

Route every release HEAD through one net.request helper (requestReleaseHead)
that aborts the request once the status is known, using manual redirects for
GitHub release assets and followed redirects for other asset URLs.

Fixes #47027

Co-authored-by: Claude <[email protected]>
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.

[Bug]: macOS: app quits ~1s after launch when the system proxy answers 407 (uncaught ERR_TUNNEL_CONNECTION_FAILED)

1 participant