Skip to content

ci(review): claude-review proves a review is on the PR; skips drafts and fork heads (ADR-0033) - #160

Merged
gonzafg2 merged 2 commits into
mainfrom
ci/claude-review-proof
Sep 23, 2026
Merged

gonzafg2 merged 2 commits into
mainfrom
ci/claude-review-proof

Conversation

@gonzafg2

@gonzafg2 gonzafg2 commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

Summary

claude-review goes green only when the PR actually has a Claude review: a final step counts comments and reviews by claude[bot] on the PR and fails the job when there are none. The job also stops running on draft PRs and on PRs whose head lives in a fork. ADR-0033 records the rule for all three reviewers.

Motivation

The action exits 0 whether or not the agent posted a report. Today the check was green with no review three times, for three reasons: a draft PR (#155 — the plugin stops by design), a PR it had already reviewed (#157, later pushes — it reviews once per PR), and #158, where the agent ended its turn after 56 s with "Both agents are running. I'll wait for them to complete" while its subagents were still running. The workflow could not tell the third from the first two. ADR-0032 closed the same gap for opencode; this applies the same rule to Claude and records that Codex's post job already satisfies it by construction.

Because the plugin reviews a PR once, the count is over the whole PR, not since the run started: green means this PR has a Claude review, not this push was reviewed. ADR-0033 says so instead of pretending otherwise; Codex and opencode do re-review every push.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that changes existing behaviour)
  • Documentation only
  • Refactor / chore / CI / build

Checklist

  • My commits are signed off under the
    Developer Certificate of Origin
    (git commit -s).
  • My commit messages follow Conventional Commits.
  • I have run cargo fmt --all and cargo clippy --workspace --all-targets -- -D warnings locally. (N/A: no Rust; actionlint passes.)
  • I have added or updated tests where appropriate. (N/A)
  • I have updated documentation (rustdoc, docs/, or README.md) where appropriate.
  • I have added a CHANGELOG.md entry under ## [Unreleased] if this change is user-visible. (N/A)
  • If this change introduces a new dependency, I have justified it in the PR description and verified it passes cargo deny check. (N/A)

Security considerations

The fork-head gate keeps a collaborator's fork PR from being checked out next to CLAUDE_CODE_OAUTH_TOKEN, the same gate codex.yml and opencode.yml apply. Every ${{ }} in the new run: enters through env:. Permissions unchanged.

Notes for reviewers

Automated reviews

PRs authored by dependabot[bot] (and other bots) do not trigger opencode, Claude Code Review or codex.
They are covered by CI (commit-lint, build, cargo deny, openssh-interop; cargo audit runs weekly) and manual review when needed.

https://claude.ai/code/session_018UmL9wcgKBGFjdjGSSLafa

@github-actions

Copy link
Copy Markdown

Reviewer: Codex (openai/codex-action, model gpt-5.6-terra)

