ci(review-swarm): guard wrapper from candidates

Closed
KH
2mo ago
+50-24

Adds a trusted-base pull_request_target guard that reads the PR file list and fails closed when a candidate modifies the review-swarm Actions wrapper. This must land before #283, whose diagnostic logic will be moved out of the wrapper.

Validation: bash -n; YAML parse; git diff --check.


[!NOTE]
Medium Risk
Changes merge-gating CI trust boundaries (pull_request_target guard) and moves failure logging to a gate script that must be present in the base checkout when the wrapper runs.

Overview
Introduces a base-owned CI guard so pull requests cannot modify .github/workflows/review-swarm.yml: a new pull_request_target workflow checks out the base ref and runs swarm-wrapper-guard.sh, which fails if the PR’s file list includes that wrapper.

review-swarm.yml no longer inlines swarm failure diagnostics when a run does not complete; it delegates to swarm-status-diagnostic.sh (same jq extraction and line-indentation for safe Actions/Markdown output). That extraction is intended to live in trusted gate scripts rather than in the candidate-visible wrapper path.

Reviewed by Cursor Bugbot for commit 8a8ece9b299860815dfbbd1e36cac7e84dd62f67. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Adds a base-owned guard that blocks candidates from changing the review-swarm.yml wrapper, and moves the wrapper's failure-diagnostic printing into swarm-status-diagnostic.sh.

  • The guard runs on pull_request_target from the base branch, so candidates can't relax it.
  • The wrapper now calls the diagnostic script; the failure-reason output is unchanged.

Agent Relay sessions

  • codex session 01a08c06 · opened via gh pr create · last active 2026-09-10