From 751402be448fc3a3f5e095909c936b04b4ec0ea1 Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Fri, 20 Feb 2026 10:18:12 -0500 Subject: [PATCH 1/2] fix: remove stale happy daemon lock file before starting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- scripts/init-repo.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/init-repo.sh b/scripts/init-repo.sh index a3deeb9..7b32f0f 100644 --- a/scripts/init-repo.sh +++ b/scripts/init-repo.sh @@ -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..." From 5d8b1369c3b92ab66bdf1778171885bb16a89606 Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Fri, 20 Feb 2026 10:20:49 -0500 Subject: [PATCH 2/2] 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 --- chart/values.yaml | 2 +- scripts/init-repo.sh | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/chart/values.yaml b/chart/values.yaml index 37627ee..ebcc1f8 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -12,7 +12,7 @@ githubRepo: "" # Happy Coder endpoints happyServerUrl: "https://happy.farh.net" happyWebappUrl: "https://happy-coder.farh.net" -happyHomeDir: "/home/user/.happy" +happyHomeDir: "/workspace/.happy" happyExperimental: "true" # VNC display diff --git a/scripts/init-repo.sh b/scripts/init-repo.sh index 7b32f0f..fe0e675 100644 --- a/scripts/init-repo.sh +++ b/scripts/init-repo.sh @@ -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..."