fix(installer): set PATH on systemd unit and launchd plist#45
Conversation
Service-managed maestro-relay processes inherit systemd's minimal PATH, so they resolve `maestro-cli` to the older /usr/local/bin shim (which calls bare `node` and fails with exit 127 when node isn't on PATH) instead of the newer ~/.local/bin Electron-backed shim that has no node-on-PATH dependency. Bake a sane PATH into both service templates with $HOME/.local/bin and the node bin directory ahead of system paths, so the user-mode Maestro CLI shim is found first and the legacy shim's bare `node` call still resolves as a fallback. install.sh now derives @HOME@ and @NODE_DIR@ from $HOME and dirname \$(command -v node) and passes them through to both templates. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR refactors service installation scripts to compute Node.js's executable path once and propagate it consistently through template substitutions. Service templates are updated to explicitly configure PATH variables using the computed node directory for both systemd (Linux) and launchd (macOS) environments. ChangesService installation and runtime PATH configuration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
maestro-relay(systemd user unit / launchd plist) inherits a minimal PATH that resolvesmaestro-clito the older/usr/local/bin/maestro-clishim (which calls barenodeand fails with exit 127 when node isn't on PATH) instead of the newer~/.local/bin/maestro-cliElectron-backed shim that has no node-on-PATH dependency.templates/maestro-relay.serviceandtemplates/sh.maestro.relay.plistwith$HOME/.local/binand the node bin directory ahead of system paths, so the user-mode Maestro CLI shim wins and the legacy shim's barenodecall still resolves as a fallback.install.shnow derives@HOME@and@NODE_DIR@from$HOMEanddirname $(command -v node)and substitutes them in both templates.Why
Reported in production: relay running under
systemctl --userwould emit[maestro-cli send] exit code: 127 | stderr: /usr/local/bin/maestro-cli: line 2: node: command not foundon every message. Root cause is that the systemd unit had noEnvironment=PATH=…, so the relay's spawnedmaestro-cliresolved to the wrong shim. The newer Maestro desktop already ships a PATH-resilient shim to~/.local/bin/maestro-cli; the relay just needs PATH to include that directory.Rendered output (example)
Test plan
install.shon a Linux box; confirm~/.config/systemd/user/maestro-relay.servicecontains the newEnvironment=PATH=…line with the user's actual$HOMEand node bin dir substituted in.systemctl --user daemon-reload && systemctl --user restart maestro-relay, inspect the running process env (tr '\0' '\n' < /proc/$(systemctl --user show maestro-relay -p MainPID --value)/environ | grep PATH) and confirm~/.local/binis first.maestro-cli --versionresolves to~/.local/bin/maestro-cliunder that PATH (Electron-shim, nonode: command not found).[maestro-cli send] exit code: 127.install.sh, reload the LaunchAgent, and confirm the plist now exports the augmented PATH and the relay can spawnmaestro-clicleanly.🤖 Generated with Claude Code
Summary by CodeRabbit