fix: remove stale Happy daemon lock file on startup #17

Merged
cpfarhood merged 2 commits from fix/happy-daemon-stale-lock into main 2026-02-20 15:21:53 +00:00
cpfarhood commented 2026-02-20 15:18:22 +00:00 (Migrated from github.com)

Summary

daemon.state.json.lock is left behind in HAPPY_HOME_DIR when the daemon crashes or the pod is killed/restarted. On next startup happy daemon start sees the lock file and silently exits with Failed to start daemon, leaving no daemon running.

Since the lock lives on the PVC (/home/user/.happy/) it persists across pod restarts, causing every subsequent boot to fail.

The fix is to remove the lock unconditionally before starting — if no daemon is running, the lock is stale by definition.

Test plan

  • Confirm rm ~/.happy/daemon.state.json.lock && happy daemon start works in current pod
  • Deploy updated image, restart pod
  • Confirm daemon starts automatically and happy daemon status shows running
  • Confirm mobile/webapp respond

🤖 Generated with Claude Code

## Summary `daemon.state.json.lock` is left behind in `HAPPY_HOME_DIR` when the daemon crashes or the pod is killed/restarted. On next startup `happy daemon start` sees the lock file and silently exits with `Failed to start daemon`, leaving no daemon running. Since the lock lives on the PVC (`/home/user/.happy/`) it persists across pod restarts, causing every subsequent boot to fail. The fix is to remove the lock unconditionally before starting — if no daemon is running, the lock is stale by definition. ## Test plan - [ ] Confirm `rm ~/.happy/daemon.state.json.lock && happy daemon start` works in current pod - [ ] Deploy updated image, restart pod - [ ] Confirm daemon starts automatically and `happy daemon status` shows running - [ ] Confirm mobile/webapp respond 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.