Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/fixed-fork-publication-guard-stage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- A fork pull request whose only failing checks refuse forks (for example "a fork pull request cannot publish…; a maintainer must push this branch to the repository") is now parked at `stage/085-needs-decision` with the check named, instead of being returned to its contributor or adopted, since only a maintainer can clear it ([#14273](https://github.com/hivecommons/hive/issues/14273)).
1 change: 1 addition & 0 deletions changelog.d/fixed-hive-caused-signoff-attribution-085.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- A PR whose sign-off attribution problem comes from the hive's own commits (the contributor's self-signed commits beside the hive's App-signed fix commit, or a head the hive pushed) is no longer returned to the contributor at 071/072 with instructions to re-sign commits they never made. It parks at `stage/085-needs-decision` with one maintainer note per head naming what clears it, and when a trusted merger approves the current head the lane elects a merge commit (`merge-method/merge`) as it already did for `role/trusted` PRs. A head made only of the author's own App-signed commits still goes back to its author.
1 change: 1 addition & 0 deletions src/cmd/hive/merge_eligibility.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ func stageLabelPolicyFunc(cfg *config.Config) func() automerge.StageLabelPolicy
RelayKnown: contributorRelayKnown,
SharedCIIncident: stageSharedCIIncident,
BaseBranchRed: stageBaseBranchRed,
ForkGuard: stageForkGuard,
DCORequired: stage.DCO.RequiredFor,
SquashOnly: cfg.AutoMerge.SquashOnlyFor,
}
Expand Down
18 changes: 17 additions & 1 deletion src/cmd/hive/stage_shared_ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ type stageSharedCIEntry struct {
// baseRed names the failing checks that are also red on the base branch
// tip; set only when every failing check is (PullRequest.AllFailuresBaseRed).
baseRed []string
// forkGuard names the failing checks that refuse the PR only because it
// is from a fork; set only when every failing check does
// (PullRequest.ForkGuardChecks).
forkGuard []string
}

// stageSharedCIIndex holds, per "repo#number", the open [shared-ci] incident
Expand All @@ -41,7 +45,8 @@ func publishStageSharedCIIncidents(actionable *github.ActionableResult) {
if pr.AllFailuresBaseRed() {
e.baseRed = append([]string(nil), pr.BaseRedChecks...)
}
if e.incident > 0 || len(e.baseRed) > 0 {
e.forkGuard = pr.ForkGuardChecks()
if e.incident > 0 || len(e.baseRed) > 0 || len(e.forkGuard) > 0 {
idx[stageSharedCIKey(pr.Repo, pr.Number)] = e
}
}
Expand Down Expand Up @@ -73,6 +78,17 @@ func stageBaseBranchRed(repo string, number int, head string) []string {
return append([]string(nil), e.baseRed...)
}

// stageForkGuard answers StageLabelPolicy.ForkGuard with the same repo/head
// matching as stageSharedCIIncident: the failing checks that refuse the PR
// only because it is from a fork, when every failing check does.
func stageForkGuard(repo string, number int, head string) []string {
e, ok := stageSharedCILookup(repo, number, head)
if !ok || len(e.forkGuard) == 0 {
return nil
}
return append([]string(nil), e.forkGuard...)
}

func stageSharedCILookup(repo string, number int, head string) (stageSharedCIEntry, bool) {
idx := stageSharedCIIndex.Load()
if idx == nil {
Expand Down
29 changes: 21 additions & 8 deletions src/docs/labels-and-control-signals.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ used to admit the PR:
| `head-changed-since-eval`, `merge-failed`, `merge-queue-required` (the base branch's ruleset only accepts merges through GitHub's merge queue, so the direct REST merge is refused; logged as a skip rather than a merge error, [#14018](https://github.com/hivecommons/hive/issues/14018); the self-authored sweep then skips the direct merge on that base for 30 minutes and logs the skip once per PR head, [#14068](https://github.com/hivecommons/hive/issues/14068); the trusted-author, queued and contributor-lane sweeps skip it the same way, sharing one memory of such bases; while a base is remembered the dashboard shows its otherwise-green PRs as a person's to merge, not Merge-eligible), `required-checks-expected`, `behind`, `updated-branch`, `behind-update-budget-exhausted` (a behind self-authored PR the sweep did not update only because this tick's branch-update budget was spent; retried next tick, waits on the hive, [#12607](https://github.com/hivecommons/hive/issues/12607)), `release-hold*` β€” and no red check on the head | `100-merge-queue` |
| CI red (required or optional check) while the PR is deferred to an open `[shared-ci]` incident (`<!-- hive-shared-ci-<n> -->`, the governor's `deferred_incident`) for the same head | `050-review-pending` / `060-reviewed`, reason `shared-ci-incident:<n>`: the base or a shared check is what is red, so the PR is never sent to 070/071/072, never nudged and never stalled; once the incident closes a still-red head is handed back as usual. Conflicts and requested changes stay author-facing ([#12606](https://github.com/hivecommons/hive/issues/12606)) |
| CI red (required or optional) while **every** failing check on the head is also red on the base branch's tip β€” the governor's `base_red_checks` / `base_red`, set during CI enrichment when a same-named latest check run on the base ref (meta checks excluded) concluded failure / timed_out / cancelled / action_required / startup_failure / stale **and** the PR's changed files include none of `.github/workflows/*`, `Dockerfile` / `Dockerfile.*` / `*.Dockerfile`, `go.mod` / `go.sum` (a PR touching those plausibly owns the check and stays author-facing; a lookup error or a diff beyond the file-list page budget also stays author-facing) | `050-review-pending` / `060-reviewed`, reason `base-branch-red:<check>,<check>` ("waiting for the base branch's CI to recover (…) β€” not this PR's fault"): never 070/071/072, never nudged, never stalled, still not merged (the lane's skip reason is the same token). The fix loop counts no attempt, kicks no fixer, and posts one `<!-- hive-base-branch-red -->` hold comment per head; an escalation the hive itself raised (ledger `label_applied`) over such a head has its `needs-human` removed with the hold wording. The next evaluation after the base goes green re-evaluates the head: a still-red PR is handed back as usual. Conflicts and requested changes stay author-facing (seen on [#13270](https://github.com/hivecommons/hive/pull/13270) and [#13258](https://github.com/hivecommons/hive/pull/13258), 2026-10-20) |
| CI red (required or optional) on a **fork** PR while **every** failing check's annotation says the check refuses forks (case-insensitive `fork pull request(s) cannot`, `maintainer must push this branch`, or `cannot publish` together with `fork` β€” a fork-publication / fork-secrets guard) | `085-needs-decision`, reason `fork-guard:<check>,<check>`: never 070/071/072, never nudged, never adopted (074) β€” neither the author nor the hive can turn the check green by pushing to the fork. The entry comment names the check and says a maintainer must push the branch to the repository (or approve the run as the repository requires). A same-repo PR with the same message, or a fork PR with any other red check, is handed back as usual ([#14273](https://github.com/hivecommons/hive/issues/14273)) |
| any **non-required** check on the current head is red, whatever the lane's reason (the lane gates on required checks only, so it still soaks and merges; a reader of the rollup sees βœ—). Parking modifiers (`hold`, `needs-human`, admission reasons) still win | `070-fixing` / `071-needs-author` / `072-returned-to-contributor` (by author kind), reason `optional-check-failing:<check>` (the nudge lists every red check); never 080 or 100. A red *required* check is the lane's own `required-check-failing:*` β†’ 070/071/072 ([#12538](https://github.com/hivecommons/hive/issues/12538), seen on [#12457](https://github.com/hivecommons/hive/pull/12457)) |
| `label:hold`, `held`, `label:needs-human`, `exempt-label`, `excluded-label:*`, `sentinel`, `human-merge-path*`, `intent-*`, `contributor-lane:workflow-path` / `tests-removed` / `no-reviewer` / `reporter-trust-hold`, `workflow-permission` (GitHub refused update-branch or the merge-forward with a 403 because the base changed `.github/workflows/` and the App lacks the workflows permission; no token the hive holds can push that update, so it is not sent to 070), `linked-issue:hold:#N:<label>` / `linked-issue:needs-decision:#N:<label>` (an open issue the PR closes is held or parked β€” see [Holding an issue](#holding-an-issue)) | human hand-off, **decision** cause β†’ routed by the head's evidence (below); lands at `085-needs-decision` when the head is otherwise clean |
| `merge-refused:review-required` (GitHub answered the merge with 405 "At least N approving review(s) is/are required by reviewers with write access"), `merge-refused:method-not-allowed` (405 "Merge commits / Squash merges / Rebase merges are not allowed on this repository") | human hand-off, **decision** cause, as above: lands at `085-needs-decision` when the head is otherwise clean, and the entry comment names the rule GitHub refused the merge on. Every sweep (self-authored, trusted-author, queued, contributor lane) logs these as skips, not `merge-failed` errors, and stops calling merge: a review refusal is remembered per PR head and re-armed when the head moves, when GitHub's `mergeable_state` for the PR changes (an approving review turns `blocked` into `clean`), or after 30 minutes; a method refusal is remembered per repository and method for 30 minutes. The hive never switches the merge method on its own (a forward merge or a `merge-method/merge` PR must not be squashed), so `method-not-allowed` is a manual-merge park. Any other 405, 409 or 422 is still `merge-failed` |
Expand Down Expand Up @@ -621,18 +622,28 @@ contributor who committed from inside a hive pod with the App's noreply
address (hivecommons/pluk#315 and the other OWNERS PRs of 2026-10-20). The
required "Sign-off survives the squash" check is red there, and no hive push
lands on a non-App-authored branch (`review.fix_human_prs` does not authorize
one and the hive must not forge the author's `Signed-off-by`), so the PR
goes back to its author by kind under `hive-signoff-attribution`: `071` for
a human, `072` for a clanker β€” never `070`, where nothing can act. The human
one and the hive must not forge the author's `Signed-off-by`). Who put
those commits there decides the route. When the hive did β€” the
contributor's own self-signed commits sit beside the App-signed ones (mixed
authorship), or the hive recorded pushing the head β€” the contributor has
nothing to fix, so the PR parks at `085` under `hive-signoff-attribution`
for a maintainer, with one `<!-- hive:maintainer-signoff-attribution
head=… -->` note per head naming what clears it (approve the head, merge
with a merge commit, or lift `auto_merge.squash_only`) and no contributor
nudge (projectbluefin/testsuite#991). Only a head made solely of App-signed
commits the hive never pushed β€” a person's own commit made with the App's
identity β€” goes back to its author by kind under
`hive-signoff-attribution`: `071` for a human, `072` for a clanker β€” never
`070`, where nothing can act. The human
gets one comment per head (`<!-- hive:signoff-attribution head=… -->`) with
the exact fix (`git commit --amend --reset-author -s && git push
--force-with-lease`, or the `git rebase --exec` form for several commits);
the clanker's regular 072 nudge carries the same ask. An adoption cannot
fix it by rewriting (the hive may not touch the contributor's authorship,
and a supersede would carry the same head), and the hive's own in-place fix
commits create exactly this shape β€” a contributor commit beside a commit
signed as the App (hivecommons/hive#13777). So on a **`role/trusted`** PR
whose head mixes the contributor's commits with App-linked ones, every
signed as the App (hivecommons/hive#13777). So on a **`role/trusted`** PR,
or any PR whose current head a trusted merger approved, whose head mixes the contributor's commits with App-linked ones, every
commit self-signed and the repo not in `auto_merge.squash_only`, the lane
elects a **merge commit** instead of parking the PR: it puts the hive-owned
`merge-method/merge` label on the PR, posts one
Expand All @@ -650,10 +661,12 @@ re-evaluated on the next sweep with no new head and no human un-park: the
election clears the escalation back to `074` and the lane carries on. Only
when the election is unavailable does an adopted head in this state go to
`085` as `adoption-stalled:hive-signoff-attribution`, whose one note says
why: a squash-only repo (lift `auto_merge.squash_only` or re-author the
head), a non-trusted role (a maintainer `--merge` or a re-authored head,
why: a squash-only repo (lift `auto_merge.squash_only`, or a maintainer
re-authors the hive's commits), a non-trusted role with no approval of the
head yet (a maintainer approves the head or merges with `--merge`,
hivecommons/hive#13623), an unsigned commit, or a head with no contributor
commit left. A self-authored PR stays `070`.
commit left. None of these notes asks the contributor to rewrite the hive's
commits. A self-authored PR stays `070`.

Only a clanker PR has a hive on the other end, so only 072 gets the nudge
comment, the relay interrupt and adoption; a human PR at 071 just sits there
Expand Down
2 changes: 1 addition & 1 deletion src/docs/operator-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ advanced into the merge path.
| `auto_merge.human_merge_paths` | unset | Per-repo map of `owner/repo` to glob patterns (same syntax as `intent.guardrail_path_patterns`) for paths a person must merge, e.g. `Danathar/goodreads-mcp: [".claude/settings.json", ".claude/hooks/**"]`. Every App merge path honors it: the automerge sweep lanes (App self-merge, trusted-author, label-queued) and the agent merge-request relay refuse a PR that touches a listed path, add `hold`, and post one `<!-- hive-human-merge-path -->` comment naming the path(s); a person must merge it. If the changed-file list cannot be fetched completely for a configured repo, the merge is withheld (#11038, #11039). |
| `auto_merge.require_current_base` | unset (off) | Repo list (`owner/repo`) whose App self-merge, trusted-author and contributor lanes only merge a head that contains the current base tip. A green head tested against an older base is updated with GitHub update-branch (a merge commit; no author commit is rewritten) and merges once CI is green on the new head, so a semantic conflict with work merged since turns that PR red instead of breaking the base (#13634). Costs one compare call per merge candidate. |
| `auto_merge.merge_forward_trusted_human` | unset (off) | Repo list (`owner/repo`) where a `role/trusted` + `author/human` PR on a same-repo branch that GitHub reports as conflicting (`dirty`) gets the base merged into its head as one App-authored, signed-off merge commit via the GitHub merges API (no human commit is rewritten), then merges once CI is green on the new head. A real conflict pushes nothing and posts one `<!-- hive:merge-forward-conflict head=… -->` note naming the files both sides changed. Fork heads are never written. Attempted once per head (#13636). |
| `auto_merge.squash_only` | unset (no repo) | Repo list (`owner/repo`) whose branch policy forbids merge commits. Elsewhere, a `role/trusted` PR whose head mixes the contributor's commits with App-linked, App-signed ones (the hive's own in-place adoption fixes), every commit self-signed, is labelled `merge-method/merge` and merged with a merge commit instead of parking at `stage/085` as `adoption-stalled:hive-signoff-attribution`; a listed repo keeps the 085 stall and its note names this key (#13777). |
| `auto_merge.squash_only` | unset (no repo) | Repo list (`owner/repo`) whose branch policy forbids merge commits. Elsewhere, a `role/trusted` PR (or one whose current head a trusted merger approved) whose head mixes the contributor's commits with App-linked, App-signed ones (the hive's own in-place adoption fixes), every commit self-signed, is labelled `merge-method/merge` and merged with a merge commit instead of parking at `stage/085` as `adoption-stalled:hive-signoff-attribution`; a listed repo parks such a head at `stage/085` for a maintainer and its note names this key (#13777). |
| `auto_merge.bot_takeover.enabled` | `true` | When `github-actions[bot]` is in `auto_merge.trusted_bot_authors`, re-author its same-repo PRs whose required `pull_request` checks can never run (the bot opened them with a workflow `GITHUB_TOKEN`). After the head is older than both `min_head_age` and 30 minutes with no `pull_request` run, the App pushes the same change as one signed-off commit to `hive/takeover-<n>`, opens a PR with the original title/body plus `Supersedes #<n>`, comments `Superseded by #N` on the bot PR and closes it. One attempt per bot head SHA. See [hive-merge.md](hive-merge.md#github-actionsbot-pr-takeover). |
| `auto_merge.trusted_authors.enabled` | `false` | Enables the opt-in human-authored PR tier: Hive may merge a green PR only when the author already holds the required hive role and, by default, GitHub push/maintain/admin permission on that repo. |
| `auto_merge.trusted_authors.repos` | empty = all watched repos | Optional repo allow-list for the trusted-author tier. The dashboard renders this as a watched-repo multi-select; selecting nothing preserves the all-repos default. |
Expand Down
3 changes: 3 additions & 0 deletions src/pkg/dashboard/stage_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,9 @@ func humanizeStageReason(reason string) string {
if rest, ok := strings.CutPrefix(r, "base-branch-red:"); ok {
return "waiting for the base branch's CI to recover (" + strings.ReplaceAll(rest, ",", ", ") + ") β€” not this PR's fault"
}
if rest, ok := strings.CutPrefix(r, "fork-guard:"); ok {
return "check " + strings.ReplaceAll(rest, ",", ", ") + " refuses fork PRs β€” a maintainer must push this branch to the repository"
}
if rest, ok := strings.CutPrefix(r, "shared-ci-incident:"); ok {
return "deferred to shared-CI incident #" + rest + " β€” not this PR's fault"
}
Expand Down
1 change: 1 addition & 0 deletions src/pkg/dashboard/stage_tracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func TestHumanizeStageReason(t *testing.T) {
"some-new-token": "some new token",
"base-branch-red:docker (hive),docker (hub)": "waiting for the base branch's CI to recover (docker (hive), docker (hub)) β€” not this PR's fault",
"shared-ci-incident:13208": "deferred to shared-CI incident #13208 β€” not this PR's fault",
"fork-guard:Canary": "check Canary refuses fork PRs β€” a maintainer must push this branch to the repository",
}
for in, want := range cases {
if got := humanizeStageReason(in); got != want {
Expand Down
Loading
Loading