Automate the triage sweep's PR actions

Merged
JS
1d ago
+2172-54

A bare /codetrial-triage typed each of its no-ask actions per PR: run approvals, rebase requests, hides, hygiene reviews, similar-work notices and ledger entries, each with its own head check, so a reused variable or a stale head could post on the wrong commit. This adds one script per step (apply-pr-actions, post-similar, review-pick, review-brief, review-finish, ci-cached, experience-close, feedback-bundle), each taking its action only behind the guards pulls.md and review-prs.md already name and printing a receipt per action. The sweep baseline is now the one /codetrial-odds keeps, and hygiene and the sweep share one CI diagnosis per head.

Verified: the 174 skill-script tests (up from 119) run each script against a fake gh, with a test for each guard that fails when the guard is reverted, and shellcheck, ruff, check-skill-refs.py and the indent check are clean at every one of the five commits, each tested on its own. A dry run of apply-pr-actions, snapshot, review-pick, ci-cached and feedback-bundle against this repository with every write blocked by a shim matched the sweep: it would post one hygiene review on #523 and nothing else. Not run against live GitHub: post-similar, review-finish and experience-close, which only post. scripts/test.sh passed every gate except one cargo test in tests/cli.rs, which a signal killed under load and which passes on its own.

Left out: moving the approve and hide verdicts into pr-sweep.sh so the sweep decides them instead of apply-pr-actions, and folding the cache into ci-failure.sh. Both change shared infrastructure and are better as follow-ups.


Summary by cubic

Replaces the triage sweep's hand-typed per-PR actions — approvals, rebase requests, hides, hygiene reviews, similar-work notices and reviewed-head ledger entries — with eight scripts (apply-pr-actions, post-similar, review-pick, review-brief, review-finish, ci-cached, experience-close, feedback-bundle). Each runs only behind the guard its skill page names and prints a receipt per action, and the sweep now shares one baseline (the snapshot codetrial-odds keeps) and one CI diagnosis per head with hygiene. Two rules the docs left out are now recorded: an acceptance comment on an assigned issue opens a claim rather than a waiting reminder, and background review agents announce themselves when done.

Verification

  • 174 skill-script tests (up from 119) run each script against a fake gh, with a test per guard that fails when the guard is reverted.
  • A dry run of apply-pr-actions, snapshot, review-pick, ci-cached and feedback-bundle against this repository with every write blocked matched the sweep: one hygiene review on #523 and nothing else.
  • post-similar, review-finish and experience-close only post and were not run against live GitHub.
  • shellcheck, ruff, check-skill-refs.py and the indent check are clean at each commit; scripts/test.sh passed every gate except one cargo test killed under load, which passes on its own.

Left out

  • Moving the approve and hide verdicts into pr-sweep.sh so the sweep decides them instead of apply-pr-actions.
  • Folding the cache into ci-failure.sh; both change shared infrastructure and are better as follow-ups.