Skip to content

Forward ANTHROPIC_BASE_URL to the Claude Adapter Review action - #45

Merged
crystalxyz merged 2 commits into
mainfrom
fix/ai-review-anthropic-base-url
Oct 23, 2026
Merged

crystalxyz merged 2 commits into
mainfrom
fix/ai-review-anthropic-base-url

Conversation

@crystalxyz

@crystalxyz crystalxyz commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Auth routing: the ai-review job's Claude Code call (run 39882363469 / job 120229028100) was failing authentication near-instantly ($0 cost, is_error: true) because the ANTHROPIC_API_KEY secret is a parity-gateway key (2077AI / New API), not a native sk-ant-... key, so requests must be routed through a custom base URL instead of api.anthropic.com. claude-code-action only forwards ANTHROPIC_BASE_URL from the job/workflow-level env: context (its internal run step's own env: block shadows anything set on the calling step), so it's declared at the job level here.
  • Retry transient GitHub API errors: a later run of the same workflow (job 120233656017) failed the "Check PR head before AI review" step on a bare GET /pulls/36 503 from the GitHub API — not rate limiting (4998/5000 remaining), just a transient blip. That actions/github-script step had retries: 0, so one blip killed the whole job. Set retries: 3 so it survives these.

Required follow-up (not part of this diff)

Set the ANTHROPIC_BASE_URL secret (or repo variable) on this repo to the parity gateway URL for the review job to actually succeed.

Test plan

  • Set ANTHROPIC_BASE_URL secret on the repo
  • Re-trigger /review-adapter on an open adapter PR and confirm the ai-review job completes instead of failing with "Claude did not return structured_output"
  • Confirm the PR-head freshness check no longer fails outright on a single transient GitHub API error

🤖 Generated with Claude Code

crystalxyz and others added 2 commits October 23, 2026 00:04
The ai-review job's Claude Code call fails authentication because the
ANTHROPIC_API_KEY secret is a parity-gateway key (2077AI/New API), not
a native Anthropic key, so it must be routed through ANTHROPIC_BASE_URL.
The claude-code-action only forwards this var from the job/workflow-level
env context (its internal run step's own env: block shadows anything set
on the calling step), so it has to be declared at the job level here.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Run 39882363469 (job 120233656017) failed the ai-review job on a bare
GET /pulls/36 503 from the GitHub API, not rate limiting (4998/5000
remaining) or anything PR-specific — just a transient blip the
actions/github-script step had no retry margin for (default retries: 0).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@crystalxyz
crystalxyz merged commit cfe10f2 into main Oct 23, 2026
1 check 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.

1 participant