fix(cli): wire --tray Unix path through the runtime systray2 loader (#4605) - #5276
Merged
Merged
Conversation
…4605) The wired tray path (serve.mjs -> tray/index.mjs -> traySystray.mjs) loaded systray2 via an inline loader calling require("module") inside an ESM .mjs file (package type:module), which throws ReferenceError: require is not defined and was silently swallowed -> no tray, no diagnostic (regressed in v3.8.34). Even when fixed, systray2 is not in node_modules; it is lazily installed into ~/.omniroute/runtime by trayRuntime.ts. initSystrayUnix now delegates loading to trayRuntime.ts::loadSystray (async), fixes the icon path (icon.png, not icons/icon.png), sets isTemplateIcon:false (full-color icon rendered as a white square under macOS template mode), and serve.mjs surfaces tray-start failures to stderr instead of swallowing them. TDD: tray-systray-loader-4605.test.ts drives the loader seam via an injected ctor (native binary can't run in unit tests) and asserts the menu/icon/template invariants; fail-before confirmed by restoring the broken require() loader.
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Closed
Merged
tkgo11
pushed a commit
to tkgo11/OmniRoute
that referenced
this pull request
Sep 23, 2026
…iegosouzapw#4605) (diegosouzapw#5276) The wired tray path (serve.mjs -> tray/index.mjs -> traySystray.mjs) loaded systray2 via an inline loader calling require("module") inside an ESM .mjs file (package type:module), which throws ReferenceError: require is not defined and was silently swallowed -> no tray, no diagnostic (regressed in v3.8.34). Even when fixed, systray2 is not in node_modules; it is lazily installed into ~/.omniroute/runtime by trayRuntime.ts. initSystrayUnix now delegates loading to trayRuntime.ts::loadSystray (async), fixes the icon path (icon.png, not icons/icon.png), sets isTemplateIcon:false (full-color icon rendered as a white square under macOS template mode), and serve.mjs surfaces tray-start failures to stderr instead of swallowing them. TDD: tray-systray-loader-4605.test.ts drives the loader seam via an injected ctor (native binary can't run in unit tests) and asserts the menu/icon/template invariants; fail-before confirmed by restoring the broken require() loader.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4605
Problem
omniroute server --trayshows no tray on macOS/Linux with no error printed.The wired Unix tray path (
serve.mjs→tray/index.mjs→traySystray.mjs) loadedsystray2via an inline loader that calledrequire("module")inside an ESM.mjsfile (package"type":"module").requireis undefined in ESM →ReferenceError: require is not defined, swallowed by a barecatch {}→loadSystray2()returnednull→ no tray, no diagnostic. Regressed in v3.8.34. Even had it loaded,systray2is not innode_modules— it is lazily installed into~/.omniroute/runtimebytrayRuntime.ts. The maintainedtray.ts/trayRuntime.tspath that does this correctly existed but was never wired in.Fix (Unix path only — Windows
trayWindows.mjsuntouched)initSystrayUnixis now async and delegates loading totrayRuntime.ts::loadSystray(lazy-installs + chmods + imports systray2 from the runtime dir).icon.png(the previousicons/icon.pngnever existed → empty icon).isTemplateIcon: false— the full-color RGBA icon rendered as a solid white square under macOS template mode (looked "missing" even when loaded).serve.mjsnow surfaces tray-start failures to stderr instead of swallowing them, so "--tray shows nothing" is diagnosable.index.mjs::initTrayandserve.mjs::maybeStartTrayawait the now-async init.Validation (Hard Rule #18 — TDD)
tests/unit/tray-systray-loader-4605.test.ts: the native Go binary can't run in a unit test (same constraint ascli-tray-systray2.test.ts), so the test drives the loader seam via an injected ctor and asserts the menu (5 items incl. "Show Logs"), non-empty icon (path fix), andisTemplateIcon === false. Fail-before proven by restoring the brokenrequire()loader (test 1 → ✖). All 21 tray-suite tests pass.