Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion autonomous/agent-loop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -288,3 +290,5 @@ EOF
fi
;;
esac

exit $CLAUDE_RC
6 changes: 4 additions & 2 deletions autonomous/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

Expand All @@ -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?
Expand Down
Loading