Skip to content
This repository was archived by the owner on Jul 30, 2026. It is now read-only.

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

Closed
giancolombi wants to merge 1 commit into
mainfrom
ci/claude-review-max-turns-80
Closed

ci(claude-review): raise max-turns to 80, make review non-blocking#65
giancolombi wants to merge 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

@greptile-apps

greptile-apps Bot commented Jun 16, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes the Claude Code Review action failing on non-trivial PRs by raising --max-turns from 30 to 80 and restructuring the timeout/error-handling guards so a turn-budget exhaustion or API error leaves the PR check green while still surfacing the failure via the sticky tracking comment.

  • --max-turns 80: gives the reviewer enough budget for large diffs; normal runs stay well under 30, so cost is unchanged.
  • Step-level timeout-minutes: 20 + continue-on-error: true: the previous job-level timeout cancelled the entire job (bypassing continue-on-error), red-X-ing the PR. Moving it to the step level means any failure is swallowed by continue-on-error while the outer 25-min job timeout acts only as a safety net for hangs in other steps.
  • The 25 > 20 minute hierarchy is intentional and correct: if the outer job timeout fired during the review step it would bypass continue-on-error, so it must always be larger than the step timeout.

Confidence Score: 5/5

Safe to merge — the change is scoped entirely to CI configuration and makes the review step non-blocking without removing any visibility into failures.

The three guards (higher turn budget, step-scoped timeout, continue-on-error) are well-reasoned and correctly ordered. The 25-min job ceiling sits above the 20-min step ceiling, preventing the outer timeout from ever firing during a normal review. No application logic is touched.

No files require special attention. The only substantive change is in .github/workflows/claude-review.yml, which is straightforward CI configuration.

Important Files Changed

Filename Overview
.github/workflows/claude-review.yml Core change: raises --max-turns 30→80, moves timeout-minutes from job to step level, adds continue-on-error: true. The 25-min job timeout correctly sits above the 20-min step timeout so it never fires on a normal review run.
.github/workflows/publish.yml Publish pipeline gates both npm and PyPI releases on the shared test.yml suite. Action references use floating tags (v5/v6) rather than SHA pins, but this appears to be a pre-existing pattern not introduced by this PR.
.github/workflows/test.yml Test matrix for Node (22, 24) and Python (3.12, 3.13) with workflow_call hook so publish.yml can reuse it as a gate. No issues identified.
node/src/api-client.ts Comprehensive API client with retry logic, chunked sessions, backfill handling, and configurable timeouts via environment variables. No issues identified in this read.
node/src/utils/vcs.ts Async git wrapper for computing VCS-local-only paths with fail-safe returns and shallow-clone detection. Logic is well-documented and defensively written.

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

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>
@giancolombi
giancolombi force-pushed the ci/claude-review-max-turns-80 branch from 5fdc980 to 604b9ed Compare June 16, 2026 19:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant