pr-sweep ยท diff

git:20261016.395cab4 to git:20261016.6533338

25 added, 46 removed. Audit A to A.

What this update changes in the checks

No check changed: every fixed check gives the same answer before and after this update.

A tripped check is a label, not a verdict: read the matched text and the lines below. This week's updates that newly trip a check.

---
name: pr-sweep
description: Review every open PR with the code-reviewer agent and an adversarial review, apply the findings, and merge each one once CI is green. Use when asked to ship, sweep, or merge open PRs.
argument-hint: "[PR-number ...] [--no-merge]"
disable-model-invocation: false
---
# PR sweep
- Take every open PR from review to merge without asking between steps. With PR numbers, sweep only those. With `--no-merge`, stop at green PRs.
-
- ## 1. List
-
- ```bash
- gh pr list --state open --json number,title,headRefName,additions,deletions,author
- ```
-
- Skip PRs by other authors and drafts; report them. Empty list: stop.
-
- ## 2. Review
-
- Run two reviews on the PR branch, in parallel:
-
- - The `code-reviewer` agent for Go diffs (other diffs against the project rules). Keep its Opus model; never pass a cheaper override.
- - An adversarial review that challenges the design, not only the lines: `/codex:adversarial-review --base origin/main` where the Codex plugin is installed (Claude Code). Without it, run a second reviewer pass told to question the approach, its assumptions, and how it fails in real use.
-
- Read every result before editing. After each round of fixes, run the adversarial review again until it approves or every remaining finding is rejected in step 4.
-
- ## 3. Verify each finding
+ Review and finish the requested PRs, or all eligible open PRs when none are specified. Invoking this merge workflow authorizes merging within that scope. With `--no-merge`, or when called from a review-only task, stop at reviewable green PRs.
- A finding is a claim, not a task. Before acting on one:
+ ## List and isolate
- - Reopen the file and line it cites on the PR head.
- - Reproduce behavior claims with a built binary or a failing test.
- - Check vendor claims against the vendor page, not memory.
+ List open PRs with number, title, author, draft state, head branch and SHA, and base branch. Paginate until complete. Skip drafts and PRs by other authors and report them.
- Keep what holds. Record what does not, with the reason.
+ Fetch the base and PR heads. Stop if local `main` has unpublished commits. Preserve a dirty starting checkout and perform each PR's work in a dedicated worktree. Record its absolute path and branch; reuse an existing task worktree only after checking its head and local changes. Do not discard unpublished work or force a branch held by another worktree. Stop the affected PR if its task worktree is unsafe and continue independent PRs. Run Git commands in the task worktree; a tool wrapper problem does not justify switching the starting checkout.
- ## 4. Apply
+ ## Review
- Check out the PR branch in the main checkout (worktree agents cannot run git while the RTK hook rewrites it) and pull. For each confirmed finding:
+ Run two independent passes on the current PR diff:
- - Fix it on the branch. Test first for behavior changes: the new test must fail on the old code.
- - A finding that needs a different design or touches other targets gets its own issue (`gh issue create --assignee Chemaclass` with a label). Do not widen the PR.
- - A finding you reject after verification is answered, not ignored.
+ - Use the available `code-reviewer` role for Go changes, or a reviewer against project rules for other changes. Respect the role's configured model; concrete model choices belong in agent metadata.
+ - Use the available adversarial review role or command to challenge the design, assumptions, and real usage failures.
- Then post one PR comment listing the commit that applied the findings, the issues filed, and each rejection with its reason.
+ If either role is unavailable, use an available reviewer with the corresponding brief. If delegation is unavailable, perform two separate passes with those briefs. Read both results before editing. Repeat the adversarial pass after fixes until remaining findings are resolved or explicitly rejected with evidence.
- ## 5. Gate
+ ## Verify and apply
- Before every push, select and pass checks under the policy in repository-root `docs/internal/contributing.md`, section "Choose checks for your change". Follow its serial execution, evidence recording, and reuse rules. Apply it again after review fixes or merges change relevant inputs. Check each command's own exit code; a filtering pipe can hide a failure.
+ A finding is a claim. Reopen its cited file on the current PR head, reproduce behavior claims with a failing test or current binary, and verify vendor claims against current vendor documentation. Record unsupported claims and why they were rejected; report unresolved claims as blockers.
- Review tracked changes after sync and keep ignored output ignored. CHANGELOG bullets must pass the length check in `.agnostic-ai/agents/changelog-curator.md`.
+ Fix confirmed findings within scope. Use a test that fails before the fix for behavior changes; use existing focused checks for prose or data. Findings needing another design or changes to unrelated targets get a follow-up issue assigned to Chemaclass with the appropriate label. Answer rejected findings with their evidence.
- Commit with conventional commits, GPG-signed, no AI attribution or session links. Push. Before merging, wait for required CI on the current head SHA, including remote OS checks selected by the validation policy. Missing or pending checks are not green.
+ After fixes, post one PR comment with applied commit IDs, follow-up issues, and rejection reasons. Follow the project's comment attribution rule.
- ## 6. Merge
+ ## Gate
- For each PR, oldest first, or the one that changes shared files (`sources.lock`, `signals.tsv`, `CHANGELOG.md`) first:
+ Before pushing, select and pass checks from repository-root `docs/internal/contributing.md`, section "Choose checks for your change". That policy owns generation, validation selection, serial execution, evidence, and reuse after fixes or merges. Check each command's own exit code. Commit with signed Conventional Commits and push without rewriting published history.
- 1. Wait for checks on the current head SHA: `gh pr checks <N>`. Missing or pending checks are not green.
- 2. If `mergeStateStatus` is not `CLEAN`, merge `origin/main` into the branch (never rewrite pushed history), keep both sides of shared docs, rerun the gate, push, and wait again.
- 3. `gh pr merge <N> --squash --admin --delete-branch`. If `--admin` is rejected, use `--auto --squash --delete-branch` and report that the PR awaits approval.
- 4. Fast-forward local `main` from `origin/main` and delete the local branch. Stop if `main` has unpublished commits; never reset them away.
+ Before merging, confirm required CI and applicable remote OS checks passed on the actual current head SHA. Missing, pending, stale, or skipped required checks are not green.
- After the last merge, wait for the `CI` workflow on the new `main` head and confirm every job passed. Main pushes run Go tests on Linux. A red main is the first thing to fix.
+ ## Merge and clean up
- ## 7. Report
+ Process oldest first, prioritizing shared-file changes when that reduces conflicts.
- One table: PR, merge commit, findings applied, findings moved to issues, findings rejected. Then the open follow-up issues.
+ 1. Refresh the PR head, checks, review requirements, and merge state. Confirm the reviewed and tested SHA is still current.
+ 2. Update from fresh `origin/main` only when the branch is actually behind a required current base or has merge conflicts. Merge the base into the task branch without rewriting published history, preserve both sides of shared docs, inspect the resulting diff, rerun affected validation, push, and review the new head as needed. A non-clean status alone does not require a base merge: `BLOCKED` can mean pending checks or reviews, and unknown/calculating states need a refresh.
+ 3. Within merge authority, use `gh pr merge <N> --squash --admin --delete-branch --match-head-commit <SHA>`. If administrative merging is rejected, use the same SHA guard with `--auto --squash --delete-branch` and report that merging is queued. A queued request is not a verified merge.
+ 4. Confirm the PR is merged and its merge commit is on fetched `origin/main`. Verify the `CI` workflow for the resulting main head passed. Resolve a red main before continuing merges.
+ 5. Fast-forward local `main` only if its checkout is clean and it has no unpublished commits. Otherwise preserve it and report why it was not advanced. Remove the task worktree and local branch only after verifying the merge and confirming they contain no uncommitted or unpublished work and have no open PR. Delete the remote branch if merge cleanup did not. Run `git fetch --prune` and `git worktree prune`; after removing worktrees, run `~/.agnostic-ai/scripts/reap-stale-agents.sh` if it exists.
- ## Stop
+ ## Report blockers and outcomes
- Stop and report when a finding cannot be verified either way, CI stays red after one fix, or a merge is blocked even for `--auto`.
+ Report one table with PR, merge commit or current state, applied findings, follow-up issues, and rejected findings. Include retained task paths and next steps for blocked PRs. Stop work on a PR when a finding remains unverifiable, CI stays red after one fix, or merging remains blocked even with auto-merge. Continue independent PRs when safe.