fix(daemon): use minimal PATH for gateway services#477
Closed
azade-c wants to merge 1 commit into
Closed
Conversation
The gateway daemon now uses a minimal PATH that includes only: - ~/.bun/bin (bun runtime) - /usr/local/bin, /usr/bin, /bin (system tools) This intentionally excludes version managers (nvm, fnm, volta) and package managers (pnpm, npm) since they're only needed at install time, not runtime. Benefits: - Cleaner service environment - No hardcoded version-specific paths that break on upgrades - Consistent behavior across different user setups Runtime variables like DISPLAY should be set in ~/.clawdbot/.env which is loaded early by the gateway. Also adds: - buildServiceEnvironment() helper in src/daemon/service-env.ts - Unit tests for the new helper - Documentation in troubleshooting.md
Contributor
|
Thanks! Landed already in main via 1cf8503 (fix(daemon): audit runtime best practices). That commit adds service-env + tests, wires it into daemon install/doctor/onboarding, and updates troubleshooting docs. It also keeps /opt/homebrew/bin and win32 PATH handling, so this PR would regress those. Closing as already addressed. |
Contributor
|
Made sure you are in the commit graph. |
3 tasks
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.
Summary
The gateway daemon now uses a minimal PATH that includes only:
~/.bun/bin(bun runtime)/usr/local/bin,/usr/bin,/bin(system tools)This intentionally excludes version managers (nvm, fnm, volta) and package managers (pnpm, npm) since they're only needed at install time, not runtime.
Benefits
Runtime variables
Variables like
DISPLAY(for headless browser) should be set in~/.clawdbot/.env, which is loaded early by the gateway vialoadDotEnv(). This keeps runtime config separate from the service definition.Changes
buildServiceEnvironment()helper insrc/daemon/service-env.tsbuildMinimalServicePath()to construct a minimal PATHservice.install()call sites to use the new helperdocs/gateway/troubleshooting.mdTesting
pnpm exec vitest run src/daemon/service-env.test.tsTested manually on Linux (systemd) — gateway starts correctly with the minimal PATH.