Skip to content

Move the post-merge mutation legs repeated setup steps into scripts #15951

Description

@kyle-sexton

Agent Brief

Type: Task
Summary: Move the post-merge mutation lane's two repeated pre-model leg steps, "Set the diff target" and "Stage the plugin and the prompt", into two scripts under .github/scripts/post-merge-test-mutation/, and drop the dead credit-marker rm -rf lines (part of restructuring pass #15695).

Current behavior:
Line numbers are at ba7bb0da37. The mutation lane has six model legs: generate, generate-subscription, generate-fallback, triage, triage-subscription and triage-fallback.

  • "Set the diff target" has the same 19-line run: body in all six legs: post-merge-test-mutation.yml:273-297, :602-626, :881-905, :1313-1337, :1671-1695, :1977-2001.

    • Its env: is the same in each: BEFORE and AFTER from needs.prep.outputs.
    • The body checks that AFTER is on main and picks the range or commit target.
    • It appends three exclusions to the checkout's git exclude file (post-merge-test-mutation.yml:288), writes the local diff-target settings file the mutation-testing plugin reads, checks the tree is clean, and writes mode and target to GITHUB_OUTPUT.
  • "Stage the plugin and the prompt" has one 16-line body per stage:

    • in the generate legs it reads generate.prompt.md and generate.schema.json (:325-351, :658-684, :936-962);
    • in the triage legs it reads triage.prompt.md and triage.schema.json (:1392-1418, :1752-1778, :2057-2083).

    The two forms differ only in those two file names.

  • No ${{ }} expression appears in either body. Both steps run before the model step, after "Check out main's tools", which checks main out to .base in full at the event's commit (:262-267).

  • The workflow runs on workflow_run, so main's file runs.

  • No test names either step (git grep over *.test.mjs and *.test.sh: 0 hits). .github/scripts/post-merge-test-mutation/credential-legs.test.mjs:53-60 and .github/actions/resolve-config/callers.test.mjs:10162-10197 compare the legs with one another, so equal edits keep them equal.

  • "Write the key's credit-stop marker" opens with a dead rm -rf "${RUNNER_TEMP:?}/key-credit-stop" at :440 and :1509:

Desired behavior:

  • New .github/scripts/post-merge-test-mutation/set-diff-target.sh, mode 100755 with a #!/usr/bin/env bash line (as .github/scripts/lib/handoff-evidence.sh has), called with bash from the workspace root. It holds the "Set the diff target" body verbatim, including its # shellcheck disable=SC2016 reason, and reads BEFORE and AFTER from the environment.
  • New .github/scripts/post-merge-test-mutation/stage-plugin-prompt.sh, mode 100755 with a #!/usr/bin/env bash line (as .github/scripts/lib/handoff-evidence.sh has), called with bash and taking generate or triage as its one argument. It refuses any other argument with exit 2. It holds the staging body, with <stage>.prompt.md and <stage>.schema.json picked by the argument, and reads HEAD_SHA, DIFF_TARGET, PROMPT_FILE, SCHEMA_FILE and MODEL from the environment.
  • Each of the twelve steps keeps its name, id, if: and env:. Its run: becomes one line: bash .base/.github/scripts/post-merge-test-mutation/set-diff-target.sh, or bash .base/.github/scripts/post-merge-test-mutation/stage-plugin-prompt.sh generate (or triage).
  • The two rm -rf lines are gone; each marker step keeps its mkdir -p and echo lines.

Files:

  • .github/scripts/post-merge-test-mutation/set-diff-target.sh (new)
  • .github/scripts/post-merge-test-mutation/stage-plugin-prompt.sh (new)
  • the twelve steps and two marker lines at post-merge-test-mutation.yml:273, :325, :440, :602, :658, :881, :936, :1313, :1392, :1509, :1671, :1752, :1977, :2057

Key interfaces:

  • The target and prompt step outputs (mode, target, lint), every error and warning line, the prompt and schema files, the exclusions and the settings file: byte-identical for the same inputs.
  • Token scope and log shape: each step stays one run step reading main's checkout, before any model step, with no new token, permission or composite action.

Acceptance criteria:

  • The diff-target logic exists once, in set-diff-target.sh, and the staging logic once, in stage-plugin-prompt.sh; all twelve leg steps call them.
  • No credit-marker step in the mutation lane 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 written files 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.
  • Both scripts pass the repository's shellcheck and shfmt checks.
  • ci-status is green.

Out of scope:

  • The leg steps after the model step (for example "Fail the leg unless it handed off or a limit stopped it"), which run after model code may have touched the workspace. Also the three-leg structure, other duplication, eval cases, fixtures, and skill and agent text.

Activity

  1. added
    status: ready
    host-run
    on Nov 13, 2026
  2. added theissue type on Nov 13, 2026
  3. removed
    status: ready
    on Nov 13, 2026
  4. removed
    host-run
    on Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Work status

    ready

    Priority

    low

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions