From 95358869459c14257812e2c13287bb2a7dac21e9 Mon Sep 17 00:00:00 2001 From: DevContainer User Date: Sun, 22 Feb 2026 13:01:19 +0000 Subject: [PATCH] feat: remove automatic Happy daemon startup Removes unreliable automatic Happy Coder daemon startup, allowing users to start it manually when needed for better reliability and control. **Changes:** - scripts/init-repo.sh: Removed Happy daemon startup code and lock cleanup - scripts/startapp.sh: Updated comment to reflect init-repo only handles git - README.md: Updated startup flow documentation and troubleshooting section - CLAUDE.md: Updated startup flow and file descriptions **Benefits:** - No more unreliable automatic daemon startup failures - Users can start Happy daemon manually when needed: `happy daemon start` - Cleaner container startup without Happy-related delays or errors - Happy configuration and credentials still persist on PVC when used **Usage:** Users can now manually start Happy Coder when needed: ```bash happy daemon start # Start when needed happy daemon status # Check status happy daemon stop # Stop if needed ``` Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- CLAUDE.md | 3 +-- README.md | 17 ++++++++++------- scripts/init-repo.sh | 14 +------------- scripts/startapp.sh | 2 +- 4 files changed, 13 insertions(+), 23 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 14da2b4..fef6084 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -60,7 +60,6 @@ Container start → scripts/init-repo.sh → Configure git user & credentials → Clone GITHUB_REPO (if set) - → Start Happy Coder → Launch VSCode as user `user` in /workspace ``` @@ -69,7 +68,7 @@ Container start | File | Purpose | |------|---------| | `Dockerfile` | Image definition — installs Chrome, Node.js, VSCode, Happy Coder; creates non-root user (UID 1000) | -| `scripts/init-repo.sh` | Configures git credentials, clones GitHub repo, starts Happy Coder background service | +| `scripts/init-repo.sh` | Configures git credentials, clones GitHub repo | | `scripts/startapp.sh` | Calls init-repo.sh then opens VSCode in the workspace | | `chart/` | Helm chart for Kubernetes deployment | | `chart/templates/deployment.yaml` | Deployment spec — main container + MCP sidecar containers | diff --git a/README.md b/README.md index c65187b..2f30a3d 100644 --- a/README.md +++ b/README.md @@ -313,8 +313,6 @@ Container start → /startapp.sh (runs as app user, UID 1000) → init-repo.sh → clone / pull GITHUB_REPO into /workspace/{repo} - → rm daemon.state.json.lock — clear stale Happy lock - → happy daemon start — starts Happy Coder background daemon → IDE=vscode: code --new-window --wait /workspace/{repo} IDE=antigravity: antigravity --no-sandbox --user-data-dir ~/.config/antigravity ... /workspace/{repo} IDE=none: sleep infinity @@ -328,23 +326,28 @@ Container start | `/home` | ReadWriteMany PVC (`userhome-{name}`) | Survives pod restarts — stores Claude credentials, dotfiles, git config | | `/workspace` | `emptyDir` | Ephemeral — repo is re-cloned on each pod start | -Happy Coder's runtime state (`HAPPY_HOME_DIR`) is kept in `/home/user/.happy` on the persistent home PVC, so auth credentials and settings survive pod restarts. A stale lock file (`daemon.state.json.lock`) is removed automatically on each startup. +Happy Coder's runtime state (`HAPPY_HOME_DIR`) is kept in `/home/user/.happy` on the persistent home PVC, so auth credentials and settings survive pod restarts when manually started. --- ## Troubleshooting -### Happy Coder daemon not starting +### Happy Coder (manual startup) + +Happy daemon is not started automatically. Launch it manually when needed: ```bash +# Start Happy Coder daemon manually +happy daemon start + # Check daemon status happy daemon status -# Start manually (also clears any stale lock) -happy daemon start - # View daemon logs ls ~/.happy/logs/ + +# Stop daemon if needed +happy daemon stop ``` ### Claude not authenticated diff --git a/scripts/init-repo.sh b/scripts/init-repo.sh index 4a5548c..99c3349 100644 --- a/scripts/init-repo.sh +++ b/scripts/init-repo.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Initialize repository and start Happy Coder +# Initialize repository set -e echo "=== Repository Initialization ===" @@ -102,18 +102,6 @@ chown -R "$RUN_UID:$RUN_GID" "$WORKSPACE_DIR" mkdir -p "$HOME" chown "$RUN_UID:$RUN_GID" "$HOME" -# Start Happy Coder daemon. startapp.sh already runs as the app user (UID 1000), -# so no sudo needed — Happy/Claude Code will find credentials in the correct home dir. -echo "Starting Happy Coder..." - -# Remove stale lock file. HAPPY_HOME_DIR lives on the home PVC so it survives -# pod restarts — without this cleanup the daemon refuses to start after a crash. -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..." - -echo "Happy Coder daemon started" # Export workspace directory for startapp.sh echo "$WORKSPACE_DIR" > /tmp/workspace-dir diff --git a/scripts/startapp.sh b/scripts/startapp.sh index 7b687e4..748fc9c 100644 --- a/scripts/startapp.sh +++ b/scripts/startapp.sh @@ -4,7 +4,7 @@ set -e echo "=== Starting Dev Container ===" -# Initialize repository and Happy Coder +# Initialize repository /usr/local/bin/init-repo # Get workspace directory