diff --git a/autonomous/agent-loop.sh b/autonomous/agent-loop.sh index 88036dd..befc8dd 100644 --- a/autonomous/agent-loop.sh +++ b/autonomous/agent-loop.sh @@ -57,10 +57,12 @@ sync_state() { fi } +CLAUDE_RC=0 + run_claude() { local prompt="$1" timeout "$CLAUDE_TIMEOUT" claude --dangerously-skip-permissions --print \ - --output-format stream-json --verbose "$prompt" + --output-format stream-json --verbose "$prompt" || CLAUDE_RC=$? } load_prompt() { @@ -288,3 +290,5 @@ EOF fi ;; esac + +exit $CLAUDE_RC diff --git a/autonomous/entrypoint.sh b/autonomous/entrypoint.sh index eb8d262..0c0be31 100644 --- a/autonomous/entrypoint.sh +++ b/autonomous/entrypoint.sh @@ -27,7 +27,7 @@ echo "Building..." dotnet build --no-restore # ── Run the agent ── -MAX_ITERATIONS="${MAX_ITERATIONS:-10}" +MAX_ITERATIONS="${MAX_ITERATIONS:-30}" COOLDOWN="${COOLDOWN_SECONDS:-30}" export CLAUDE_TIMEOUT="${TIMEOUT_SECONDS:-1800}" @@ -39,9 +39,11 @@ for i in $(seq 1 "$MAX_ITERATIONS"); do EXIT_CODE=0 bash /usr/local/bin/agent-loop.sh || EXIT_CODE=$? - if [ "$EXIT_CODE" -ne 0 ]; then + if [ "$EXIT_CODE" -ne 0 ] && [ "$EXIT_CODE" -ne 124 ]; then echo "Iteration $i failed with exit code $EXIT_CODE" break + elif [ "$EXIT_CODE" -eq 124 ]; then + echo "Iteration $i timed out (exit code 124), continuing..." fi # Done?