PR Review: ci(review): claude-review proves a review is on the PR; skips drafts and fork heads (ADR-0033) (#160)

Decision: 🟡 Minor changes
Iteration: First review
Lenses applied: CI/workflow supply-chain and authorization controls; ADR design decision

Executive summary

The workflow pins its actions, retains least-privilege permissions, and correctly gates draft and fork heads before checkout. The proof step’s whole-PR counting semantics are coherently documented and match the Claude plugin’s once-per-PR behavior. However, the proposed ADR lifecycle conflicts with the repository’s ADR process.

New findings

🟡 Important (should be resolved)

docs/adr/0033-proof-of-review-for-every-automated-reviewer.md:3 — ADR governance (confidence: 85)

Problem: The ADR is intended to remain Proposed after merge and be flipped later, but the ADR catalog’s process says an ADR is accepted on merge and is then load-bearing. Leaving this decision non-terminal after its implementation lands makes the authoritative status disagree with the operational policy.

Fix: Mark ADR-0033 Accepted as part of the merge process, or update the ADR process through its own governed decision before relying on a deferred status change.

Anchor: docs/adr/README.md:117 — “On merge, the ADR is Accepted.”

gonzafg2 added a commit that referenced this pull request Sep 22, 2026
On #160 the action skipped itself: it refuses to run a workflow file
that differs from the one on main ("Skipping action due to workflow
validation") and exits 0 without a transcript. The proof step failed
correctly, but its message pointed at the transcript artifact, which
does not exist in that case. It now checks for the transcript first
and, when there is none, says that a PR editing this workflow cannot
get a Claude review before merge and is red on purpose. ADR-0033
records the case as the fourth way a green check carried no review.

Claude-Session: https://claude.ai/code/session_018UmL9wcgKBGFjdjGSSLafa
Signed-off-by: Gonzalo Fleming <[email protected]>
@github-actions

Copy link
Copy Markdown

Reviewer: Codex (openai/codex-action, model gpt-5.6-terra)

PR Review: ci(review): claude-review proves a review is on the PR; skips drafts and fork heads (ADR-0033) (#160)

Decision: 🟡 Minor changes
Iteration: Review #2 (0 resolved, 1 open)
Lenses applied: CI/workflow supply-chain and authorization controls; ADR design decision

Executive summary

The workflow actions are full-SHA pinned, permissions remain narrowly scoped, and the author, fork-head, and draft gates protect the credential-bearing checkout path. The proof step is coherent with the reviewer’s once-per-PR behavior. The prior ADR governance issue remains unresolved.

Previous issues

# Issue Status Notes
1 ADR-0033 is intended to remain Proposed after its implementation merges, contrary to the ADR process requiring acceptance on merge. ❌ Still Proposed at docs/adr/0033-proof-of-review-for-every-automated-reviewer.md:3. Anchor: docs/adr/README.md process step 5 — “On merge, the ADR is Accepted.”

@gonzafg2

Copy link
Copy Markdown
Owner Author

Re Codex review #1, ADR-0033 Status: Proposed on merge with a follow-up flip is this repository's practice since the #86 sweep — ADR-0030, ADR-0031 and ADR-0032 all merged Proposed and were flipped together in #158 — and #159 (open) amends docs/adr/README.md step 5 to say exactly that, so the anchor you cite is being brought in line with the practice rather than the other way round. ADR-0033 follows the same path; no change here.

Also for the record: this PR's own claude-review is red by design. The action refuses to run a workflow file that differs from main ("Skipping action due to workflow validation") and exits 0 without a transcript; the second commit makes the proof step name that case instead of pointing at a transcript that does not exist, and ADR-0033 records it as the fourth way a green check carried no review.

@opencode-agent

Copy link
Copy Markdown

PR Review: ci(review): claude-review proves a review is on the PR; skips drafts and fork heads (ADR-0033) (#160)

Decision: 🟡 Minor changes
Iteration: Review #3 (0 resolved, 1 open)
Lenses applied: CI/workflow supply-chain and authorization controls; design decision (docs/adr/0033)

Executive summary

The workflow change is sound and, unusually for CI, verified in production: run 35791888108 on 37771dd fails exactly at the new transcript guard with "Skipping action due to workflow validation" in the preceding step, and claude[bot] is confirmed as the posting login on #157, so both branches of the proof step work as the ADR describes. Actions stay full-SHA pinned, the new script interpolates nothing (${{ }} all via env:), permissions are untouched, and ADR-0031 keeps claude-review advisory so the intentional red does not block. The only outstanding matter is the ADR's lifecycle, and the specific claim the PR uses to close it (#159) is not yet true on main.

Previous issues

# Issue Status Notes
1 ADR-0033 is intended to merge Proposed while docs/adr/README.md step 5 says "On merge, the ADR is Accepted." (codex reviews #1:22:13 and #2:22:22, confidence 85) ❌ Still Status: Proposed at 0033…:3. The author's rebuttal (22:22:30) rests on the practice the #86/#158 sweeps established and on #159 amending step 5. The practice is real (544e756 flipped 0030/0031/0032 from Proposed), but the anchor on main still reads "On merge, the ADR is Accepted."

New findings

🟡 Important (should be resolved)

docs/adr/0033-proof-of-review-for-every-automated-reviewer.md:3 — process accuracy (confidence: 82)

Problem: The PR description justifies merging with Status: Proposed "per docs/adr/README.md step 5 as amended in #159", but #159 is still open (state: open, merged_at: null, head 86bf21c). Its patch to docs/adr/README.md replaces the step-5 sentence with the deferred-flip rule, and that patch is not in main. So the sentence that resolves the issue above is not authoritative yet: if #160 merges before #159, main carries ADR-0033 Proposed against a process document that still says acceptance is automatic on merge — the exact inconsistency codex flagged, now backed by a citation that does not yet exist. This is distinct from that earlier issue: the defect is the false premise in the description, not the Proposed status itself.
Fix: Make the ordering explicit — merge #159 first, or add the one-paragraph README.md amendment to this PR and drop the as amended in #159 clause. Either way the ADR should not claim a process document says something it does not.
Anchor: docs/adr/README.md:117 — "On merge, the ADR is Accepted."; CLAUDE.md § RFC vs ADR vs plain PR (the ADR process is authoritative, not the plan/description).

Notes on the workflow change (no finding)

  • claude[bot] is the correct login: the review and inline comment on ci(review): opencode via OpenCode Go with the model in OPENCODE_MODEL and proof of review (ADR-0032) #157 are both posted as claude[bot], so the count() filter matches real output.
  • The fork-head gate at claude-code-review.yml:15-17 matches the shape codex.yml and opencode.yml apply; it only narrows the pre-existing same-repo collaborator exposure that ADR-0030 §Negative already accepts.
  • The transcript guard at claude-code-review.yml:94 reproduces the documented third-party skip behaviour exactly, so the "red by design" narrative for this PR is corroborated rather than asserted.
  • Commit verification, for the record: the GitHub API reports .commit.verification.verified: true for both commits (1f7d97a, 37771dd); git log --format=%G? on this runner cannot decide that, so it was not used.

github run

@gonzafg2

Copy link
Copy Markdown
Owner Author

Re opencode review #1, the as amended in #159 premise: correct, #159 is open and main's README step 5 still says acceptance is automatic on merge. The description now states the ordering explicitly — #159 merges before this PR — and no longer cites the amendment as if it were in main. ADR-0033 itself makes no such claim; the practice it follows (Proposed on merge, flipped in a follow-up) is the one ADR-0030/0031/0032 took through #158.

@github-actions

Copy link
Copy Markdown

Reviewer: Codex (openai/codex-action, model gpt-5.6-terra)

PR Review: ci(review): claude-review proves a review is on the PR; skips drafts and fork heads (ADR-0033) (#160)

Decision: 🟢 Approved
Iteration: Review #4 (2 resolved, 0 open)
Lenses applied: CI/workflow supply-chain and authorization controls; ADR design decision

Executive summary

The workflow retains full-SHA action pins and least-privilege permissions, while adding same-repository-head and non-draft gates before the credential-bearing checkout. Its proof step safely passes GitHub context through environment variables and fails a successful-but-silent Claude run as ADR-0033 specifies.

Previous issues

# Issue Status Notes
1 ADR-0033 was proposed to merge with Status: Proposed despite the ADR process requiring acceptance on merge. ✅ docs/adr/README.md now explicitly permits a Proposed ADR to be flipped to Accepted in a follow-up.
2 The description previously treated the pending #159 process amendment as though it were already authoritative on main. ✅ The description now accurately states the required merge ordering and no longer claims the amendment is already present.

No new findings meet the reporting threshold.

…and fork heads (ADR-0033)

The action exits 0 whether or not the agent posted a report. On
2026-09-22 the check was green with no review three times: on a draft
(the plugin stops by design), on a PR it had already reviewed (it
reviews once per PR), and on #158, where the agent ended its turn
after 56 s saying it would wait for its subagents. Nothing in the
workflow could tell the last one apart from the first two.

A final step now counts the general comments, inline comments and
reviews on the PR by claude[bot] (or anthropic-code-agent[bot]) and
fails the job when there are none. The count is over the whole PR
because the plugin posts once per PR: green means the PR has a Claude
review, not that this push was reviewed, and the workflow says so.
The job no longer runs on drafts, and skips PRs whose head lives in a
fork, the gate codex.yml and opencode.yml already apply.

ADR-0033 records the rule for all three reviewers: opencode's proof
step is ADR-0032's, and Codex's post job posts the report itself.

Claude-Session: https://claude.ai/code/session_018UmL9wcgKBGFjdjGSSLafa
Signed-off-by: Gonzalo Fleming <[email protected]>
On #160 the action skipped itself: it refuses to run a workflow file
that differs from the one on main ("Skipping action due to workflow
validation") and exits 0 without a transcript. The proof step failed
correctly, but its message pointed at the transcript artifact, which
does not exist in that case. It now checks for the transcript first
and, when there is none, says that a PR editing this workflow cannot
get a Claude review before merge and is red on purpose. ADR-0033
records the case as the fourth way a green check carried no review.

Claude-Session: https://claude.ai/code/session_018UmL9wcgKBGFjdjGSSLafa
Signed-off-by: Gonzalo Fleming <[email protected]>
@gonzafg2
gonzafg2 force-pushed the ci/claude-review-proof branch from e7acb29 to ef34abf Compare September 23, 2026 01:13
@opencode-agent

Copy link
Copy Markdown

PR Review: ci(review): claude-review proves a review is on the PR; skips drafts and fork heads (ADR-0033) (#160)

Decision: 🟡 Minor changes
Iteration: Review #4 (2 resolved, 0 open)
Lenses applied: CI/workflow supply-chain and authorization controls; design decision (docs/adr/0033)

Executive summary

The PR makes the Claude reviewer's green check prove a report exists, adds draft and same-repo-head gates before the credential-bearing checkout, and records ADR-0033. The workflow is SHA-pinned, interpolation-free (${{ }} all via env:), and least-privilege; the two earlier governance objections are now resolved because main (via #159) amended the ADR process to permit a Proposed-on-merge with a deferred flip. One soundness gap remains: the whole-PR count keys on the claude[bot] login, which the separate @claude workflow also posts as, so the check can go green without a code review ever having run.

Previous issues

# Issue Status Notes
1 ADR-0033 intended to merge Proposed while docs/adr/README.md step 5 said "On merge, the ADR is Accepted." (codex #1:22:13, #2:22:22, confidence 85) ✅ main now carries #159 (d315462), which rewrote step 5 to docs/adr/README.md:117-124: the file "may merge … still reading Proposed" and the Status line is flipped in a follow-up. The branch merged main in e7acb29; the inconsistency is gone.
2 The description justified Proposed via #159 while #159 was open, so the citation did not exist on main. (opencode #3:22:25, confidence 82) ✅ #159 is merged (d315462) and the description now states the merge order explicitly. The premise is true.

New findings

🟡 Important (should be resolved)

.github/workflows/claude-code-review.yml:100-104 — design soundness / proof-of-review (confidence: 85)

Problem: The proof step's guarantee is "a green check means this PR has a Claude review" (docs/adr/0033-proof-of-review-for-every-automated-reviewer.md:44-52), but the implementation counts any comment or review on the PR whose user.login is claude[bot]/anthropic-code-agent[bot], with no filter on which workflow posted it. The separate, live .github/workflows/claude.yml (name: Claude Code) runs the same anthropics/claude-code-action with the same CLAUDE_CODE_OAUTH_TOKEN (claude.yml:40-42) and posts as claude[bot] on any @claude mention. A collaborator's @claude comment on a PR therefore lands in issues/$PR/comments — one of the three endpoints counted — and satisfies the proof even when the code-review action posted nothing. That is precisely the #158 silent-failure case ADR-0033 exists to catch, so the check can be green with no review, falsifying the stated guarantee. ADR-0032 scoped its proof to this run's URL to defeat exactly this class of cross-run contamination; ADR-0033 drops that discipline and replaces it with nothing, and never mentions claude.yml.
Fix: Tie the count to an artifact unique to the review workflow — e.g. require the comment/review body to begin with the report marker (## PR Review:, per REVIEW-FORMAT.md), or have the review step post its own marker and filter on it. If identity-only counting is kept, ADR-0033 must disclose that an @claude reply can satisfy the proof.
Anchor: CLAUDE.md § RFC vs ADR vs plain PR (an ADR's recorded decision must be coherent with its stated guarantee); ADR-0032 §Decision (proof scoped to the run, the sibling mechanism ADR-0033 claims to generalise).

💡 Suggestions (nice to have)

  • docs/adr/0033-proof-of-review-for-every-automated-reviewer.md:10-11: the Context says .github/REVIEW-FORMAT.md "tells maintainers to read those reports before merging"; that file addresses the reviewers ("The report contract for the automated reviewers", REVIEW-FORMAT.md:3-6) and carries no maintainer instruction — rephrase or cite the document that does.

github run

@github-actions

Copy link
Copy Markdown

Reviewer: Codex (openai/codex-action, model gpt-5.6-terra)

PR Review: ci(review): claude-review proves a review is on the PR; skips drafts and fork heads (ADR-0033) (#160)

Decision: 🟢 Approved
Iteration: Review #5 (2 resolved, 0 open)
Lenses applied: CI/workflow supply-chain and authorization controls; design decision (ADR-0033)

Executive summary

The workflow retains full-SHA action pins and least-privilege permissions, while adding draft and same-repository-head gates before the credential-bearing checkout. Its proof step uses GitHub context through environment variables and correctly makes a successful-but-silent Claude invocation fail, as ADR-0033 specifies.

Previous issues

# Issue Status Notes
1 ADR-0033 was proposed to merge with Status: Proposed despite the ADR process requiring acceptance on merge. ✅ docs/adr/README.md now expressly permits a proposed ADR’s status to be flipped to Accepted in a follow-up.
2 The description previously treated the pending process amendment as though it were already authoritative on main. ✅ The description now states the required merge ordering accurately.

No new findings meet the reporting threshold.

@gonzafg2
gonzafg2 merged commit aee4120 into main Sep 23, 2026
12 of 13 checks passed
@gonzafg2
gonzafg2 deleted the ci/claude-review-proof branch September 23, 2026 01:17
@opencode-agent

Copy link
Copy Markdown

PR Review: ci(review): claude-review proves a review is on the PR; skips drafts and fork heads (ADR-0033) (#160)

Decision: 🟡 Minor changes
Iteration: Review #5 (2 resolved, 2 open)
Lenses applied: CI/workflow supply-chain and authorization controls; design decision (docs/adr/0033)

Executive summary

The PR adds draft and same-repository-head gates before the credential-bearing checkout, and a final step that fails claude-review when the action succeeded but left no report, recording the rule in ADR-0033. The workflow is full-SHA pinned, the new run: interpolates nothing (all values via env:), and the two earlier governance objections are resolved now that #159 is on main. One substantive gap remains open from the previous review: the proof keys on the claude[bot] login, which the separate @claude workflow also posts as, so the check can go green without the code review ever having run.

Previous issues

# Issue Status Notes
1 ADR-0033 was to merge Proposed against a docs/adr/README.md step 5 that made acceptance automatic on merge (codex #1:22:13, #2:22:22). ✅ main now carries #159 (d315462, merged 01:05Z), which rewrote README.md:117-124 to permit a Proposed-on-merge flipped in a follow-up; the branch is based on it (baseRefOid=d315462).
2 The description justified Proposed via a #159 amendment that was not yet authoritative on main (opencode 22:25, conf 82). ✅ #159 is merged and the description now states the required ordering.
3 The proof step counts any claude[bot]/anthropic-code-agent[bot] comment or review, but .github/workflows/claude.yml (the @claude handler) runs the same action and posts as the same login, so a mention reply satisfies the proof with no review (opencode 01:13, conf 85). ❌ Count is still identity-only at claude-code-review.yml:100-109; ADR §Decision (0033…:44-55) still states the guarantee without disclosing the collision. No author response.
4 ADR Context says .github/REVIEW-FORMAT.md "tells maintainers to read those reports before merging"; the file addresses reviewers (opencode 01:13 suggestion). ❌ Unchanged at 0033…:10-11; REVIEW-FORMAT.md:3-6 calls itself "the report contract for the automated reviewers".

New findings

No new finding reaches the Important threshold. The open issue #3 above is the one substantive gap; on this iteration I confirmed it independently, and it is stronger than when raised:

  • Both workflows pin the same action SHA (4036a180…, v1.0.230) and pass the same CLAUDE_CODE_OAUTH_TOKEN; the action's defaults are bot_id: 41898282, bot_name: claude[bot]. Run 35805404255 (claude.yml, issue_comment) logs BOT_NAME: claude[bot], App token successfully obtained.
  • In tag mode claude.yml calls issues.createComment on the PR before the review output exists, landing a claude[bot] comment in issues/$PR/comments — exactly the endpoint counted by claude-code-review.yml:106.
  • The same identity-only count also accepts an incomplete/error claude[bot] message from the code-review action itself, so the fix is the same: key the count on the report artifact (## PR Review: per REVIEW-FORMAT, or the plugin's own marker) rather than on the login.
  • Anchor: ADR-0032 §Decision scopes its proof to comments "that carry this run's URL" for precisely this cross-source contamination; CLAUDE.md § RFC vs ADR vs plain PR (the ADR must record the decision actually implemented).

Note: the action does not expose skipped_due_to_workflow_validation_mismatch as an output (it is an internal steps.run.outputs only), so inferring the skip from an empty execution_file is reasonable; no finding there.

💡 Suggestions (nice to have, both pre-existing — not introduced by this diff)

github run

@gonzafg2

Copy link
Copy Markdown
Owner Author

Re opencode review #5, the identity-only count: correct, and fixed in the follow-up commit. The proof step now counts general comments and reviews by claude[bot]/anthropic-code-agent[bot] whose body carries the REVIEW-FORMAT heading ## PR Review:, so an @claude reply from claude.yml or the action's own error message no longer satisfies it; inline comments alone never did carry the heading and are no longer counted. ADR-0033's Claude bullet states that the heading, not the login, is the proof, and names claude.yml as the reason.

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