Skip to content

ci: add advisory AI PR review - #1

Merged
zyrona-labs merged 1 commit into
mainfrom
ci/ai-review
Oct 20, 2026
Merged

zyrona-labs merged 1 commit into
mainfrom
ci/ai-review

Conversation

@zyrona-labs

Copy link
Copy Markdown
Member

Adds a workflow that comments an advisory Claude review (claude-sonnet-5-5, output capped at 1500 tokens) when a PR is opened, reopened or marked ready. Skips forks, drafts and Dependabot. Uses the org secret ANTHROPIC_API_KEY; exits quietly if it is missing.

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@zyrona-labs
zyrona-labs merged commit 53467f7 into main Oct 20, 2026
1 check passed
@github-actions

Copy link
Copy Markdown

AI review (advisory)

Findings in .github/workflows/ai-review.yml:

  1. Line ~42, thinking: {type: "between_tools"}: This isn't a valid thinking configuration for the Messages API (valid types are enabled with a budget_tokens, or disabled). The request will likely 400 on every run. The continue-on-error masks this, so the workflow will silently never post a review.

  2. Line ~41, model: "claude-sonnet-5-5": This doesn't look like a valid model ID. Same silent-failure risk. Pin a known model ID or make it a repo variable.

  3. Lines ~47-50, error handling: With --fail-with-body, a non-2xx response makes curl exit non-zero, so the step aborts before the stop_reason fallback runs. Errors are never surfaced in the PR, only in logs, and continue-on-error hides the step failure.

  4. Line ~39, head -c 120000: This cuts mid-file and mid-line. The iconv -c call drops the broken UTF-8 sequence, but the model sees a partial hunk, which can produce bogus line citations or "bugs" at the cut point.

  5. Line ~29, git diff "$BASE...$HEAD": BASE is the base-branch tip at event time, not the merge base at PR creation, but the three-dot form handles that correctly. However, the diff is computed only on opened/reopened/ready_for_review, so new pushes are never reviewed, and the posted review can be stale. The missing synchronize trigger is likely unintentional if reviews are expected to track the PR.

  6. Line ~54, gh pr comment: A new comment is created per trigger (reopen, ready_for_review), with no update or dedupe, so repeated events spam the PR.

  7. Security (minor), prompt injection: The diff is attacker-influenced content fed to the model (same-repo branches only, so the exposure is limited to collaborators). Output is posted verbatim as a PR comment; worth noting if write access is broad. No secrets are exposed to the model beyond the diff itself.

  8. Missing tests: No validation of the workflow (e.g., actionlint, or a dry-run mode against a fixture diff) and no test of the jq request construction or the truncation/empty-response paths.

@ssahani
ssahani deleted the ci/ai-review branch November 20, 2026 16:37
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