← Back to PRs

#2862: fix: set WorkingDirectory in systemd service for control UI assets

by dlauer open 2026-01-27 16:32 View on GitHub →
gateway
## Summary - Fixes control UI failing with "Control UI assets not found" when gateway runs via systemd - The systemd service was generated without WorkingDirectory, causing cwd to be user's home directory - Now derives workingDirectory from the CLI entrypoint path for all production runtimes ## Test plan - [x] Run `moltbot gateway install` and verify service file contains `WorkingDirectory` - [x] Restart gateway and verify control UI loads at `http://127.0.0.1:18789/` - [x] Run `moltbot doctor --repair` and verify WorkingDirectory persists 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR updates gateway service argument resolution to also compute a `workingDirectory` for production runtimes (node/bun/auto) by deriving it from the built CLI entrypoint path under `dist/`. That working directory then propagates into systemd unit generation so the gateway runs with a predictable CWD and can find Control UI assets (which otherwise may fall back to `process.cwd()`). <h3>Confidence Score: 4/5</h3> - This PR is generally safe to merge; it adds a straightforward working-directory derivation for service generation. - Change scope is small and localized to service argument construction; behavior is additive and gated to production/runtime service paths. Main residual concern is edge-case path parsing when `dist` appears multiple times in the entrypoint path, which could mis-derive the directory in uncommonLine layouts. - src/daemon/program-args.ts <!-- greptile_other_comments_section --> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs