From 77f905e39cf921c083efee60e366ee2d17206175 Mon Sep 17 00:00:00 2001 From: "burrito.space" Date: Sun, 5 Jul 2026 14:02:23 +0200 Subject: [PATCH] fix(desktop): seed hybrid-overlay app-active gate true in headless (Electron 43) Electron 43's app.isActive() reports false under the headless/accessory activation policy (the app is never frontmost in CI). initHybridOverlay consulted it at init and so seeded appActive=false, disarming the app-active gate before any test drives a resign/become transition: click-capture never armed (capture gated on appActive), Cmd+L never focused the overlay, and the R1 baseline read appActive=false. That broke 3 hybrid-overlay specs under the E43 migration. Keep the documented "normally active at init" seed in headless; consult app.isActive() only for a real (non-headless) app, where a freshly-launched window genuinely is frontmost. peek 06d363fc. --- apps/desktop/main/hybrid-overlay.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/desktop/main/hybrid-overlay.ts b/apps/desktop/main/hybrid-overlay.ts index 721b3380..15e6c554 100644 --- a/apps/desktop/main/hybrid-overlay.ts +++ b/apps/desktop/main/hybrid-overlay.ts @@ -748,7 +748,17 @@ export function initHybridOverlay(): void { // through a guarded cast (it stays `true` when the method is unavailable). try { const maybeIsActive = (app as unknown as { isActive?: () => boolean }).isActive; - appActive = typeof maybeIsActive === 'function' ? maybeIsActive.call(app) : true; + // Headless has no real activation (accessory policy, never frontmost) and + // Electron 43's `app.isActive()` reports false there — which would wrongly + // disarm the app-active gate at init, before any test drives a resign/become + // transition (capture never arms, Cmd+L never focuses). Keep the "normally + // active at init" seed in headless; consult `isActive()` only for a real + // (non-headless) app, where a freshly-launched window IS frontmost. + appActive = isHeadless() + ? true + : typeof maybeIsActive === 'function' + ? maybeIsActive.call(app) + : true; } catch { appActive = true; } -- 2.51.2