fix: move HAPPY_HOME_DIR to /workspace so lock never persists across restarts

The daemon.state.json.lock lives on the home PVC and survives pod
restarts, causing happy daemon start to fail on every reboot. Moving
HAPPY_HOME_DIR to /workspace (emptyDir) means the entire happy state
directory is ephemeral and always clean on startup.

The rm -f in init-repo.sh is kept as a safety net for the within-run
case but is now a no-op on fresh starts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-20 10:20:49 -05:00
parent 751402be44
commit 5d8b1369c3
2 changed files with 5 additions and 4 deletions
+4 -3
View File
@@ -63,9 +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"
# HAPPY_HOME_DIR is in /workspace (emptyDir), so it is always fresh on pod start.
# Remove the lock file as a safety net in case daemon start is called more than
# once within the same container lifetime.
rm -f "${HAPPY_HOME_DIR:-/workspace/.happy}/daemon.state.json.lock"
cd "$WORKSPACE_DIR"
happy daemon start || echo "Happy Coder daemon failed to start, continuing anyway..."