Skip to content

The agent that grows with you

style(desktop): satisfy perfectionist import order after the main rebase

Brooklyn Nicholson180c8365de94
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts
index 5f6a75d084b..f08a536cb90 100644
--- a/apps/desktop/electron/main.ts
+++ b/apps/desktop/electron/main.ts
@@ -330,6 +330,17 @@ import type { InstallStamp } from './install-stamp'
import { applyLaunchProfileOverride } from './launch-profile'
import { fetchLinkTitle, resolveFaviconCached } from './link-metadata'
import { CHROMIUM_LOG_FILENAME, enableLinuxCrashDiagnostics, linuxCrashDiagnostics } from './linux-crash-diagnostics'
+import {
+ decideLinuxGpuLaunch,
+ disableGpuSwitchNeededForReason,
+ LINUX_GPU_SILENT_RETRY_GRACE_S,
+ linuxGpuChildDeathPath,
+ linuxGpuFallbackMarker,
+ linuxGpuMarkerAfterSuccessfulBoot,
+ readLinuxGpuMarker,
+ shouldEngageSilentGpuRetryFallback,
+ writeLinuxGpuMarker
+} from './linux-gpu-fallback'
import { notifyLauncherWindowRevealed } from './linux-launcher-ready'
import {
decideNvidiaEglFallback,
@@ -668,17 +679,6 @@ import {
shouldSurfaceErrorForRendererStackCookieCrashLoop,
writeGpuStackCookieMarker
} from './windows-stack-cookie-fallback'
-import {
- decideLinuxGpuLaunch,
- disableGpuSwitchNeededForReason,
- LINUX_GPU_SILENT_RETRY_GRACE_S,
- linuxGpuChildDeathPath,
- linuxGpuFallbackMarker,
- linuxGpuMarkerAfterSuccessfulBoot,
- readLinuxGpuMarker,
- shouldEngageSilentGpuRetryFallback,
- writeLinuxGpuMarker
-} from './linux-gpu-fallback'
import { readWindowsUserEnvVar } from './windows-user-env'
import { isPackagedInstallPath as isPackagedInstallPathUnderRoots } from './workspace-cwd'
import { readWslWindowsClipboardImage } from './wsl-clipboard-image'
@@ -735,6 +735,7 @@ if (REMOTE_DISPLAY_REASON) {
// Belt-and-suspenders for X11/VNC, where the Viz compositor can still glitch
// with only --disable-gpu: force compositing onto the CPU too.
app.commandLine.appendSwitch('disable-gpu-compositing')
+
// #97616: disableHardwareAcceleration() alone does NOT stop a GPU child
// from spawning (it then dies error_code=1002 on AMD/Mesa). For the explicit
// HERMES_DESKTOP_DISABLE_GPU override, fully spawn-block it. Remote-display
@@ -742,6 +743,7 @@ if (REMOTE_DISPLAY_REASON) {
if (disableGpuSwitchNeededForReason(REMOTE_DISPLAY_REASON)) {
app.commandLine.appendSwitch('disable-gpu')
}
+
console.log(
`[hermes] remote display detected (${REMOTE_DISPLAY_REASON}); disabling GPU hardware acceleration to prevent flicker`
)
@@ -1104,6 +1106,7 @@ if (IS_WINDOWS || process.platform === 'linux') {
const alreadySoftware =
LINUX_GPU_SOFTWARE_ACTIVE || linuxGpuFallbackActive || alreadyHasDisableGpu(process.argv, process.env)
+
const path = linuxGpuChildDeathPath({
details,
alreadyNoSandbox: windowsSandboxFallbackActive || alreadyHasNoSandbox(process.argv, process.env),
@@ -15293,6 +15296,7 @@ function createWindow() {
linuxGpuFallbackActive ||
alreadyHasDisableGpu(process.argv, process.env) ||
isHermesDesktopGpuOverrideOff(process.env)
+
const gpuChildPresent = app
.getAppMetrics()
.some(metric => String(metric?.type || '').toLowerCase() === 'gpu')
diff --git a/apps/desktop/electron/windows-sandbox-fallback.test.ts b/apps/desktop/electron/windows-sandbox-fallback.test.ts
index dab14fc9d9c..534972e86cf 100644
--- a/apps/desktop/electron/windows-sandbox-fallback.test.ts
+++ b/apps/desktop/electron/windows-sandbox-fallback.test.ts
@@ -10,10 +10,10 @@ import {
alreadyHasNoSandbox,
BOOT_ABORTS_BEFORE_FALLBACK,
buildIcaclsGrantArgs,
- GPU_CHILD_SANDBOX_SIGTERM_EXIT,
buildNoSandboxRelaunchArgs,
decideWindowsSandboxLaunch,
fallbackMarker,
+ GPU_CHILD_SANDBOX_SIGTERM_EXIT,
grantAllApplicationPackagesAcl,
isWindowsSandboxBreakpointExit,
markerAfterSuccessfulBoot,
@@ -381,6 +381,7 @@ test('linux boot-abort ladder engages --no-sandbox on the second consecutive abo
env,
appVersion
})
+
assert.equal(first.enable, false)
assert.deepEqual(first.nextMarker, { state: 'booting', bootAborts: 1 })
@@ -391,6 +392,7 @@ test('linux boot-abort ladder engages --no-sandbox on the second consecutive abo
env,
appVersion
})
+
assert.equal(second.enable, true)
assert.equal(second.reason, 'boot-loop')
assert.equal(second.nextMarker.state, 'fallback')
@@ -403,6 +405,7 @@ test('linux boot-abort ladder engages --no-sandbox on the second consecutive abo
env,
appVersion
})
+
assert.equal(sticky.enable, true)
assert.equal(sticky.reason, 'sticky-fallback')
@@ -414,6 +417,7 @@ test('linux boot-abort ladder engages --no-sandbox on the second consecutive abo
env,
appVersion: '0.22.0'
})
+
assert.equal(reprobe.enable, false)
assert.deepEqual(reprobe.nextMarker, { state: 'booting', reprobe: true, bootAborts: 0 })
@@ -424,6 +428,7 @@ test('linux boot-abort ladder engages --no-sandbox on the second consecutive abo
env,
appVersion: '0.22.0'
})
+
assert.equal(reprobeFailed.enable, true)
assert.equal(reprobeFailed.reason, 'reprobe-failed')
})