Skip to content

ci(claude-review): raise max-turns to 80, make review non-blocking - #66

Merged
prodcyclebot merged 1 commit into
mainfrom
ci/claude-review-max-turns-80
Jun 16, 2026
Merged

ci(claude-review): raise max-turns to 80, make review non-blocking#66
prodcyclebot merged 1 commit into
mainfrom
ci/claude-review-max-turns-80

Conversation

@giancolombi

Copy link
Copy Markdown
Contributor

Problem

The Claude Code Review action has been failing across the org on non-trivial PRs:

"subtype": "error_max_turns", "num_turns": 31
error: Claude Code returned an error result: Reached maximum number of turns (30)
##[error]Process completed with exit code 1.

Root cause

The review reads the diff + CLAUDE.md + the changed files and posts one inline comment per finding, so each read/finding is its own turn. On a larger PR the reviewer exhausts the --max-turns 30 budget before it can finish; the SDK returns error_max_turns and claude-code-action surfaces that as a hard failure (exit code 1) → a red X on the PR, even though the review is advisory.

Fix (three guards, all at the step level so continue-on-error actually covers them)

  1. --max-turns 30 → 80 — comfortable headroom over what a large review needs. Normal runs already finish well under 30, so cost is unchanged.
  2. timeout-minutes moved from the job to the claude step — a job-level timeout cancels the whole job and red-Xes the PR regardless of continue-on-error; a step-level timeout is a step failure that continue-on-error can swallow. 20 min stays the wall-clock/cost bound.
  3. continue-on-error: true — a max-turns exhaustion, the step timeout, or a transient API error all leave the posted inline comments + the track_progress sticky comment in place and the check stays green. The sticky comment still surfaces any error, so failures stay visible without blocking.

Context

This workflow is byte-identical across 10 org repos; this PR is part of an org-wide rollout. Canonical change & rationale: prodcycle/prodcycle#1554.

Note: this PR edits the review workflow itself, so claude-code-action's workflow-validation guard (which requires the workflow to match the default branch) will make this PR's own review step exit non-zero — continue-on-error keeps the check green. The fix is exercised normally once merged to main.

🤖 Generated with Claude Code

The Claude Code Review action fails on non-trivial PRs with:

  "subtype": "error_max_turns", "num_turns": 31
  error: Claude Code returned an error result: Reached maximum number of turns (30)
  ##[error]Process completed with exit code 1.

The review reads the diff + CLAUDE.md + the changed files and posts one
inline comment per finding, so a larger PR exhausts the 30-turn budget
before it can finish — the SDK returns error_max_turns and
claude-code-action surfaces it as a hard failure, red-X-ing the PR.

The review is advisory and must never block a PR:

  1. --max-turns 30 -> 80: comfortable headroom over what a large review
     needs. Normal runs finish well under 30, so cost is unchanged.
  2. Two-tier timeout. timeout-minutes: 20 on the claude STEP is the primary
     bound — a step timeout is a step failure that continue-on-error swallows,
     so even a maxed-out review stays green (a job-level timeout would cancel
     the whole job and red-X it regardless). A job-level timeout-minutes: 25
     stays ABOVE the step bound as an outer net for a hang in another step
     (e.g. checkout), so it never fires on a normal long review.
  3. continue-on-error: true: a max-turns exhaustion, the step timeout, or a
     transient API error all leave the posted inline comments + the
     track_progress sticky comment in place and the check stays green.

Part of an org-wide rollout; canonical change: prodcycle/prodcycle#1554.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Jun 16, 2026

Copy link
Copy Markdown

Greptile Summary

This PR makes the Claude Code review step non-blocking by adding continue-on-error: true, moving the timeout to the step level (20 min), raising the job-level timeout to 25 min as an outer safety net, and bumping --max-turns from 30 to 80. All three guards are correctly scoped to the step so a max-turns exhaustion, a step timeout, or a transient API error no longer red-Xs a PR.

  • continue-on-error: true and timeout-minutes: 20 on the step ensure any review failure is swallowed while the sticky track_progress comment keeps failures visible.
  • The job timeout (25 min) correctly stays above the step timeout (20 min) so it only fires on a hang in a non-Claude step (e.g. checkout) and never on a normal long review.
  • --max-turns 80 gives comfortable headroom for large diffs without materially changing cost on ordinary runs.

Confidence Score: 5/5

Safe to merge — the change is a straightforward CI hardening with no application code affected.

The three guards (continue-on-error, step-level timeout, higher max-turns) are all correctly placed and interact as intended. The job-level timeout is set above the step-level timeout so it genuinely only catches non-review hangs. No logic errors or unintended side effects found.

No files require special attention.

Important Files Changed

Filename Overview
.github/workflows/claude-review.yml Adds continue-on-error + step-level timeout, bumps job timeout to 25 min, raises --max-turns to 80 — all three guards correctly scoped to the step so advisory review failures never red-X the PR.

Reviews (1): Last reviewed commit: "ci(claude-review): raise max-turns to 80..." | Re-trigger Greptile

@prodcyclebot
prodcyclebot merged commit 8fd6e0a into main Jun 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants