Skip to content

ci: review PRs with the official Claude Code Action on Bedrock - #287

Merged
Atom-oh merged 5 commits into
devfrom
ci/claude-action-review
Nov 26, 2026
Merged

Atom-oh merged 5 commits into
devfrom
ci/claude-action-review

Conversation

@Atom-oh

@Atom-oh Atom-oh commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Replace the two-vendor panel and chair in the required AI Code Review check with the official Claude Code Action v1. Model calls keep the existing AWS review role, GitHub OIDC, Amazon Bedrock region and Claude model. Ordinary reviews run once. Large promotions use the same action across bounded portions of the exact Git diff, with at most four model jobs in progress.

The trusted workflow prepares literal-path patches and normalized HEAD images before model credentials are available. The model jobs have read-only repository permissions. The final job checks that every group passed and verifies the live PR base and head before posting the result. Missing coverage and major or critical findings block merging. The protected SHA-specific recovery environment is retained.

This change is reviewed by the existing workflow. Once it lands on dev, the next promotion event can review #278 using the official action.

Local checks covered exact Git paths, ordered page coverage, stale or incomplete results, known severities and branch context. Preparation also ran against the actual cumulative promotion diff. Live Bedrock verification belongs to the first run of the approved workflow on dev.

@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

🤖 AI Code Review (two independent reviewers)

Reviewer responses: batch 1/2: codex/ALL claude/ALL; batch 2/2: codex/ALL claude/ALL

Status: PASSED — No blocking issues found

Reviewed in 2 complete batches split at file boundaries; every batch must pass.

Batch 1/2 — PASS

Verification complete. The locally installed Claude CLI confirms every flag the new workflow passes (--json-schema, --tools, --setting-sources, --strict-mcp-config, --no-session-persistence, --permission-mode dontAsk); the base helpers (load_manifest, attachment_paths, strip_controls, scrub_secrets, review_context outputs) all exist with the signatures used. The action source itself could not be fetched from this sandbox (network blocked), which matters for adjudicating codex's sole MAJOR — addressed below.

PR #287 — Batch 1/2 Review (Chair Synthesis)

Summary

This batch replaces the two-vendor panel/chair review pipeline with the official anthropics/claude-code-action@v1 on Bedrock: a credential-free prepare job builds exact-commit patch pages and staged HEAD image evidence, a matrix claude job reviews each group with Read-only tools, and a gate job publishes the required check fail-closed. The security posture is in several ways improved (workflow-level permissions: {}, OIDC only in the model job, environment-gated recovery, no persisted git credentials, Read-only tool allowlist), and the fail-closed contract is preserved end-to-end. No confirmed CRITICAL/MAJOR finding survives verification; the remaining issues are reliability/robustness and documentation concerns, all of which fail closed rather than open.

Chair verification notes: image_coverage.load_manifest/attachment_paths and lib.sh's strip_controls/scrub_secrets exist in BASE as used; every CLI flag in claude_args exists in the installed Claude CLI; the validate() image-equality and per-group image-read behaviors claimed by the Claude panel are confirmed in the diff.

Issues per lens

L2 — Code correctness

Codex MAJOR (not adopted — unconfirmed, disputed): claude_verdict.py parses execution_file with a single json.loads(), allegedly breaking on a JSONL transcript. Only codex flagged this; the Claude panel analyzed the same code in depth without raising it and the action's documented behavior is to post-process the stream into a single JSON execution-log file (an array of parsed events — exactly the shape verify_reads iterates). I could not fetch the action source from this sandbox to settle it conclusively, so it is recorded as an unverified third-party-contract claim rather than a confirmed defect. Decisive for the gate: even if codex were right, the failure mode is json.loads raising → verdict step fails → gate publishes BLOCKED — strictly fail-closed and immediately visible on the first run, never a wrong PASS. Downgraded to MINOR with a required follow-up: add a fixture derived from a real execution_file produced by the pinned action version (the current test fabricates an in-memory list, so it cannot catch a format mismatch).

