fix(desktop): guard lazy-loaded native-module calls (fixes focusassist tray crash) #14

Merged
mohlec merged 1 commit from fix/focus-assist-lazy-crash into slash/main 2026-07-15 02:31:17 +00:00
Owner

The app loads now (registry.node fixed) but crashed on minimize-to-tray: focusassist.node is not a valid Win32 application. windows-focus-assist loads its .node LAZILY on first getFocusAssist() call, so guarding only the require() (previous fix) let the wrong-arch binary throw at the call site, uncaught. Now the whole call is wrapped + failure cached -> reports not-in-DND instead of crashing. Same hardening for macos-notification-state.

The app loads now (registry.node fixed) but crashed on minimize-to-tray: focusassist.node is not a valid Win32 application. windows-focus-assist loads its .node LAZILY on first getFocusAssist() call, so guarding only the require() (previous fix) let the wrong-arch binary throw at the call site, uncaught. Now the whole call is wrapped + failure cached -> reports not-in-DND instead of crashing. Same hardening for macos-notification-state.
fix(desktop): guard lazy-loaded native module CALLS, not just require
All checks were successful
Build Slash Desktop / build-macos (pull_request) Has been skipped
Build Slash Desktop / build-windows (pull_request) Successful in 1m38s
Build Slash Desktop / build-linux (pull_request) Successful in 6m5s
e29cf771d0
The app still crashed on minimize-to-tray with 'focusassist.node is not a valid
Win32 application'. windows-focus-assist loads its .node LAZILY on the first
getFocusAssist()/isPriority() call (module lib/index.js: lib = lib ||
require('bindings')('focusassist')), not at require() time — so the earlier guard
around require() passed, and the wrong-arch binary threw at the CALL site (during
the tray DND check), uncaught.

Wrap the whole getWindowsDoNotDisturb body (require + calls) in try/catch and
cache the failure so a broken native module reports 'not in DND' instead of
crashing, and isn't retried every check. Same hardening applied to the
macos-notification-state call path.

registry-js is unaffected (its call sites are already inside try/catch, and its
.node is now a correct PE binary).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
mohlec merged commit ed3f50fd83 into slash/main 2026-07-15 02:31:17 +00:00
mohlec deleted branch fix/focus-assist-lazy-crash 2026-07-15 02:31:18 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
slash/slash-desktop!14
No description provided.