Skip to content

Show Claude error in review workflow log on failure - #1587

Merged
yuryyas merged 1 commit into
mainfrom
claude_review_error_output
Nov 19, 2026
Merged

yuryyas merged 1 commit into
mainfrom
claude_review_error_output

Conversation

@yuryyas

@yuryyas yuryyas commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

The first real run of claude-review.yml (run 44572683228, PR #1586) failed with only this:

Claude result reported subtype success with is_error:true

claude-code-action hides Claude's output on public repos (show_full_output: false), and debug mode didn't reveal it either. The failure took 0.7 s with $0 cost and no tokens, so the API rejected the very first request: likely the key, credit/spend limit, or model access. The actual error text never reaches the log.

This PR adds one step that runs only when the review fails:

       - name: Claude review
+        id: claude
         uses: anthropics/claude-code-action@v1
       ...
+      - name: Show Claude error
+        if: failure() && steps.claude.outputs.execution_file != ''
+        run: |
+          jq: last assistant .error (e.g. authentication_failed, billing_error)
+              + last result: subtype, is_error, .errors[], .result (≤1000 chars)
+          print between ::stop-commands:: markers   # Claude text can't inject workflow commands
+          ::error title=Claude review failed::<one line, ≤500 chars>   # shows on the PR checks page

It prints only the error fields from the action's execution file, never the transcript, tool results or Jira content.

Evidence

Ran the step's script locally on a fake execution file:

assistant error: authentication_failed
result: success, is_error: true
Invalid API key · 100% sure
::warning::injected                  ← printed as text, not executed
::error title=Claude review failed::assistant error: authentication_failed result: success, is_error: true Invalid API key · 100%25 sure ...

Also checked: a max-turns result prints Reached maximum number of turns (40), and an empty file prints nothing and exits 0. The workflow YAML parses.

Not tested on GitHub yet: the action skips itself on a PR that changes its own workflow file (it must match main), so this only takes effect once merged. The next PR that triggers a review will then show the actual API error.

Merge Danger

Door: two-way. Revert to remove the step.

Blast Radius: failed-run logs.

  • Runs only on failure, and doesn't change how the review runs.
  • The repo is public, so the printed error is public. For API failures that's just Anthropic's error message. If a review fails partway (e.g. max turns), Claude's final message, up to 1000 chars, appears in the log. The prompt already tells Claude never to quote Jira content.

🤖 Generated with Claude Code

claude-code-action hides Claude's output on public repos, so a failed
review only says "result is_error:true". On failure, print the API/SDK
error and the final result text from the execution file, plus a job
annotation, without exposing the transcript.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@yuryyas
yuryyas requested a review from ari as a code owner November 19, 2026 17:22
@github-actions

Copy link
Copy Markdown

Unit Test Results

661 tests   658 ✔️  1m 39s ⏱️
  90 suites      3 💤
  90 files        0 ❌

Results for commit f912cda.

@yuryyas
yuryyas merged commit d00f9be into main Nov 19, 2026
6 checks passed
@yuryyas
yuryyas deleted the claude_review_error_output branch November 19, 2026 17:27
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.

1 participant