Skip to content

fix(wsl): restore snoreToast +x so toasts work after a fresh install - #152

Merged
mohak34 merged 2 commits into
mohak34:mainfrom
cardin:fix/wsl-snoretoast-chmod
Nov 14, 2026
Merged

mohak34 merged 2 commits into
mohak34:mainfrom
cardin:fix/wsl-snoretoast-chmod

Conversation

@cardin

@cardin cardin commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Problem

On WSL, a fresh install of the plugin never shows Windows toast notifications. The
bundled node-notifier snoretoast-x64.exe is published at 0644; WSL still requires
the Unix execute bit to launch a Windows binary, so the spawn fails with EACCES.
WindowsToaster swallows that error (it only forwards errno -1) and the plugin
ignores the callback error, so nothing is logged and no toast appears. Users have to
discover node-notifier's README note and run chmod +x after every install or update.

Fixes #151

Change

  • Add src/snoretoast.ts: resolve node-notifier through
    createRequire(import.meta.url).resolve("node-notifier"), pick the x64/x86
    binary the same way node-notifier does, and restore 0755 when the execute bit is
    missing.
  • Call it once in src/notify.ts when isWsl is true, before constructing
    WindowsToaster. The change is gated to WSL: native Windows ignores the Unix mode
    and Linux/macOS never use this binary.
  • Never throw. A read-only install keeps today's behavior; a successful repair logs
    only under OPENCODE_NOTIFIER_DEBUG=1.
  • Add unit tests, a README WSL note, and a CHANGELOG entry.

OpenCode version and platforms

Affects OpenCode 1 and 2, because both load the same src/notify.ts.

Tested on:

  • WSL2 (Ubuntu 26.04) on Windows 11 Home 10.0.26300.9974, Windows Terminal, OpenCode
    v2.3.0, plugin 1.1.2.
  • Not tested on native Windows, Linux or macOS; the new code path is WSL-only.

Evidence

Unit tests and checks:

$ bun test src/snoretoast.test.ts src/notify.test.ts src/notify.actions.test.ts src/notify.lifetime.test.ts
 14 pass
 9 skip
 0 fail
$ bun run typecheck   # clean
$ bun run build       # clean

Clean-environment check with the packed build (fresh directory, no plugin installed):

Step snoretoast-x64.exe Launch
Before install — plugin and node-notifier unresolved
After npm install of the patched tarball 0644 Permission denied (126)
After the plugin loads 0755 executes (SnoreToast exits 255 for -help)
Load again 0755, no repair logged —
Reset to 0644, load again (cache refresh) 0755, repair logged —

Control: the published 1.1.2 build stays at 0644 after loading, and launching it
still fails with Permission denied (126).

Drafted with DeepSeek V4.1 Flash 1017 in OpenCode.

…e, fix changelog

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mohak34
mohak34 merged commit 3ad541d into mohak34:main Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WSL: toasts never appear after a fresh install until snoretoast-x64.exe is chmod +x

2 participants