MINOR (downgraded from one model's MAJOR): validate() requires exact, order-sensitive equality between the model's images array and [image["file"] for image in index["images"]] (scripts/pr-review/claude_verdict.py). Confirmed in the diff. A model returning full paths or a different order blocks every image-touching PR. Mitigations: the model has the exact file strings in index.json, the failure is fail-closed and re-runnable, and verify_reads independently proves image inspection from tool results. Tighten the prompt to state the exact expected array (or compare basenames as a set). Only the Claude panel flagged this.

MINOR (downgraded from one model's MAJOR): every matrix group must re-Read every staged image. claude_scope.prepare copies manifest["images"] into every group's index.json, and verify_reads makes them all mandatory per group. On a large diff (~17 groups at 120 KiB/group) with the 32-image/8 MiB limits this duplicates Bedrock cost and risks context exhaustion — which again fails closed. Defensible as "each job independently proves PR-wide image coverage," but assigning images to one group (or a dedicated image group) would be cheaper and no weaker.

MINOR (both chairs' verification agrees with the Claude panel's set):

  • verify_reads skips falsy lines; a page of only blank lines would be marked complete on any successful unrelated tool_result. Latent (diff lines carry prefixes), but require ≥1 matched line.
  • Read limit is unconstrained when registering a candidate full read (caught later by line matching; cosmetic).
  • event["type"] indexed without .get() → a typeless transcript event raises KeyError instead of a diagnosable error (fail-closed).
  • write_text/read_text without encoding="utf-8" — latent locale dependency.
  • The prepare step's EXIT trap can overwrite the step's exit status with the codec-cleanup status (fail-closed but conflates causes).
  • New hard blocks with no merge route for ordinary binaries outside the suffix allowlist (.woff2, .jar, …) and for large generated files outside the four lockfile names / node_modules|dist|out|build parts — the retired ignorable() path handled these. All fail-closed.
  • The 40-page caps are unreachable dead code given MAX_FILE_BYTES/PAGE_BYTES.
  • gate has no timeout-minutes (inherits 360 min; the old job documented a 190-min budget).

Verified-correct and worth recording: --literal-pathspecs protects pathspec-special filenames (covered by test_claude_review.py, including :(glob)*.ts); all pages of one file stay in one group; pages() cannot loop or emit empty pages; the gate re-derives the comparison boundary from the live PR and refuses a changed boundary or stale HEAD; prepare/claude/gate fail-closed at every join (needs.claude.result is success only if all matrix legs succeed).

L3 — Security / AWS mutation safety

No ADR-005 surface is touched: no Terraform/IAM/agent/remediation/connector change, no AWS write path. The only AWS interaction is assuming the pre-existing AWS_CI_REVIEW_ROLE_ARN for Bedrock inside the environment-gated claude job (id-token: write only there; prepare/gate cannot assume the role). Both panels agree there is no mutation-freeze or IAM-scoping violation.

MINOR (both models flagged — strong agreement): anthropics/claude-code-action@v1 is a mutable tag used in a job holding Bedrock credentials and a repo token. Pin to a reviewed full commit SHA. Independent convergence makes this the highest-confidence suggestion in the review, but it is a hardening gap, not a violated rule in this repo's conventions.

MINOR (downgraded from one model's MAJOR): on the labeled-recovery path the action's cwd is the PR-head checkout, so head-controlled CLAUDE.md loads into the reviewing agent's context (--setting-sources user suppresses settings, not memory auto-discovery — confirmed against the installed CLI, where only --bare skips CLAUDE.md discovery). Downgraded because recovery is already, by documented design, "run CI code from the labeled exact-SHA head under protected-environment approval" — the verdict script itself is head code on that path, so the CLAUDE.md surface adds nothing outside the boundary a human reviewer approves. Mitigations: no Bash, Read restricted to ./review-packet/** and ./target-base/**, pull-requests: read, disableAllHooks, --strict-mcp-config. Still, run the action from a trusted-ref worktree (or --bare) on recovery as defense-in-depth.

MINOR (one model flagged, design-level): the merge gate is now a single model's structured self-report over untrusted diff text, with verify_reads coverage proof as the only mechanical cross-check — a real defense-in-depth reduction versus two independent vendors plus a chair. This is the PR's deliberate, CHANGELOG-documented purpose, not a rule violation; it should be stated as an accepted trade-off in the runbook (docs/runbooks/pr-review-head-images.md is in batch 2 — unverified cross-batch coverage).

MINOR: the complete scrubbed patch set plus staged images now persist as a 1-day Actions artifact (exposure matches existing repo-read access, but the old explicit no-persistence property is gone); exact repository paths now enter model context as JSON data where BASE used 200-char safe labels (low impact — the new gate parses no free-text markers and ensure_ascii=True escapes everything).

Positives verified: persist-credentials: false on all checkouts, python3 -I for the credentialed-phase verdict script, fork PRs excluded, the required-check name expression still mirrors the if: so ineligible events never publish the canonical check name, and gate run: blocks interpolate nothing (all inputs via env:).

L4 — Observability / data-integration correctness

No Steampipe, CIS, or AgentCore diagnosis logic changes in this batch — both panels agree. Evidence-pipeline integrity verified: prepare rejects any non-complete manifest or head/merge-base mismatch (so unavailable/omitted_entries → BLOCKED, never a silent gap); attachment_paths re-verifies every staged image's bytes/sha256; there is no truncation path — oversize input raises instead of banner-omitting, preserving the old fail-closed contract.

MINOR (one model): patch pages after the first lose diff --git/@@ headers (findings on later pages lack in-page line anchors); >1000-char lines are rewritten with injected [continued] markers (deliberate, but pages are not byte-faithful); generated/lockfile paths are represented only by git diff --raw plus a note, and --no-renames flattens rename lineage.

L5 — Docs/ADR consistency

CHANGELOG.md amends the existing feature-level entry in place in both English and Korean 1:1, with no PR/round numbers — compliant with the CLAUDE.md changelog rule. scripts/AGENTS.md/scripts/CLAUDE.md headers are refreshed and English-only. Both panels found no ADR contradiction.

MINOR (one model, verified plausible):

  • docs/runbooks/review-image-capability.md still describes the retired panel/chair gate and is in neither batch's change list — stale after merge.
  • README "Testing" sections (EN/KO) keep panel-era vocabulary; the structure check itself is reworked in batch 2 (tests/structure/test-pr-review-panel-prompt.sh — unverified cross-batch dependency).
  • "multi-AI panel" remains a documented ADR-005 unfreeze prerequisite (docs/decisions/023-…md, README). That is the governance panel, not this CI workflow, but the new docs should say so explicitly to avoid readers concluding the exception mechanism was removed.
  • The rewrite drops the v2/ci_review_access.py line (the script survives and still defines the trust subjects the new jobs rely on) and the --strict-mcp-config rationale (the flag survives and is test-asserted) — restore one line each.
  • The deleted "stage images before credentials" invariant test is satisfied more strongly by the new layout (staging in a job with no id-token), but test_claude_review.py doesn't assert it; add assertions that prepare holds no id-token/credentials step and extend the ${{-free-run check to prepare and gate.

Cross-batch dependencies (named, non-blocking per the cross-batch rule): scripts/v2/test_pr_review_pipeline.py, tests/structure/test-pr-review-panel-prompt.sh, tests/structure/test-pr-review-large-diff.sh (all pin removed workflow step ids / retired panel paths and must be updated), and docs/runbooks/pr-review-head-images.md (referenced by both rewritten context files) — all appear in the batch-2 path list, so each is plausibly provided there; batch 2's review must confirm.

Suggestions

  1. Pin anthropics/claude-code-action to a full commit SHA (both models converged on this).
  2. Add a verdict-parser fixture generated from a real execution_file of the pinned action version, settling the JSONL-vs-array question mechanically.
  3. State the exact expected images array in the review prompt (or compare basenames as a set) so image PRs don't depend on the model echoing the manifest order.
  4. Assign staged images to a single group instead of requiring every group to re-read all of them.
  5. On the recovery path, run the action from a trusted-ref/target-base worktree or with --bare so head CLAUDE.md cannot enter the reviewer's context.
  6. Add timeout-minutes to gate, encoding="utf-8" to the page IO, and a ≥1-matched-line requirement in verify_reads.
  7. Refresh docs/runbooks/review-image-capability.md and the README testing sections; restore one-line docs for ci_review_access.py and the --strict-mcp-config rationale; clarify that "multi-AI panel" in ADR-005/ADR-023 governance is distinct from this CI workflow.

Verdict

The image manifest is complete with zero images, zero deletions, and zero unavailable/omitted entries, so no pixel inspection is required; both panel cells declared the same.

IMAGE_COVERAGE: NOT_REQUIRED

Codex's sole MAJOR is unconfirmed, contradicted by the action's known execution-file contract, and fail-closed in the worst case; every MAJOR from the Claude panel was verified in the diff but downgraded as fail-closed reliability/defense-in-depth concerns rather than correctness or policy violations. No confirmed CRITICAL/MAJOR remains in this batch; the PR still requires batch 2 to pass.

Batch 2/2 — PASS

All verification complete. Here is my synthesized chair review.


Chair synthesis — PR #287, batch 2 of 2 (tests/structure rewrites, pipeline-test deletions, runbook rewrites)

Summary

This batch deletes the workflow-text-parsing tests in scripts/v2/test_pr_review_pipeline.py, rewrites the two tests/structure/ guard scripts around the new three-job (prepare/claude/gate) workflow and scripts/pr-review/claude_scope.py, and rewrites four runbooks plus the generated docs/runbooks/AGENTS.md for the official Claude Code Action on Bedrock. The panels disagreed sharply — Codex reported zero findings in all lenses, while Claude reported four MAJORs — but every Claude MAJOR turns on the contents of batch-1 files (.github/workflows/pr-review.yml, claude_scope.py, claude_verdict.py, test_claude_review.py), all of which are explicitly listed in the other-batch path header and are reviewed directly in batch 1; none is a demonstrable defect in this batch's resulting code. I verified against BASE that the batch is internally coherent (the deleted tests parsed the old single-review-job workflow that batch 1 replaces; scripts/v2/test_pr_review_context.py exists, so the runbook's verification command is valid) and found no confirmed CRITICAL/MAJOR, with several confirmed MINORs.

Issues per lens

L2 — Code correctness

No confirmed CRITICAL/MAJOR. (One model flagged two MAJORs; the other flagged none.)

  • Unverified cross-batch dependency (Claude flagged MAJOR; downgraded) — tests/structure/test-pr-review-large-diff.sh:9-36 asserts a specific shape of the batch-1 workflow: "ci-review-recovery" in job["environment"] (requires the string form — BASE .github/workflows/pr-review.yml:45-46 uses the mapping form, under which in tests dict keys and the assertion fails), model["needs"] == "prepare" (rejects the equivalent list form), direct prepare["permissions"] indexing, and exact-dict permission equality. I confirmed batch 1 fully restructures the workflow (BASE has a single review job; the test expects prepare/claude/gate), so whether these assertions match is decidable only in batch 1. Crucially, every one of these fails closed: a mismatch makes bash tests/run-all.sh (a required check) fail loudly, so the worst case is a visibly broken structure test, not a silent false pass. Reported as an unverified cross-batch dependency on .github/workflows/pr-review.yml; batch 1 must confirm the workflow uses the string-form environment, string needs, and unquoted boolean/integer scalars the test demands.
  • MINOR (confirmed, one model) — Vacuous checkout assertions: the ref/persist-credentials checks in test-pr-review-large-diff.sh only run for steps whose uses starts with actions/checkout@; a job with no checkout step passes silently. Add an explicit "checkout step exists" assertion per job.
  • MINOR (confirmed, one model) — TAP regression: tests/CLAUDE.md mandates TAP ok N - desc output, and both rewritten scripts drop their per-check pass/fail TAP lines and comment-prefixed diagnostics; tests/run-all.sh still wraps each script at suite granularity, so aggregation survives, but a failure now surfaces as a bare traceback instead of a named contract.
  • MINOR (confirmed, one model) — New hard PyYAML dependency in the tests/structure/ lane. Verified: PyYAML is pinned in scripts/v2/requirements-test.txt:3 and already required by other mandatory suites, so the documented CI environment has it, but tests/CLAUDE.md lists only Python 3.12 + Pillow for this lane and the heredoc has no importability guard (contrast tests/run-all.sh:45's pytest guard).
  • MINOR (confirmed) — re and textwrap imports in scripts/v2/test_pr_review_pipeline.py lose all users with the deleted hunks; cosmetic (no linter configured).

L3 — Security / AWS mutation safety

No confirmed CRITICAL/MAJOR; no violation of the ADR-005 frozen-mutation posture; no hardcoded secrets (the role stays ${{ secrets.AWS_CI_REVIEW_ROLE_ARN }}). (One model flagged three MAJORs; the other flagged none — I adjudicated each against the resulting code.)

  • Unverified cross-batch dependencies (Claude flagged MAJOR; recorded, not gating in this batch) — The old executable guards (COMMON data-only prompt-injection grep, M1 no-checkout-of-HEAD-in-diff-step, pinned-BASE-worktree-with-cleanup, gate-reason-as-data fixture, adversarial-filename GITHUB_ENV fixture) are deleted along with the workflow text they parsed. The claim "no replacement exists" cannot be substantiated from this batch, and it is partially false already within this batch: the new script forbids ${{ }} in every run: block of all three jobs (which structurally eliminates the gate-reason/inline-expression injection class the deleted fixture exercised), restricts checkout refs to exactly the trusted expression pair with persist-credentials: false, confines id-token: write to the model job, enforces unset-current-credentials/use-existing-credentials hygiene, and asserts claude_scope.py uses --literal-pathspecs with NUL-delimited --name-status-style listing and os.fsdecode (the authoritative-path-map discipline the old filename fixtures protected). The remaining obligations — the data-only/injection guard in the live Action prompt, the Read-trace validator, gate-job permissions, and the fork/same-repo eligibility gate — live in batch-1 files (pr-review.yml, test_claude_review.py, claude_verdict.py), all listed, all security-prioritized into batch 1, where they are reviewed directly under the same checklists. Batch 1's review must confirm: (a) the Action prompt carries the untrusted-data/injection guard and a test binds it; (b) the gate job holds pull-requests: write without id-token/contents: write; (c) the same-repo/fork eligibility and label-gated recovery invariants survive. If batch 1 lacks these, that batch fails — not this one.
  • MINOR (one model) — Credential-renewal parity narrowed: the new test checks role, duration and the two session flags but no longer compares aws-region/mask-aws-account-id across credential steps nor forbids continue-on-error: true on the credentials step.

L4 — Observability / data-integration correctness

No Steampipe, CIS, or AgentCore diagnosis code is touched. Both models agree: no CRITICAL/MAJOR. I verified the rewritten runbook's image bounds (32 files, 8 MiB/file, 32 MiB total, 8,192/dimension, 16,777,216 pixels) against the retained stage_head_pngs.py and the manifest limits block — accurate.

  • MINOR (one model; cross-batch) — The "matches … Read calls in the official Action's execution transcript" enforcement claim depends on scripts/pr-review/claude_verdict.py (batch 1); unverifiable here.
  • MINOR (one model, confirmed) — The rewritten runbook drops the calibration caveats ("staged ≠ inspected"; declaration ≠ proof of visual perception), keeping only "Pixel inspection remains the reviewer's responsibility"; and the editorial defect "32 MiB total 8,192 pixels per dimension" is missing a separator in an operator-facing bounds sentence.
  • MINOR (one model, confirmed) — Bounds still enforced by retained code (Git listing 5,000 entries/2 MiB, 32 KiB prompt context, decoder rlimits, 200-char safe labels) lose their only documented home with the deleted bounds table.

L5 — Docs/ADR consistency

No confirmed CRITICAL/MAJOR. (One model flagged one MAJOR; the other flagged none.) Verified good: all changed links resolve; the two references to the deleted #review-input-admission-and-panel-size anchor are themselves removed by this diff; every stale two-reviewer/6,000-line/10-batch sentence in AGENTS.md/CLAUDE.md falls inside replaced hunks; scripts/v2/test_pr_review_context.py exists in BASE, so the runbook's verification command is valid; docs changes are English-only per the docs language scope; the regenerated AGENTS.md header is consistent with editing via CLAUDE.md + sync.

  • Unverified cross-batch dependency (Claude flagged MAJOR; downgraded to MINOR) — The runbook's new limit regime (16 KiB page, 120 KiB/40 pages per job, 192 KiB single-file, 4 concurrent, ≤128 jobs, 1-day expiry) has no in-batch enforcement source; scripts/pr-review/review-limits.json (untouched by either batch) still encodes the old regime. This is not a contradiction — the runbook no longer cites that JSON, and it explicitly says the historical helpers "and limits remain available" — but the new numbers' home is presumably claude_scope.py (batch 1). Batch 1 should confirm the documented numbers match the code; the runbook should name the authoritative source.
  • MINOR (confirmed, one model) — docs/runbooks/review-image-capability.md, linked as the current capability workflow, still describes the retired path (verified: :30 "the current default chair model", :139 links run-panel.sh/synthesize.sh).
  • MINOR (confirmed, one model) — Discoverability: the deleted "Related files and policy" index leaves retained helpers (input_scope.py, review_batches.py, image_coverage.py, review-limits.json, …) unreferenced by any runbook; the explicit "ADR-005 … enables no AWS mutation" citation is replaced by equivalent prose without the ADR number.
  • MINOR (confirmed, one model) — test-pr-review-large-diff.sh no longer matches its filename/original purpose (the gh pr diff 406 guard from PR fix(graph): preserve source proof across dependent publication #124 is gone); the runbook's unittest module list and the structure script's list diverge (neither is a superset); tests/CLAUDE.md/README.md not updated for the new PyYAML requirement; AGENTS.md:3 still says "shared verbatim by the external review panel".

Suggestions

  1. In batch 1 (or a follow-up), make test-pr-review-large-diff.sh shape-tolerant: normalize environment (dict vs string), accept needs: [prepare], assert a checkout step exists per job, and keep the one-line gh pr diff prohibition that was the file's reason to exist.
  2. Restore per-check TAP output (or at least # -prefixed diagnostics) and add a guarded PyYAML import with a clear not ok message; update tests/CLAUDE.md/README.md prerequisites.
  3. Name the authoritative source of the new review limits in pr-review-head-images.md and state that review-limits.json now serves only the historical helpers; restore the one-line ADR-005 citation and a short related-files index.
  4. Refresh review-image-capability.md for the Action-based path; add back one calibration sentence distinguishing staged bytes, successful Reads, and inspected pixels.
  5. Batch-1 reviewers: explicitly confirm the Action-prompt injection guard and its binding test (test_claude_review.py), gate-job permission minimization, fork/same-repo eligibility, and that the documented page/job limits match claude_scope.py.

Image coverage

The manifest lists no images, no unavailable entries, no omissions and status: complete; both panel cells declared NOT_REQUIRED, consistent with the manifest.

IMAGE_COVERAGE: NOT_REQUIRED

Verdict

No CRITICAL or MAJOR finding survived verification against the resulting code of this batch. All panel MAJORs resolve to unverified cross-batch dependencies on batch-1 files that are explicitly listed and security-prioritized into batch 1, where they are adjudicated directly; every potentially mismatched assertion in this batch fails closed in a required check rather than passing silently. Confirmed findings are MINOR. Image coverage is not required and consistently declared.


Triggered by commit e596e8ef8b9d42be50feb3fc2a5641ca061c7e69 · workflow: .github/workflows/pr-review.yml

@Atom-oh
Atom-oh deployed to ci-review-auto November 26, 2026 01:09 — with GitHub Actions Active
@Atom-oh
Atom-oh merged commit e5c774b into dev Nov 26, 2026
6 checks passed

This branch was successfully deployed

1 active deployment
ci-review-auto — e596e8ef Deployed Nov 26, 2026 by Atom-oh via AI Code Review #1132
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