From 6b5a547e2d4eaf399eb7ceba65cfbed3ddb8beb9 Mon Sep 17 00:00:00 2001 From: B <6723574+louisgv@users.noreply.github.com> Date: Tue, 10 Feb 2026 03:43:32 +0000 Subject: [PATCH] fix: Treat 429 (cycle already running) as success in workflows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When MAX_CONCURRENT=1 and a cycle is in progress, the trigger server returns 429. This is expected behavior, not an error — the previous curl -f treated it as failure (exit code 22). Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/improve.yml | 14 ++++++++++++-- .github/workflows/refactor.yml | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.github/workflows/improve.yml b/.github/workflows/improve.yml index 3e5f2ad6..4ae4fde4 100644 --- a/.github/workflows/improve.yml +++ b/.github/workflows/improve.yml @@ -20,5 +20,15 @@ jobs: SPRITE_URL: ${{ secrets.DISCOVERY_SPRITE_URL }} TRIGGER_SECRET: ${{ secrets.DISCOVERY_TRIGGER_SECRET }} run: | - curl -sf -X POST "${SPRITE_URL}/trigger?reason=${{ github.event_name }}" \ - -H "Authorization: Bearer ${TRIGGER_SECRET}" + HTTP_CODE=$(curl -s -o /tmp/response.json -w '%{http_code}' -X POST \ + "${SPRITE_URL}/trigger?reason=${{ github.event_name }}" \ + -H "Authorization: Bearer ${TRIGGER_SECRET}") + cat /tmp/response.json + if [ "$HTTP_CODE" = "429" ]; then + echo "Cycle already running, skipping" + elif [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then + echo "Triggered successfully" + else + echo "Failed with HTTP $HTTP_CODE" + exit 1 + fi diff --git a/.github/workflows/refactor.yml b/.github/workflows/refactor.yml index 396a45b7..8f1f7ca1 100644 --- a/.github/workflows/refactor.yml +++ b/.github/workflows/refactor.yml @@ -20,5 +20,15 @@ jobs: SPRITE_URL: ${{ secrets.REFACTOR_SPRITE_URL }} TRIGGER_SECRET: ${{ secrets.REFACTOR_TRIGGER_SECRET }} run: | - curl -sf -X POST "${SPRITE_URL}/trigger?reason=${{ github.event_name }}&issue=${{ github.event.issue.number || '' }}" \ - -H "Authorization: Bearer ${TRIGGER_SECRET}" + HTTP_CODE=$(curl -s -o /tmp/response.json -w '%{http_code}' -X POST \ + "${SPRITE_URL}/trigger?reason=${{ github.event_name }}&issue=${{ github.event.issue.number || '' }}" \ + -H "Authorization: Bearer ${TRIGGER_SECRET}") + cat /tmp/response.json + if [ "$HTTP_CODE" = "429" ]; then + echo "Cycle already running, skipping" + elif [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then + echo "Triggered successfully" + else + echo "Failed with HTTP $HTTP_CODE" + exit 1 + fi