Repository navigation
Description
Agent Brief
Type: Task
Summary: Move four repeated pre-model leg steps into scripts under .github/scripts/, and drop three dead credit-marker rm -rf lines (part of restructuring pass #15695). The steps are "Assert the gate and the resolver agree" (pr-verify, pr-verify capture, merge-risk), "Read the checker's model" (merge-risk), and "Prepare the working tree" (the tidy and changelog lanes).
Current behavior:
Line numbers are at ba7bb0da37.
-
"Assert the gate and the resolver agree" has the same 4-line
run:body 7 times, failing with::error::the trigger gate and the resolver name different pull requests or heads. Every copy has the sameid: agree,if: steps.gate.outputs.proceed == 'true'andenv:(GATE_PR,GATE_HEAD,PR_NUMBER,HEAD_SHA). The copies are atpr-rate-merge-risk.yml:212-224,:639-651,:994-1006;pr-verify-capture.yml:235-247;pr-verify.yml:247-259,:2315-2327,:4165-4177.- Tests read only its
if:and its place in the step order (.github/scripts/pr-merge-risk/workflow.test.mjs:200,.github/scripts/pr-verify/workflow.test.mjs:262,265,382,754). - The step before it already runs
node .base/.github/scripts/pr-verify/resolve-pr.mjs.
- Tests read only its
-
"Read the checker's model" has the same 11-line body in the three merge-risk legs:
pr-rate-merge-risk.yml:277-295,:697-715,:1052-1070. It refuses a default model and a non-alias subagent model, then writesmodelandforce. -
"Prepare the working tree" has one body per lane, the same in that lane's three legs:
- tidy, 15 lines:
maintenance-tidy-code-upkeep.yml:321-342,:657-678,:945-966; - changelog, 22 lines:
upstream-apply-changelog.yml:339-368,:731-760,:1075-1104.
It sets the commit identity, adds the exclusions, takes the head instruction and settings files out of the session (skip-worktree), and stages the read-only plugin copy.
- tidy, 15 lines:
-
None of these bodies holds a
${{ }}expression. Each runs before its job's model step, from a job that checked main out in full to.base.- All four workflows run main's file:
workflow_run,push,scheduleandworkflow_dispatch. - No test names "Read the checker's model" or "Prepare the working tree" (
git grepover*.test.mjsand*.test.sh: 0 hits). - The leg-equality checks compare the legs with each other, so equal edits keep them equal.
- All four workflows run main's file:
-
"Write the key's credit-stop marker" opens with a dead
rm -rf "${RUNNER_TEMP:?}/key-credit-stop"atpr-rate-merge-risk.yml:454,maintenance-tidy-code-upkeep.yml:431andupstream-apply-changelog.yml:457:- no earlier step of those jobs names the directory;
- the runner empties
runner.tempat the start of each job (https://docs.github.com/en/actions/reference/workflows-and-actions/contexts#runner-context).
Desired behavior:
- Four new scripts, each mode 100755 with a
#!/usr/bin/env bashline (as.github/scripts/lib/handoff-evidence.shhas), called withbashfrom the workspace root and holding its step's body verbatim, reading the same environment names:.github/scripts/pr-verify/assert-gate-agrees.sh;.github/scripts/pr-merge-risk/read-checker-model.sh;.github/scripts/maintenance-tidy-code-upkeep/prepare-working-tree.sh;.github/scripts/upstream-apply-changelog/prepare-working-tree.sh.
- Each of the 16 steps keeps its name,
id,if:andenv:, and itsrun:becomes onebash .base/.github/scripts/<dir>/<script>.shline. - The three
rm -rflines are gone; each marker step keeps itsmkdir -pandecholines.
Files:
.github/scripts/pr-verify/assert-gate-agrees.sh(new).github/scripts/pr-merge-risk/read-checker-model.sh(new).github/scripts/maintenance-tidy-code-upkeep/prepare-working-tree.sh(new).github/scripts/upstream-apply-changelog/prepare-working-tree.sh(new)- the steps at
pr-rate-merge-risk.yml:212,:277,:454,:639,:697,:994,:1052 - the steps at
pr-verify.yml:247,:2315,:4165andpr-verify-capture.yml:235 - the steps at
maintenance-tidy-code-upkeep.yml:321,:431,:657,:945 - the steps at
upstream-apply-changelog.yml:339,:457,:731,:1075
Key interfaces:
- Each step's outputs, error lines, exit codes and working-tree effects: byte-identical for the same inputs.
- The gate assertion stays its own step with its own
idandif:, so a mismatch still fails that step, and the steps after it skip as they do now. - Token scope and log shape: each step stays one
runstep reading main's checkout, before any model step, with no new token, permission or composite action.
Acceptance criteria:
- The gate-agreement check, the checker-model read and each lane's working-tree preparation each exist once, in their new scripts, and every copy calls its script.
- No credit-marker step in the three listed lanes removes the marker directory before writing it.
- Every step name,
id,if:,env:key, job id, trigger, permission and workflow file name is unchanged. - Behavior is unchanged: the same outputs, exit codes and working-tree state for the same inputs.
- The diff edits only the listed files and the lines of a test that assert on them when the change breaks that assertion.
- The pull request stays within 400 changed lines and 15 hand-edited files.
- The four scripts pass the repository's shellcheck and shfmt checks.
- ci-status is green.
Out of scope:
- Steps that run after a model step, the three-leg structure, the plan hash and plan check pair the tidy and changelog lanes share, other duplication, eval cases, fixtures, and skill and agent text.
Metadata
Metadata
Assignees
Labels
Type
Fields
Work status
Priority
Activity