Repository navigation
Description
Summary
GitHub will block pull_request_target workflows by default in public repositories from 2026-12-02 unless an Actions event policy allows them. The required check verify PR contents currently comes from a pull_request_target workflow (.github/workflows/pr-verifier.yml). Once the event is blocked the check never reports, so PRs park as required-check-missing and auto-merge stops. Customers must not have to change settings in their own repositories, so the hive should post this check itself as a commit status.
Where it applies
New package src/pkg/prgate (name open), the existing authenticated pull_request webhook handling (src/pkg/dashboard/api_github_webhook.go, src/pkg/github/webhook_ci_evidence.go), the existing commit-status writer used for the Prow lgtm status (src/pkg/github/client.go, with its permission-missing handling), the governor cycle for a backstop sweep, and src/pkg/github/merge_ci_gate.go.
What exists today
- The verdict logic is a PR title and body check (
prTypeVerdict,prIssueVerdictinintegration-governance.cjs, used bypr-verifier.cjs). Theverify PR contentsjob stays green by design and records the verdict in thePR TypeandPR Issuecheck runs. - The merge lanes read required checks by name only (
EvaluateCommitCIinsrc/pkg/github/commit_ci.go), so a commit status with the same context name satisfies a required context just like a check run. - The Hive Apps already document an optional commit-status write grant.
What we need
- A Go port of the verdict logic with a shared golden corpus that is run against both the Go and the JS implementations so they cannot drift.
- A poster that publishes commit statuses on the exact PR head SHA for these contexts only:
verify PR contents,PR Type,PR Issue, andverify PR contents (hive)(shadow name). A hard allowlist in code, with a test that fails if any other context (in particularDCOor any other required context) could be posted. - Triggers: the existing
pull_requestwebhook events (opened, edited, synchronize, reopened, ready_for_review, labeled, unlabeled) plus a governor backstop sweep that posts for any open PR head that has no gate status (missed webhooks, restarts, github.token autofix pushes). Pin the head SHA from the event, re-read the PR head before posting, skip draft and closed PRs. - Config
auto_merge.pr_gate.mode: off | shadow | enforce, defaultoff, explicit repo scope. Inshadowthe hive posts onlyverify PR contents (hive)(and advisory statuses under shadow names where they would collide) and logs a comparison against the workflow result. Inenforceit posts the real names. A startup self-check of the installation's granted permissions forcesoffand raises a dashboard banner when commit-status write is missing. - Change the agent merge-request watcher so zero-job
startup_failureruns of eventpull_request_targetdo not turn the verdict RED when the required context set is known and all required contexts are green (log them instead). This protects repositories that never touch their workflows. - Docs (
src/docs, including the GitHub App setup doc and the L6 guide), a changelog fragment, and tests with recorded API fixtures, no live GitHub.
Acceptance criteria
- With the mode
offnothing changes. Inshadowthe shadow status appears on real PR heads and the comparison log shows agreement with the workflow result. - A status posted by the hive satisfies a required context of the same name in the existing merge lanes (tested).
- The allowlist test proves no other context can be posted.
- The permission self-check turns the feature off and shows the banner when the grant is missing.
- No change in behavior for repositories where the mode is
off.
Open questions
- Whether a status can be posted on a fork PR head with the base installation token. A canary on a test repository settles this before enforcement.
- How the hive identifies its own status (creator login) when installations use differently named Apps; a repository variable is proposed (see the companion issue for the gate script).
Detecting a missing App grant and failing visibly (required)
The feature must never fail silently when the Hive App on an installation has not been granted commit-status write (installations keep their old permissions until an owner accepts the change, which can go unnoticed). Required behavior:
- Grant check. At startup and on a TTL, read the installation's granted permissions (the existing installation permission map in
src/pkg/github/app.goand the grant logging insrc/pkg/apphealth) and compare with what the feature needs. Missing grant: force the mode tooff, and never auto-promote toenforce. - Runtime failure check. A 403 or other refusal when posting a status is recorded per repository (reuse the existing handling that classifies it as
github_app_statuses_permission_missing) and counted. Do not retry in a loop. - Visible on the spoke. A dashboard banner modeled on the existing GitHub App permission banner (
src/pkg/dashboard/static-src/js/banners.js) that names the installation, says what is missing and where an owner accepts it (the App's pending permission request in the org settings), and, before the cutoff date, how many days remain. - Visible on the hub. A health verdict cause with a remediation hint in the existing hive health system (
src/pkg/hub/health_verdict.go,src/pkg/hub/remediation.go) so My Hives and the fleet view show it. It must turn red when the gate cannot be posted AND a required context depends on it (merges would stall), amber otherwise. - Escalation. After the cutoff date, if the grant is still missing and the required context is absent on recent heads, raise the existing fleet-report class (
github_app_statuses_permission_missing) so it is filed and not just shown. - No silent stall. In
enforcemode, if a status cannot be posted for a PR head, the PR must show a clear reason (for example a held reason naming the missing grant) instead of a barerequired-check-missing. - Tests. Table tests with recorded fixtures for: grant present, grant missing, 403 at post time, a repo whose required context does not depend on the gate, and the red versus amber decision.
Activity
clubanderson commentedon Nov 18, 2026
Claimed by the maintainer: a dispatched agent is working this, one PR to follow. Please do not open a parallel PR.
✨ PR gate: post the PR-contents check from the hive in shadow mode
✨ PR gate: post the PR-contents check from the hive in shadow mode
🐛 PR gate: route the dashboard through the github package and update …
hivecommons-hive commentedon Nov 18, 2026
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.
PR #19287 covers this issue: #19287
The PR body says this is partial/non-closing work (
Refs/Part ofor leave-open wording), so Hive will not add a closing keyword. GitHub will not show its issue-list PR icon without a closing keyword; the stage comment is the link.📖 docs: refresh api-reference citations after the server.go change
🐛 merge gate: fix the duplicated struct field in the target startup c…
✨ PR gate: post the PR-contents check from the hive in shadow mode
🐛 PR gate: route the dashboard through the github package and update …
📖 docs: refresh api-reference citations after the server.go change
🐛 PR gate: bound the memory of posted statuses
11 remaining items
✨ PR gate: fail visibly when the Commit statuses grant is missing (#1…
github-actions commentedon Nov 19, 2026
PR #19063 has merged (#19063) and referenced this issue with a non-closing
Refs #19038rather than a closing keyword.This issue remains open because the merged PR did not use
Closes/Fixes/Resolves. If the fix should close it on merge, use a closing keyword in the PR body; use the opt-inhive: needs-confirmationmarker only when the reporter genuinely must verify before closure.clubanderson commentedon Nov 19, 2026
Remaining work split into child issues, one PR each: #19284 (enforce mode), #19285 (backstop sweep), #19286 (fork-head canary). Retiring the workflow stays in #19040.
clubanderson commentedon Nov 19, 2026
PRs for the remaining scope: #19287 (enforce mode, fixes #19284), #19293 (backstop sweep, fixes #19285), #19295 (fork-head canary, fixes #19286). Read-only evidence for the fork question: fork PR #19255 head 05faf9a already carries a
prow/lgtmcommit status created byhivecommons-hive[bot]with the base installation token, through the same writer the gate uses. Nothing was switched live: hivecommons/hive stays at its current pr_gate mode until an operator follows the steps in #19287's docs.✨ PR gate: enforce mode posts the real PR-contents statuses on a conf…
✨ PR gate: fork-head canary records which head origins get the status (…
✨ PR gate: backstop sweep re-posts the gate on heads the hive missed (#…