Skip to content

The agent that grows with you

fix(desktop): bound NVIDIA EGL fallback to confirmed-broken driver series (#123213)

dskwe78999579c8a9
diff --git a/apps/desktop/electron/linux-nvidia-egl-fallback.test.ts b/apps/desktop/electron/linux-nvidia-egl-fallback.test.ts
index 0f5cbc0078f..3ddd3aee97a 100644
--- a/apps/desktop/electron/linux-nvidia-egl-fallback.test.ts
+++ b/apps/desktop/electron/linux-nvidia-egl-fallback.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest'
-import { decideNvidiaEglFallback, NVIDIA_BROKEN_EGL_MAJOR, parseNvidiaDriverMajor } from './linux-nvidia-egl-fallback'
+import { decideNvidiaEglFallback, NVIDIA_BROKEN_EGL_MAJORS, parseNvidiaDriverMajor } from './linux-nvidia-egl-fallback'
const LINUX = { env: {}, platform: 'linux' as const, isWsl: false, remoteDisplayReason: null }
@@ -23,16 +23,30 @@ describe('parseNvidiaDriverMajor', () => {
})
describe('decideNvidiaEglFallback', () => {
- it('enables on linux with driver >= 580', () => {
+ it('enables on linux with a known-broken series major (580)', () => {
const decision = decideNvidiaEglFallback({ ...LINUX, driverMajor: 580 })
expect(decision.enable).toBe(true)
expect(decision.reason).toContain('580')
})
- it('enables on newer majors (570-series is fine, 580+ is not)', () => {
+ it('stays off on series without confirmed EGL reports (#123203)', () => {
+ // 570.x is the recommended downgrade from #40077; 615.x (two driver
+ // generations later) probes fine. An open-ended >= check wrongly forced
+ // these onto CPU SwiftShader rendering.
expect(decideNvidiaEglFallback({ ...LINUX, driverMajor: 570 }).enable).toBe(false)
- expect(decideNvidiaEglFallback({ ...LINUX, driverMajor: 580 + 5 }).enable).toBe(true)
- expect(NVIDIA_BROKEN_EGL_MAJOR).toBe(580)
+ expect(decideNvidiaEglFallback({ ...LINUX, driverMajor: 590 }).enable).toBe(false)
+ expect(decideNvidiaEglFallback({ ...LINUX, driverMajor: 615 }).enable).toBe(false)
+ })
+
+ it('the known-broken set is closed, not a floor', () => {
+ // Contract: only series with confirmed #40077-style reports belong in the
+ // set; adding one is a deliberate, evidence-backed change. Detection must
+ // follow set membership exactly, so no neighbouring series rides along.
+ expect(NVIDIA_BROKEN_EGL_MAJORS.has(580)).toBe(true)
+
+ for (let major = 500; major <= 700; major++) {
+ expect(decideNvidiaEglFallback({ ...LINUX, driverMajor: major }).enable).toBe(NVIDIA_BROKEN_EGL_MAJORS.has(major))
+ }
})
it('stays off below the broken major and when detection finds no driver', () => {
diff --git a/apps/desktop/electron/linux-nvidia-egl-fallback.ts b/apps/desktop/electron/linux-nvidia-egl-fallback.ts
index 10188fc3f4a..7843b601d7d 100644
--- a/apps/desktop/electron/linux-nvidia-egl-fallback.ts
+++ b/apps/desktop/electron/linux-nvidia-egl-fallback.ts
@@ -1,7 +1,7 @@
/**
- * Linux NVIDIA 580+ EGL fallback for #40077.
+ * Linux NVIDIA 580-series EGL fallback for #40077.
*
- * NVIDIA driver 580+ breaks ANGLE's EGL probing on X11/Wayland: the bundled
+ * NVIDIA driver 580.x breaks ANGLE's EGL probing on X11/Wayland: the bundled
* ANGLE `libEGL.so` probes the driver's EGL implementation, hits the 580
* EGL/X11 bug ("Invalid visual ID requested"), and the GPU process dies —
* taking the app with it. Rendering through ANGLE's SwiftShader backend
@@ -16,7 +16,10 @@
* Skipped when a remote display already forced software rendering (the
* `--disable-gpu-compositing` path covers it), under WSLg (vGPU is healthy
* there), or when `HERMES_DESKTOP_DISABLE_GPU=0` keeps the GPU on.
- * `HERMES_DESKTOP_NVIDIA_SWIFTSHADER` overrides detection both ways.
+ * `HERMES_DESKTOP_NVIDIA_SWIFTSHADER=1` can force the fallback back on on an
+ * affected series that this closed set does not yet list (e.g. a future
+ * series that reintroduces the #40077 crash); it cannot force it on where an
+ * earlier gate already returned (remote display, WSLg, `DISABLE_GPU=0`).
*
* Pure + dependency-free so it can be unit-tested and called before app ready.
*/
@@ -24,8 +27,14 @@
const OVERRIDE_ON = new Set(['1', 'true', 'yes', 'on'])
const OVERRIDE_OFF = new Set(['0', 'false', 'no', 'off'])
-/** First driver major with the broken EGL/X11 probing (580.x and newer). */
-export const NVIDIA_BROKEN_EGL_MAJOR = 580
+/**
+ * Driver major series known to carry the broken EGL/X11 probing (#40077).
+ * Only series with confirmed reports belong here: 580.159.03 and 580.173.02
+ * are the affected reports, 570.x is the recommended downgrade, and newer
+ * series (e.g. 615.x, #123203) probe fine — an open-ended `>= 580` wrongly
+ * forced them onto CPU SwiftShader rendering.
+ */
+export const NVIDIA_BROKEN_EGL_MAJORS: ReadonlySet<number> = new Set([580])
export interface NvidiaEglFallbackDecision {
enable: boolean
@@ -94,14 +103,14 @@ export function decideNvidiaEglFallback(options: {
return { enable: false, reason: null }
}
- const detected = driverMajor !== null && driverMajor >= NVIDIA_BROKEN_EGL_MAJOR
+ const detected = driverMajor !== null && NVIDIA_BROKEN_EGL_MAJORS.has(driverMajor)
if (!detected && !OVERRIDE_ON.has(nvidiaOverride)) {
return { enable: false, reason: null }
}
const reason = detected
- ? `NVIDIA driver ${driverMajor} (>= ${NVIDIA_BROKEN_EGL_MAJOR})`
+ ? `NVIDIA driver ${driverMajor} (known-broken EGL series)`
: 'override (HERMES_DESKTOP_NVIDIA_SWIFTSHADER)'
return { enable: true, reason }
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts
index b0863bca45c..07cc3f25e0e 100644
--- a/apps/desktop/electron/main.ts
+++ b/apps/desktop/electron/main.ts
@@ -753,7 +753,7 @@ if (IS_WSL && !REMOTE_DISPLAY_REASON && fs.existsSync('/dev/dxg')) {
console.log('[hermes] WSL GPU passthrough (/dev/dxg) detected; enabling GPU acceleration')
}
-// #40077: NVIDIA driver 580+ breaks ANGLE's EGL probing (Invalid visual ID),
+// #40077: NVIDIA driver 580.x breaks ANGLE's EGL probing (Invalid visual ID),
// killing the GPU process at startup. Route ANGLE through its SwiftShader
// backend instead — the app then launches and stays up (CPU rendering, slow
// but stable). Deliberately NOT disableHardwareAcceleration(): on 580.173.02 +
@@ -780,7 +780,7 @@ if (NVIDIA_EGL_FALLBACK.enable) {
app.commandLine.appendSwitch('use-angle', 'swiftshader')
console.log(
`[hermes] NVIDIA EGL fallback enabled (${NVIDIA_EGL_FALLBACK.reason}); routing ANGLE ` +
- 'through SwiftShader to avoid the NVIDIA 580+ EGL probe crash (#40077). ' +
+ 'through SwiftShader to avoid the NVIDIA 580-series EGL probe crash (#40077). ' +
'HERMES_DESKTOP_NVIDIA_SWIFTSHADER=0 to opt out.'
)
}
diff --git a/website/docs/reference/environment-variables.md b/website/docs/reference/environment-variables.md
index e2ba195ca2d..571e4e284e8 100644
--- a/website/docs/reference/environment-variables.md
+++ b/website/docs/reference/environment-variables.md
@@ -585,6 +585,7 @@ Three dashboard-auth providers ship in the box. For a remote Hermes Desktop conn
| `HERMES_DESKTOP_PYTHON` | Absolute path to a Python interpreter for the backend, checked before Electron auto-resolves one for the source checkout. Used by worktree dev helpers (see [TUI & Desktop from Worktrees](../developer-guide/worktree-ui-dev.md)) to reuse a shared venv. |
| `HERMES_DESKTOP_DEV_SERVER` | Vite dev-server URL the Electron shell loads instead of the packaged bundle (e.g. `http://127.0.0.1:5174`). Set automatically by `npm run dev`; only relevant when hacking on the app. |
| `HERMES_DESKTOP_CDP_PORT` | Overrides the Chrome DevTools Protocol port the renderer exposes on `127.0.0.1` for DOM/CSS inspection tooling (default `9222`). Dev-server runs (`npm run dev`, `hgui`) open it automatically; a packaged app never does, and no value here changes that. Set to `off` to disable it on a dev run. Anything that can reach the port can execute code in the renderer. |
+| `HERMES_DESKTOP_NVIDIA_SWIFTSHADER` | (Desktop on Linux, NVIDIA only) Override for the EGL fallback that routes rendering through SwiftShader on driver series with a broken EGL probe (`580.x`, #40077): `1` forces the fallback on — the recovery hatch if a future series reintroduces the crash but is not yet in the closed list; `0` opts out and uses the native GPU path at your own risk. Force-on does not apply where another gate already disabled the GPU (remote display, WSLg, `HERMES_DESKTOP_DISABLE_GPU=0`). |
| `HTTPS_PROXY` / `HTTP_PROXY` / `NO_PROXY` | (Desktop side) The in-app update check (`Help → Check for Updates…` and the passive update banner) reaches `api.github.com` through the proxy these standard variables name, with `NO_PROXY` exemptions honoured — the same convention `curl`, `npm` and `git` follow. Unset, the check connects directly. |
### Microsoft Graph (Teams Meetings)