Summary
Replace the ~/.openclaw/dist/ deploy target with a dedicated ~/Developer/openclaw-stable/ git worktree. The plist points to that stable worktree's dist/. Dev builds in openclaw/ never affect the running gateway. Also change the watchdog from gateway install --force to a restart-only approach to prevent it from reverting the plist.
Problem
- Running from
~/.openclaw/dist/ broke plugin loading (extension node_modules not available, jiti can't resolve TypeScript deps)
- The watchdog calls
openclaw gateway install --force on unhealthy detection, which rewrites the plist to the global npm install path, racing against any plist customization
- A second repo clone (
openclaw-stable/) avoids all extension/module resolution issues — it is a self-contained copy with its own node_modules and extensions that work identically to the dev repo
Acceptance criteria
Implementation plan
- Create
~/Developer/openclaw-stable/ as git worktree add ../openclaw-stable main
- Symlink
openclaw-stable/node_modules → openclaw/node_modules
- Update
scripts/deploy-local.sh to rsync dist/ to openclaw-stable/dist/ and update plist target
- Update
scripts/deploy-replist.sh to target openclaw-stable/dist/index.js
- Modify
~/.openclaw/scripts/gateway-watchdog.sh to restart via launchctl instead of gateway install --force
- Add
deploy:stable npm script alias
Files affected
scripts/deploy-local.sh (modify — change deploy target to openclaw-stable)
scripts/deploy-replist.sh (modify — change target path)
package.json (modify — add deploy:stable alias)
~/.openclaw/scripts/gateway-watchdog.sh (modify — restart-only, no install --force)
Additional notes
Watchdog restart approach: launchctl kickstart -k gui/$(id -u)/ai.openclaw.gateway — kills and restarts the service without touching the plist.
AI-assisted (Claude Code, Opus 4.6).
Summary
Replace the ~/.openclaw/dist/ deploy target with a dedicated
~/Developer/openclaw-stable/git worktree. The plist points to that stable worktree'sdist/. Dev builds inopenclaw/never affect the running gateway. Also change the watchdog fromgateway install --forceto a restart-only approach to prevent it from reverting the plist.Problem
~/.openclaw/dist/broke plugin loading (extension node_modules not available, jiti can't resolve TypeScript deps)openclaw gateway install --forceon unhealthy detection, which rewrites the plist to the global npm install path, racing against any plist customizationopenclaw-stable/) avoids all extension/module resolution issues — it is a self-contained copy with its own node_modules and extensions that work identically to the dev repoAcceptance criteria
~/Developer/openclaw-stable/exists as a git worktree onmainopenclaw-stable/node_modulessymlinked toopenclaw/node_modules(avoid 1.5 GB duplication)~/Developer/openclaw-stable/dist/index.jsopenclaw gateway status --deeppasses (RPC: ok, plugins load correctly)~/Developer/openclaw/does NOT affect the running gatewaylaunchctlrestart instead ofgateway install --force(no plist rewrite)pnpm deploy:stablebuilds in dev, promotes to stable, restarts gatewayImplementation plan
~/Developer/openclaw-stable/asgit worktree add ../openclaw-stable mainopenclaw-stable/node_modules→openclaw/node_modulesscripts/deploy-local.shto rsyncdist/toopenclaw-stable/dist/and update plist targetscripts/deploy-replist.shto targetopenclaw-stable/dist/index.js~/.openclaw/scripts/gateway-watchdog.shto restart vialaunchctlinstead ofgateway install --forcedeploy:stablenpm script aliasFiles affected
scripts/deploy-local.sh(modify — change deploy target to openclaw-stable)scripts/deploy-replist.sh(modify — change target path)package.json(modify — add deploy:stable alias)~/.openclaw/scripts/gateway-watchdog.sh(modify — restart-only, no install --force)Additional notes
Watchdog restart approach:
launchctl kickstart -k gui/$(id -u)/ai.openclaw.gateway— kills and restarts the service without touching the plist.AI-assisted (Claude Code, Opus 4.6).