From 4152b16c97f67426087dffb94c2463e6265c9745 Mon Sep 17 00:00:00 2001 From: Kyle Sexton <153232337+kyle-sexton@users.noreply.github.com> Date: Wed, 18 Nov 2026 21:32:55 -0500 Subject: [PATCH 1/2] fix(source-control): enforce PR-body linkage under the report-ci-status composite Both linkage hooks run only where a workflow names pr-require-checks/check-contract. The ci-status rollout (ci-workflows#1138) replaced that step with the report-ci-status composite, which runs check-contract inside it, so the hooks stopped checking in every repository already moved. They now match either path. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Vcupoo79EqmECYFZ4MTv6C --- .../fix-linkage-hooks-report-ci-status-9d69e911.md | 7 +++++++ plugins/source-control/hooks/pr-body-linkage-gate.sh | 2 +- .../source-control/hooks/pr-body-linkage-gate.test.sh | 9 +++++++++ plugins/source-control/hooks/pr-linkage-mcp-gate.sh | 2 +- plugins/source-control/hooks/pr-linkage-mcp-gate.test.sh | 6 ++++++ 5 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 .changes/source-control/fix-linkage-hooks-report-ci-status-9d69e911.md diff --git a/.changes/source-control/fix-linkage-hooks-report-ci-status-9d69e911.md b/.changes/source-control/fix-linkage-hooks-report-ci-status-9d69e911.md new file mode 100644 index 00000000000..6796b6d3675 --- /dev/null +++ b/.changes/source-control/fix-linkage-hooks-report-ci-status-9d69e911.md @@ -0,0 +1,7 @@ +--- +bump: patch +--- + +### Fixed + +- The PR-body linkage hooks (`pr-body-linkage-gate`, `pr-linkage-mcp-gate`) enforce again in a repository whose ci-status job runs the ci-workflows `report-ci-status` composite, which runs check-contract inside it. Before, they stopped checking in every repository moved to that composite. diff --git a/plugins/source-control/hooks/pr-body-linkage-gate.sh b/plugins/source-control/hooks/pr-body-linkage-gate.sh index d7cdb4d1689..38bbcd4c855 100755 --- a/plugins/source-control/hooks/pr-body-linkage-gate.sh +++ b/plugins/source-control/hooks/pr-body-linkage-gate.sh @@ -150,7 +150,7 @@ GATE_FILE="" # ci-workflows' own local dogfood (`./.github/actions/`), where is # `pr-require-checks/check-contract`. The trailing class keeps a longer sibling # directory (`check-contract-foo`) out. -gate_re='\.github/actions/pr-require-checks/check-contract([@[:space:]]|$)' +gate_re='\.github/actions/pr-require-checks/(check-contract|report-ci-status)([@[:space:]]|$)' for candidate in "$REPO_ROOT"/.github/workflows/*.yml "$REPO_ROOT"/.github/workflows/*.yaml; do # An unmatched glob stays literal; skipped here rather than leaking # `shopt -s nullglob` out of the hook. diff --git a/plugins/source-control/hooks/pr-body-linkage-gate.test.sh b/plugins/source-control/hooks/pr-body-linkage-gate.test.sh index cf96480a561..a7f9efbeb6b 100755 --- a/plugins/source-control/hooks/pr-body-linkage-gate.test.sh +++ b/plugins/source-control/hooks/pr-body-linkage-gate.test.sh @@ -64,6 +64,11 @@ new_repo() { printf 'jobs:\n ci-status:\n steps:\n - uses: melodic-software/ci-workflows/.github/actions/pr-require-checks/check-contract@5e18f3d6cebd6fa5e66b0941ee0f7ed6ba288d6c # v0.58.0\n' \ >"$r/.github/workflows/ci.$gated" ;; + composite) + mkdir -p "$r/.github/workflows" + printf 'jobs:\n ci-status:\n steps:\n - uses: melodic-software/ci-workflows/.github/actions/pr-require-checks/report-ci-status@9c5bedfbfdbdfe733b9ce4cd7ca80c1574bd4cb8 # v0.76.3\n' \ + >"$r/.github/workflows/pr-require-checks.yml" + ;; nostep) mkdir -p "$r/.github/workflows" printf 'jobs:\n ci-status:\n steps:\n - uses: actions/checkout@v5\n' \ @@ -82,6 +87,8 @@ new_repo "$GATED" yml new_repo "$UNGATED" plain new_repo "$NOSTEP" nostep new_repo "$GATED_YAML" yaml +GATED_COMPOSITE="$WORK/gated-composite" +new_repo "$GATED_COMPOSITE" composite new_repo "$OTHER" yml # mk_payload -> the PreToolUse payload this hook reads, on stdout. @@ -539,6 +546,8 @@ assert_allow "an absolute path to a compliant body allowed" "$GATED" \ printf '%s\n' "$BAD" >"$GATED_YAML/body.md" assert_block "a .yaml gate workflow enforces too" "$GATED_YAML" "gh pr create -t T --body-file body.md" +printf '%s\n' "$BAD" >"$GATED_COMPOSITE/body.md" +assert_block "the report-ci-status composite enforces too" "$GATED_COMPOSITE" "gh pr create -t T --body-file body.md" # --- Locale independence ----------------------------------------------------- # `[[:space:]]` is locale-defined; JavaScript's `\s` is not. Each body below diff --git a/plugins/source-control/hooks/pr-linkage-mcp-gate.sh b/plugins/source-control/hooks/pr-linkage-mcp-gate.sh index c45300f713d..3a253256e2e 100755 --- a/plugins/source-control/hooks/pr-linkage-mcp-gate.sh +++ b/plugins/source-control/hooks/pr-linkage-mcp-gate.sh @@ -154,7 +154,7 @@ GATE_FILE="" # ci-workflows' own local dogfood (`./.github/actions/`), where is # `pr-require-checks/check-contract`. The trailing class keeps a longer sibling # directory (`check-contract-foo`) out. -gate_re='\.github/actions/pr-require-checks/check-contract([@[:space:]]|$)' +gate_re='\.github/actions/pr-require-checks/(check-contract|report-ci-status)([@[:space:]]|$)' for candidate in "$REPO_ROOT"/.github/workflows/*.yml "$REPO_ROOT"/.github/workflows/*.yaml; do # An unmatched glob stays literal; skipped here rather than leaking # `shopt -s nullglob` out of the hook. diff --git a/plugins/source-control/hooks/pr-linkage-mcp-gate.test.sh b/plugins/source-control/hooks/pr-linkage-mcp-gate.test.sh index e820ccfd6fe..1b23460d3df 100755 --- a/plugins/source-control/hooks/pr-linkage-mcp-gate.test.sh +++ b/plugins/source-control/hooks/pr-linkage-mcp-gate.test.sh @@ -49,6 +49,11 @@ git -C "$GATED" init -q git -C "$GATED" remote add origin https://github.com/acme-corp/widgets.git git -C "$NOGATE" init -q git -C "$NOORIGIN" init -q +COMPOSITE="$WORK/composite" +mkdir -p "$COMPOSITE/.github/workflows" +printf 'jobs:\n ci-status:\n steps:\n - uses: melodic-software/ci-workflows/.github/actions/pr-require-checks/report-ci-status@9c5bedfbfdbdfe733b9ce4cd7ca80c1574bd4cb8 # v0.76.3\n' >"$COMPOSITE/.github/workflows/pr-require-checks.yml" +git -C "$COMPOSITE" init -q +git -C "$COMPOSITE" remote add origin https://github.com/acme-corp/widgets.git # run ; the payload carries its own cwd. run() { @@ -118,6 +123,7 @@ run 0 "Refs: #N non-closing marker passes" "$(payload "$GATED" $CREATE $OWNER $R run 0 "create with no body field passes (empty body)" "$(payload "$GATED" $CREATE $OWNER $REPO)" run 0 "update with no body field passes" "$(payload "$GATED" $UPDATE $OWNER $REPO)" run 2 "update with bad body blocks" "$(payload "$GATED" $UPDATE $OWNER $REPO "$BAD")" +run 2 "the report-ci-status composite enforces too" "$(payload "$COMPOSITE" $CREATE $OWNER $REPO "$BAD")" run 0 "different target repo is out of scope" "$(payload "$GATED" $CREATE other-org other-repo "$BAD")" run 0 "gated repo with no origin remote allows (undeterminable target)" "$(payload "$NOORIGIN" $CREATE $OWNER $REPO "$BAD")" run 0 "repo without the gate file never blocks" "$(payload "$NOGATE" $CREATE $OWNER $REPO "$BAD")" From fa893b6eac4ad194da8ed9e9a5bbc23f0deedb91 Mon Sep 17 00:00:00 2001 From: Kyle Sexton <153232337+kyle-sexton@users.noreply.github.com> Date: Thu, 19 Nov 2026 00:12:59 -0500 Subject: [PATCH 2/2] docs(source-control): name the report-ci-status composite in the linkage hooks' scope The scope regex now matches pr-require-checks/report-ci-status, but the hook headers, the regex comments, the README and create.md still said the hooks run only where check-contract is used. Name both steps everywhere the scope is stated. Co-Authored-By: Claude Opus 5.5 --- plugins/source-control/README.md | 16 ++++++++++------ .../source-control/hooks/pr-body-linkage-gate.sh | 14 ++++++++++---- .../source-control/hooks/pr-linkage-mcp-gate.sh | 16 +++++++++++----- .../skills/pull-request/reference/create.md | 2 +- 4 files changed, 32 insertions(+), 16 deletions(-) diff --git a/plugins/source-control/README.md b/plugins/source-control/README.md index c0587276860..561e2341a2e 100644 --- a/plugins/source-control/README.md +++ b/plugins/source-control/README.md @@ -185,7 +185,8 @@ the calls that bypass the skill. Enforcement is keyed to the consuming repository's own policy: it runs only where one of the repo's `.github/workflows/*.yml` / `*.yaml` files `uses:` the -contract composite step `pr-require-checks/check-contract` (the SHA-pinned +contract composite step `pr-require-checks/check-contract`, or the +`pr-require-checks/report-ci-status` composite that runs it (the SHA-pinned `melodic-software/ci-workflows/.github/actions/@` form, or ci-workflows' own local `./.github/actions/`). A body the hook cannot read statically always passes: an unexpanded variable, an absent body @@ -257,7 +258,8 @@ covers both the `mcp__github__` names and the `mcp__plugin__github__` names of a plugin-bundled server. It blocks only the same negated closing reference, under the same authority (a workflow in the consuming repository's own `.github/workflows/` that `uses:` the -`pr-require-checks/check-contract` composite step), with the same block message. The MCP payload hands over the body as a plain JSON field, so the +`pr-require-checks/check-contract` composite step, or the `pr-require-checks/report-ci-status` +composite that runs it), with the same block message. The MCP payload hands over the body as a plain JSON field, so the Bash sibling's static-readability caveats don't apply here; the scope guards that remain are the workflow scan above, an origin-remote match on the call's `owner`/`repo` (another repository's PR is not this repo's policy), and an @@ -409,8 +411,8 @@ repo's owner. |---|---|---| | `lane_instance` | string | a random `lane-` id made once and kept in the plugin data dir, never the hostname (writer identity suffixing `babysit-loop`'s telemetry marker; must be distinct across concurrent lane instances) | | `lane_app_slug` | string | none (the telemetry write identity comes from the token's user; set it under a GitHub App installation token so `babysit-loop` resolves `[bot]`) | -| `pr_body_linkage_gate_enabled` | boolean | `true` (the PR-body hook above; inert in a repo with no workflow using the `check-contract` step) | -| `pr_linkage_mcp_gate_enabled` | boolean | `true` (the MCP-surface sibling; inert in a repo with no workflow using the `check-contract` step) | +| `pr_body_linkage_gate_enabled` | boolean | `true` (the PR-body hook above; inert in a repo with no workflow using the `check-contract` or `report-ci-status` step) | +| `pr_linkage_mcp_gate_enabled` | boolean | `true` (the MCP-surface sibling; inert in a repo with no workflow using the `check-contract` or `report-ci-status` step) | | `babysit_watched_owners` | string (multiple) | infer the current repo's owner | | `babysit_self_logins` | string (multiple) | your `gh api user` login (extras add to it) | | `babysit_default_tier` | string | `safe` (explicit invocations only) | @@ -466,13 +468,15 @@ The plugin-scope finding-classification gate accepts extra posting identities vi **`pr_body_linkage_gate_enabled`.** Blocks only a negated closing reference. A missing closing line or a missing or empty `## Summary`, `## Fix`, `## Verification` or `## Related` section passes, since CI reports those as advisory. Enforced only in a repository whose -`.github/workflows` carry a workflow that uses the `check-contract` composite step. +`.github/workflows` carry a workflow that uses the `check-contract` composite step or the +`report-ci-status` composite that runs it. **`pr_linkage_mcp_gate_enabled`.** The MCP-surface sibling of `pr-body-linkage-gate`, covering cloud and remote sessions that open PRs through MCP tools rather than `gh` (see [docs/cloud-sessions.md](../../docs/cloud-sessions.md#github-mcp-tools-vs-the-gh-cli)). It blocks the same negated closing reference, with the same policy scope: enforced only in a repository -whose `.github/workflows` carry a workflow that uses the `check-contract` composite step. +whose `.github/workflows` carry a workflow that uses the `check-contract` composite step or the +`report-ci-status` composite that runs it. **`branch_issue_pattern`.** The last capture group must resolve to digits (`Closes #N` honors only a numeric issue). Set it for a non-default branch scheme that places the number differently, for diff --git a/plugins/source-control/hooks/pr-body-linkage-gate.sh b/plugins/source-control/hooks/pr-body-linkage-gate.sh index 38bbcd4c855..1a39b5b0806 100755 --- a/plugins/source-control/hooks/pr-body-linkage-gate.sh +++ b/plugins/source-control/hooks/pr-body-linkage-gate.sh @@ -11,7 +11,8 @@ # # WHAT IT ENFORCES — no negated closing reference anywhere in the body, judged # as the consuming repository's `.github/actions/pr-require-checks/check-contract` -# composite step (melodic-software/ci-workflows) judges it, after stripping HTML comments +# composite step (melodic-software/ci-workflows; `report-ci-status` runs it, +# https://github.com/melodic-software/ci-workflows/blob/main/.github/actions/pr-require-checks/report-ci-status/action.yml) judges it, after stripping HTML comments # (terminated ones, then an unterminated `