From 6aa4c22d9e4362c5ba671c97bc380af0507346fe Mon Sep 17 00:00:00 2001 From: Karamelmar Date: Mon, 9 Mar 2026 12:42:59 +0100 Subject: [PATCH] Fix race condition: wait for container ready before launching CS Core MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit podman run -d returns before the container process is running. CS Core's claude-code check immediately calls our wrapper, which found the container not yet running and exited 1 — causing the "claude-code not found" error. Add a poll loop (10 x 0.5s) that waits for State.Running=true before setting PATH and launching CS Core. Co-Authored-By: Claude Sonnet 4.6 --- lib/container.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/container.sh b/lib/container.sh index 94c4b65..a952dad 100644 --- a/lib/container.sh +++ b/lib/container.sh @@ -82,7 +82,20 @@ echo "→ Starting agents container '\$CONTAINER_NAME'..." "\$IMAGE_NAME" \\ sleep infinity -echo "→ Container ready." +# ── Wait for container to be running ──────────────────────────────────── +echo -n "→ Waiting for container..." +for _i in 1 2 3 4 5 6 7 8 9 10; do + if "\$RUNTIME" container inspect "\$CONTAINER_NAME" --format '{{.State.Running}}' 2>/dev/null | grep -q true; then + echo " ready." + break + fi + echo -n "." + sleep 0.5 +done +if ! "\$RUNTIME" container inspect "\$CONTAINER_NAME" --format '{{.State.Running}}' 2>/dev/null | grep -q true; then + echo "" + echo "Error: container failed to start." >&2; exit 1 +fi # ── Put claude wrapper first on PATH ──────────────────────────────────── export PATH="\$PROJECT_DIR/bin:\$PATH"