Skip to content

fix(desktop): let get-windows staging degrade on all win32 arches when binding is missing - #89646

Closed
Vegvisirz wants to merge 1 commit into
NousResearch:mainfrom
Vegvisirz:fix/get-windows-staging-degrade
Closed

fix(desktop): let get-windows staging degrade on all win32 arches when binding is missing#89646
Vegvisirz wants to merge 1 commit into
NousResearch:mainfrom
Vegvisirz:fix/get-windows-staging-degrade

Conversation

@Vegvisirz

Copy link
Copy Markdown

Problem

stage-native-deps.mjs has two throw points for get-windows on win32-x64 that contradict the runtime layer's fail-soft design:

  1. stageGetWindows() line 574: canDegrade only allows linux and win32-arm64. A missing package on win32-x64 throws instead of degrading.
  2. stageGetWindowsInto() line 517: A missing binding on non-arm64 throws.

Both contradict:

  • window-below.ts:133: import('get-windows').catch(() => null) — fail-soft on every platform
  • STAGED_WINDOWS_JS (line 366-407): getAddon() returns no-op stubs (getActiveWindow() {} / getOpenWindows() {}) when no binding is present
  • readWindowBelow(): returns enumerationFailureNote() when enumeration returns null

The runtime is designed to degrade gracefully. The staging throws are inconsistent with this design and force npm ci to successfully install get-windows — but its node-pre-gyp install script can fail on any Windows host (no prebuilt for the exact Electron ABI, allowScripts blocking, etc.), making the Desktop GUI build fail on a clean install.

Fix

  1. Widen canDegrade from platform === 'linux' || (platform === 'win32' && arch === 'arm64') to platform === 'linux' || platform === 'win32' — all win32 arches can degrade when the package is missing.
  2. Change the binding-missing throw (line 517-523) to a console.warn + degrade — same fail-soft behavior as arm64 already has.

macOS stays fail-closed (Swift helper binary is mandatory and cannot be stubbed).

Verification

On a Windows x64 host where npm ci skips get-windows (e.g. allowScripts blocking):

cd apps/desktop
npm ci
node scripts/stage-native-deps.mjs win32 x64
# Before: throws "[stage-native-deps] get-windows has no win32-x64 prebuilt binding..."
# After:  warns  "[stage-native-deps] get-windows has no win32-x64 prebuilt binding; staging the fail-soft JS surface..."
# dist/node_modules/get-windows/lib/windows.js exists, getAddon() returns no-op stubs
npm run pack  # succeeds

…n binding is missing

stage-native-deps.mjs had two throw points for get-windows on win32-x64:
1. stageGetWindows() line 574: canDegrade only allowed linux + win32-arm64,
   so a missing package on win32-x64 threw instead of degrading.
2. stageGetWindowsInto() line 517: a missing binding on non-arm64 threw.

Both contradict the runtime layer (window-below.ts:133), which already
fail-softs import('get-windows').catch(() => null) on every platform, and
the STAGED_WINDOWS_JS stub, whose getAddon() returns no-op objects when no
binding is present. The throws forced npm ci to install get-windows
successfully — but its node-pre-gyp install script can fail on any Windows
host (no prebuilt for the exact Electron ABI, allowScripts blocking, etc.),
making the Desktop GUI build fail on a clean install.

Fix: widen canDegrade to all win32 (linux || win32), and change the
binding-missing throw to a warn + degrade. macOS stays fail-closed
(Swift helper binary is mandatory). This aligns staging with the runtime
layer's existing fail-soft design.
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/desktop Electron desktop app (apps/desktop/*) platform/windows Native Windows-specific behavior or breakage area/install-update Installer, updater, packaging, wheels, doctor sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows labels Aug 19, 2026
@OutThisLife

Copy link
Copy Markdown
Collaborator

Closing — win32-x64 staging is fail-closed on purpose so a missing get-windows binding cannot ship silently (see canDegrade in stage-native-deps.mjs).

The recovery for that throw is #88233: run the package's node-pre-gyp installer, then fail if the Windows binding is still missing. Degrading all win32 arches would skip that fetch and disable window enumeration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/install-update Installer, updater, packaging, wheels, doctor comp/desktop Electron desktop app (apps/desktop/*) P2 Medium — degraded but workaround exists platform/windows Native Windows-specific behavior or breakage sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants