Skip to content

Commit 68c6c67

Browse files
authored
Better retries when a sub-agent fails (#75)
Signed-off-by: Derek Misler <derek.misler@docker.com>
1 parent 4f28e4b commit 68c6c67

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

review-pr/action.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ runs:
562562
github-token: ${{ steps.resolve-token.outputs.token }}
563563
extra-args: ${{ inputs.model && format('--model={0}', inputs.model) || '' }}
564564
add-prompt-files: ${{ inputs.add-prompt-files }}
565+
max-retries: "0" # Disable retries — the review agent recovers internally (root falls back when sub-agents fail), so retrying the pipeline produces duplicate reviews
565566

566567
- name: Save reviewer memory
567568
if: always()
@@ -584,16 +585,25 @@ runs:
584585
REPOSITORY: ${{ github.repository }}
585586
EXIT_CODE: ${{ steps.run-review.outputs.exit-code }}
586587
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
588+
VERBOSE_LOG_FILE: ${{ steps.run-review.outputs.verbose-log-file }}
587589
run: |
588590
REVIEW_URL="https://github.com/$REPOSITORY/pull/$PR_NUMBER"
589591
echo "review-url=$REVIEW_URL" >> $GITHUB_OUTPUT
590592
591593
if [ "$EXIT_CODE" != "0" ]; then
592-
STATUS="❌ **Review failed** (exit code: $EXIT_CODE)"
593-
if ! gh api "repos/$REPOSITORY/issues/$PR_NUMBER/comments" \
594-
-f body="❌ **PR Review Failed** — The review agent encountered an error and could not complete the review. [View logs]($RUN_URL)." \
595-
2>&1; then
596-
echo "::warning::Failed to post fallback comment to PR"
594+
# Check if agent actually posted a review despite the error exit code.
595+
# This happens when a sub-agent fails (e.g., API overload) but the root
596+
# agent recovers and posts the review itself.
597+
if [ -n "$VERBOSE_LOG_FILE" ] && grep -qE 'pullrequestreview-[0-9]+' "$VERBOSE_LOG_FILE" 2>/dev/null; then
598+
echo "::warning::Agent exited $EXIT_CODE but a review was posted — treating as partial success"
599+
STATUS="⚠️ **Review completed with warnings** (exit code: $EXIT_CODE)"
600+
else
601+
STATUS="❌ **Review failed** (exit code: $EXIT_CODE)"
602+
if ! gh api "repos/$REPOSITORY/issues/$PR_NUMBER/comments" \
603+
-f body="❌ **PR Review Failed** — The review agent encountered an error and could not complete the review. [View logs]($RUN_URL)." \
604+
2>&1; then
605+
echo "::warning::Failed to post fallback comment to PR"
606+
fi
597607
fi
598608
else
599609
STATUS="✅ **Review completed**"

0 commit comments

Comments
 (0)