fix: remove stale happy daemon lock file before starting

daemon.state.json.lock is left behind when the daemon crashes or is
killed (e.g. pod restart). On next startup happy daemon start sees the
lock and exits with "Failed to start daemon" without further detail.

Remove the lock file unconditionally at startup — if no daemon is
running, the lock is stale by definition.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-20 10:18:12 -05:00
parent 66e0d1f406
commit 751402be44
+4
View File
@@ -63,6 +63,10 @@ chown "$RUN_UID:$RUN_GID" "$HOME"
# so no sudo needed — Happy/Claude Code will find credentials in the correct home dir.
echo "Starting Happy Coder..."
# Remove stale lock file left by a previously crashed daemon — without this,
# happy daemon start refuses to start and exits with "Failed to start daemon".
rm -f "${HAPPY_HOME_DIR:-$HOME/.happy}/daemon.state.json.lock"
cd "$WORKSPACE_DIR"
happy daemon start || echo "Happy Coder daemon failed to start, continuing anyway..."