From 1c4fc96d33413efdae0223a3b7db0cab2a14bcec Mon Sep 17 00:00:00 2001 From: Tam Nhu Tran Date: Sun, 29 Mar 2026 12:21:28 -0400 Subject: [PATCH] fix(ai-review): increase turn budget and improve fallback extraction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Increase per-reviewer max-turns 25→40 (security review hit limit on large PRs like codex runtime with ~5000 line diff) - Increase orchestrator max-turns 15→20 - Improve fallback extraction: concatenate ALL assistant messages (not just last) when reviewer hits turn limit without writing output file - Add descriptive prefix to fallback output explaining why extraction was needed (e.g., "hit turn limit", "no execution log") - Ensures something meaningful is posted even when CI jobs fail --- .github/workflows/ai-review.yml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ai-review.yml b/.github/workflows/ai-review.yml index 4a4dd855..a8c9a0ab 100644 --- a/.github/workflows/ai-review.yml +++ b/.github/workflows/ai-review.yml @@ -282,19 +282,28 @@ jobs: --bare --model ${{ env.REVIEW_MODEL }} --permission-mode bypassPermissions - --max-turns 25 + --max-turns 40 - name: Fallback extraction if: always() && steps.claude-review.outcome != 'cancelled' run: | if [ -s "$REVIEW_OUTPUT_FILE" ]; then exit 0; fi EXEC_LOG="$RUNNER_TEMP/claude-execution-output.json" - if [ ! -f "$EXEC_LOG" ]; then echo "${{ matrix.name }} review not available." > "$REVIEW_OUTPUT_FILE"; exit 0; fi - EXTRACTED=$(jq -r '[.[] | select(.type == "assistant") | .message.content[]? | select(.type == "text") | .text] | last // empty' "$EXEC_LOG" 2>/dev/null || true) + if [ ! -f "$EXEC_LOG" ]; then + echo "> [!] ${{ matrix.name }} review: no execution log available." > "$REVIEW_OUTPUT_FILE" + exit 0 + fi + # Extract ALL assistant text messages (not just last) — captures partial analysis + # when max-turns is hit before the model writes the output file + EXTRACTED=$(jq -r '[.[] | select(.type == "assistant") | .message.content[]? | select(.type == "text") | .text] | join("\n\n---\n\n") // empty' "$EXEC_LOG" 2>/dev/null || true) if [ -n "$EXTRACTED" ]; then - printf '%s\n' "$EXTRACTED" > "$REVIEW_OUTPUT_FILE" + { + echo "> [!] ${{ matrix.name }} review: extracted from execution log (reviewer did not write output file — likely hit turn limit)." + echo "" + printf '%s\n' "$EXTRACTED" + } > "$REVIEW_OUTPUT_FILE" else - echo "${{ matrix.name }} review produced no output." > "$REVIEW_OUTPUT_FILE" + echo "> [!] ${{ matrix.name }} review: execution completed but produced no extractable text." > "$REVIEW_OUTPUT_FILE" fi - name: Upload review output @@ -464,7 +473,7 @@ jobs: --bare --model ${{ env.REVIEW_MODEL }} --permission-mode bypassPermissions - --max-turns 15 + --max-turns 20 - name: Fallback merge (if orchestrator fails) if: always() && steps.claude-merge.outcome != 'cancelled'