diff --git a/.github/workflows/docs_suggestions.yml b/.github/workflows/docs_suggestions.yml index df4807bd9441c6b48f5628d5b06ed6cdf8591f17..fb5716203bce2a6da700157582e2ecaa5642893d 100644 --- a/.github/workflows/docs_suggestions.yml +++ b/.github/workflows/docs_suggestions.yml @@ -70,7 +70,20 @@ jobs: - name: Install Droid CLI run: | - curl -fsSL https://app.factory.ai/cli | sh + # Retry with exponential backoff for transient network/auth issues + MAX_RETRIES=3 + for i in $(seq 1 "$MAX_RETRIES"); do + echo "Attempt $i of $MAX_RETRIES to install Droid CLI..." + if curl -fsSL https://app.factory.ai/cli | sh; then + echo "Droid CLI installed successfully" + break + fi + if [ "$i" -eq "$MAX_RETRIES" ]; then + echo "Failed to install Droid CLI after $MAX_RETRIES attempts" + exit 1 + fi + sleep $((i * 5)) + done echo "${HOME}/.local/bin" >> "$GITHUB_PATH" env: FACTORY_API_KEY: ${{ secrets.FACTORY_API_KEY }} @@ -100,12 +113,26 @@ jobs: OUTPUT_FILE=$(mktemp) - ./script/docs-suggest \ - --pr "${{ steps.pr.outputs.number }}" \ - --immediate \ - --preview \ - --output "$OUTPUT_FILE" \ - --verbose + # Retry with exponential backoff for transient Factory API failures + MAX_RETRIES=3 + for i in $(seq 1 "$MAX_RETRIES"); do + echo "Attempt $i of $MAX_RETRIES to analyze PR..." + if ./script/docs-suggest \ + --pr "${{ steps.pr.outputs.number }}" \ + --immediate \ + --preview \ + --output "$OUTPUT_FILE" \ + --verbose; then + echo "Analysis completed successfully" + break + fi + if [ "$i" -eq "$MAX_RETRIES" ]; then + echo "Analysis failed after $MAX_RETRIES attempts" + exit 1 + fi + echo "Retrying in $((i * 5)) seconds..." + sleep $((i * 5)) + done # Check if we got actionable suggestions (not "no updates needed") if grep -q "Documentation Suggestions" "$OUTPUT_FILE" && \ @@ -251,7 +278,20 @@ jobs: - name: Install Droid CLI run: | - curl -fsSL https://app.factory.ai/cli | sh + # Retry with exponential backoff for transient network/auth issues + MAX_RETRIES=3 + for i in $(seq 1 "$MAX_RETRIES"); do + echo "Attempt $i of $MAX_RETRIES to install Droid CLI..." + if curl -fsSL https://app.factory.ai/cli | sh; then + echo "Droid CLI installed successfully" + break + fi + if [ "$i" -eq "$MAX_RETRIES" ]; then + echo "Failed to install Droid CLI after $MAX_RETRIES attempts" + exit 1 + fi + sleep $((i * 5)) + done echo "${HOME}/.local/bin" >> "$GITHUB_PATH" env: FACTORY_API_KEY: ${{ secrets.FACTORY_API_KEY }} @@ -275,12 +315,26 @@ jobs: OUTPUT_FILE=$(mktemp) # Cherry-picks don't get preview callout - ./script/docs-suggest \ - --pr "${{ steps.pr.outputs.number }}" \ - --immediate \ - --no-preview \ - --output "$OUTPUT_FILE" \ - --verbose + # Retry with exponential backoff for transient Factory API failures + MAX_RETRIES=3 + for i in $(seq 1 "$MAX_RETRIES"); do + echo "Attempt $i of $MAX_RETRIES to analyze PR..." + if ./script/docs-suggest \ + --pr "${{ steps.pr.outputs.number }}" \ + --immediate \ + --no-preview \ + --output "$OUTPUT_FILE" \ + --verbose; then + echo "Analysis completed successfully" + break + fi + if [ "$i" -eq "$MAX_RETRIES" ]; then + echo "Analysis failed after $MAX_RETRIES attempts" + exit 1 + fi + echo "Retrying in $((i * 5)) seconds..." + sleep $((i * 5)) + done # Check if we got actionable suggestions if [ -s "$OUTPUT_FILE" ] && \