Skip to content

[Improvement]: Use openclaw-stable worktree as gateway runtime to decouple from dev builds #18

@Arry8

Description

@Arry8

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

  • ~/Developer/openclaw-stable/ exists as a git worktree on main
  • openclaw-stable/node_modules symlinked to openclaw/node_modules (avoid 1.5 GB duplication)
  • Plist points to ~/Developer/openclaw-stable/dist/index.js
  • openclaw gateway status --deep passes (RPC: ok, plugins load correctly)
  • Building in ~/Developer/openclaw/ does NOT affect the running gateway
  • Watchdog uses launchctl restart instead of gateway install --force (no plist rewrite)
  • pnpm deploy:stable builds in dev, promotes to stable, restarts gateway

Implementation plan

  1. Create ~/Developer/openclaw-stable/ as git worktree add ../openclaw-stable main
  2. Symlink openclaw-stable/node_modulesopenclaw/node_modules
  3. Update scripts/deploy-local.sh to rsync dist/ to openclaw-stable/dist/ and update plist target
  4. Update scripts/deploy-replist.sh to target openclaw-stable/dist/index.js
  5. Modify ~/.openclaw/scripts/gateway-watchdog.sh to restart via launchctl instead of gateway install --force
  6. 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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions