The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): honor desktop.renderer_accessibility on packaged launches
Brooklyn Nicholson01db908bf798
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.tsindex 73b884c2b6a..5d25bf0c958 100644--- a/apps/desktop/electron/main.ts+++ b/apps/desktop/electron/main.ts@@ -953,7 +953,18 @@ const HERMES_HOME: string = resolveDesktopHermesHome({void 0 // first run: no config yet → Chromium defaults}- for (const planned of planLaunchSwitches(readDesktopLaunchConfig(desktopLaunchYaml), process.argv.slice(1))) {+ const desktopLaunchConfig = readDesktopLaunchConfig(desktopLaunchYaml)++ // `desktop.renderer_accessibility: false` must reach packaged launches too,+ // not only the `hermes desktop` launcher's env bridge (#118271).+ if (+ desktopLaunchConfig.rendererAccessibility === false &&+ process.env.HERMES_DESKTOP_RENDERER_ACCESSIBILITY === undefined+ ) {+ process.env.HERMES_DESKTOP_RENDERER_ACCESSIBILITY = '0'+ }++ for (const planned of planLaunchSwitches(desktopLaunchConfig, process.argv.slice(1))) {if (planned.value === undefined) {app.commandLine.appendSwitch(planned.name)} else {diff --git a/apps/desktop/electron/renderer-accessibility.ts b/apps/desktop/electron/renderer-accessibility.tsindex 84c0a8755e9..34580499993 100644--- a/apps/desktop/electron/renderer-accessibility.ts+++ b/apps/desktop/electron/renderer-accessibility.ts@@ -13,9 +13,10 @@* the composer being reachable by every accessibility-driven input method is* the point of the bug fix; the tree's rendering cost is the price. A* perf-sensitive setup can opt out with `desktop.renderer_accessibility:- * false` in config.yaml, which the `hermes desktop` launcher bridges as- * HERMES_DESKTOP_RENDERER_ACCESSIBILITY=0 (same shape as desktop.disable_gpu);- * the Electron side also honors that variable when set directly.+ * false` in config.yaml, which becomes HERMES_DESKTOP_RENDERER_ACCESSIBILITY=0+ * — bridged by the `hermes desktop` launcher and, for packaged launches, by+ * main.ts's pre-ready config read (readDesktopLaunchConfig). Setting the+ * variable directly works too.** Extracted dependency-free — the Electron app object is injected — so the* platform/env decision is unit-testable per branch without booting Electron,diff --git a/apps/desktop/electron/renderer-heap-flags.test.ts b/apps/desktop/electron/renderer-heap-flags.test.tsindex 0963cb9bafb..ac4cda011ff 100644--- a/apps/desktop/electron/renderer-heap-flags.test.ts+++ b/apps/desktop/electron/renderer-heap-flags.test.ts@@ -52,6 +52,17 @@ describe('renderer heap flags', () => {])})+ it('reads the renderer_accessibility opt-out for packaged launches (#118271)', () => {+ expect(readDesktopLaunchConfig('desktop:\n renderer_accessibility: false\n').rendererAccessibility).toBe(false)+ expect(readDesktopLaunchConfig('desktop:\n renderer_accessibility: "off" # perf\n').rendererAccessibility).toBe(+ false+ )+ expect(readDesktopLaunchConfig('desktop:\n renderer_accessibility: true\n').rendererAccessibility).toBe(true)+ // Absent or unreadable: unset, so the app keeps its own default.+ expect(readDesktopLaunchConfig('desktop:\n font_family: ""\n').rendererAccessibility).toBeUndefined()+ expect(readDesktopLaunchConfig('desktop:\n renderer_accessibility: maybe\n').rendererAccessibility).toBeUndefined()+ })+it('warns once when a desktop block names the keys in an indentation it cannot read', () => {const warn = vi.spyOn(console, 'warn').mockImplementation(() => undefined)diff --git a/apps/desktop/electron/renderer-heap-flags.ts b/apps/desktop/electron/renderer-heap-flags.tsindex dd8691df12c..4afe3072f2f 100644--- a/apps/desktop/electron/renderer-heap-flags.ts+++ b/apps/desktop/electron/renderer-heap-flags.ts@@ -11,6 +11,8 @@export interface DesktopLaunchConfig {electronFlags: string[]rendererMaxOldSpaceMb: number+ /** `desktop.renderer_accessibility`; unset when the key is absent or unreadable. */+ rendererAccessibility?: boolean}export interface PlannedSwitch {@@ -62,7 +64,15 @@ export function readDesktopLaunchConfig(yamlText: string): DesktopLaunchConfig {const [, key, rawValue] = keyedconst value = rawValue.replace(/\s+#.*$/, '')- if (key === 'renderer_max_old_space_mb') {+ if (key === 'renderer_accessibility') {+ const word = unquote(value).toLowerCase()++ if (['0', 'false', 'no', 'off'].includes(word)) {+ out.rendererAccessibility = false+ } else if (['1', 'true', 'yes', 'on'].includes(word)) {+ out.rendererAccessibility = true+ }+ } else if (key === 'renderer_max_old_space_mb') {const mb = Number.parseInt(unquote(value), 10)out.rendererMaxOldSpaceMb = Number.isFinite(mb) && mb > 0 ? mb : 0} else if (key === 'electron_flags') {