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/changed-let-hive-merge-lead.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Tracker 090 *Ready for human merge*: the lead action is now **Approve and let hive merge** (`queue-merge`) β€” hive merges on its next tick once CI is green, soak and self-merge ban apply; **Merge now as maintainer** (`merge-now`, and its *Rebase, then merge as maintainer* variant) is secondary. The automerge sweep now honours an operator's recorded queue-merge approval on an untrusted-author PR and attributes the merge to that operator. On the hive's own PR the App no longer tries to review itself (GitHub 422 "Can not approve your own pull request"): the queue note is a comment, the operator's approval is recorded in the hive's store as the plain Approve records it, and the self-authored lane merges on it; the review-request watcher downgrades such a refused review to a COMMENT instead of retrying.
4 changes: 2 additions & 2 deletions src/docs/api-reference/packs-and-acmm.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/docs/dashboard-copy-inventory.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ twice.** The tests that hold the line are named in the last column.
The new hover, verbatim (title line omitted):

> **Ready to merge. Hive won't merge it alone β€” @odttlnt isn't a trusted author yet.**
> [ Merge it ] [ More β‹― ]
> [ Let hive merge ] [ More β‹― ]
> Asked by the hive Β· 7 hours ago
> Details β–Έ *Hive never merges this on its own; a maintainer merges here or on GitHub. To trust @odttlnt: add them as a merger under βš™ Security β†’ Authorized users. Β· Ready for human merge Β· untrusted author Β· Next move: human β€” a maintainer merges it*

Expand Down Expand Up @@ -60,8 +60,8 @@ The new hover, verbatim (title line omitted):
| `stageTrackerStripItems` 090 chevron tip (`tracker-row.js`) | chevron `title` / popover Details | word + reason + stage description + actor (β‰ˆ 70) | word + reason + actor (β‰ˆ 20) | `TestStageTrackerSentinelLane…` whyTip case |
| `stageTrackerTooltip` author line | row tooltip | `@x (author/clanker, inferred)` | `@x (agent, inferred)`; duplicate lines dropped | `TestStageTrackerRows` |
| `stageTrackerDCOCaveat` | confirm dialogs | 55 | 46 | `TestStageTrackerReauthor…` in `stage_tracker_row_actions_test.go` |
| Confirm: Approve & merge as maintainer | dialog | 76 | 53 | same |
| Confirm: Approve β€” let hive merge | dialog | 62 | 49 | same |
| Confirm: Approve and let hive merge (lead) | dialog | 62 | 49 | same |
| Confirm: Merge now as maintainer | dialog | 76 | 53 | same |
| β‹― menu hints (`stageTrackerLeadActions` β†’ `ham-menu-hint`) | β‹― menu | server consequences (11–31 each) | server consequences (≀ 12 each) | Go budget test |
| `stageTrackerOpenTriageNeeded` β†’ `stageTrackerSegments` / `stageTrackerHeadline` Open word (`tracker-row.js`, `tracker-words.js`) | Open chevron, chevron hover first word, row tooltip headline | *New Β· since 28m* on a reporter-trust hold; the ask lived only in the caption ([#15437](https://github.com/hivecommons/hive/issues/15437)) | *Triage needed Β· since 28m* (same word as the `needs-triage` chip / 015) | `TestStageTrackerNewRowRendering`, `TestStageTracker_ReporterTrustHoldReadsTriageNeeded` |
| `stageTrackerTriageNeededCaption` (`stageTrackerCaption` 015, `stageTrackerNewState` hold text) | row caption, feed | 110 ("Actionable, but no maintainer has looked at it yet; waiting for triage β€” triage needed: carries needs triage": *triage* Γ—3 after the chevron word) / 84 ("New Β· waiting for a maintainer's triage (add `triage/accepted`); the hive's next pass in 7m") | 31 ("Triage needed β€” accept or close"; the next-mover and next-pass narration stay on the chevron hover) | `TestStageTracker_TriageNeededStage`, `TestStageTracker_ReporterTrustHoldReadsTriageNeeded`, `TestStageTrackerNewState` |
Expand Down
24 changes: 12 additions & 12 deletions src/docs/dashboard-sections.md

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/docs/hive-merge.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,9 @@ carries such a PR either. The prefixes and labels are configurable via
When the PR is otherwise merge-ready (green checks, approvals satisfied) the
stage tracker parks it at **090 Ready for human merge** with the chip
*human merge* and the reason *breaking change β€” owner merges*; the owner
merges it with **Approve & merge as maintainer** (the existing gated
operator path) or on GitHub. Hive posts one comment, through the writeback
merges it with **Merge now as maintainer** (the existing gated operator
path; **Approve and let hive merge** is greyed, since the lanes never
merge a breaking change) or on GitHub. Hive posts one comment, through the writeback
gate, saying it will wait for a human. The rule exists because a ⚠️-titled
PR was auto-merged by the trusted-author lane while its owner was still
deciding whether to ship it.
Expand Down
2 changes: 1 addition & 1 deletion src/docs/labels-and-control-signals.md
Original file line number Diff line number Diff line change
Expand Up @@ -2423,7 +2423,7 @@ The plain-words comment the delegate posts has four lines β€” **Hive decided** (
| `adoption-executing` | the adoption engine is carrying it out | The decision is recorded and the adoption engine picks it up on its next stage pass (a few minutes): it pushes the commits to a hive branch and opens the hive's copy. Nothing to do yet. |
| `adoption-stalled:contributor-lane:workflow-path`, `capability:workflows-permission`, `contributor-lane:workflow-path`, `workflow-path` | the PR edits .github/workflows; the hive's App lacks the `workflows` permission, so it cannot adopt it | The PR changes files under .github/workflows. The hive's GitHub App has no `workflows` permission, so the adoption fence refuses to publish those edits from the hive. Grant the App the `workflows` permission and re-run the decision, or have a person rebase and merge it on GitHub, or close it as superseded. |
| `adoption-undone` | the hive's copy was closed without merging and the adoption was undone | The hive opened its copy, but the copy was closed without merging and a fresh one could not be opened, so the adoption was undone and the PR is back in its normal flow. Re-run the decision to adopt it again, or act on GitHub. |
| `author-association`, `contributor-lane:author-association`, `human-merge`, `ready-for-human-merge`, `untrusted-author` | no merge lane vouches for this PR's author; a maintainer merges | The PR is ready, but its author is not a collaborator and holds no trusted or merger tier, so no merge lane vouches for them and the hive never merges it unattended. A maintainer merges it (Approve & merge as maintainer, or Approve β€” let hive merge), or trusts the author under πŸ‘₯ Contributors. |
| `author-association`, `contributor-lane:author-association`, `human-merge`, `ready-for-human-merge`, `untrusted-author` | no merge lane vouches for this PR's author; a maintainer merges | The PR is ready, but its author is not a collaborator and holds no trusted or merger tier, so no merge lane vouches for them and the hive never merges it unattended. A maintainer approves it (Approve and let hive merge β€” hive merges on the next tick once CI is green β€” or Merge now as maintainer), or trusts the author under πŸ‘₯ Contributors. |
| `author-online` | the author's clanker or hive is connected, so hive won't take the PR over | Adoption is for authors whose clanker or hive has gone offline; this author's is connected, so the hive leaves the PR with them. |
| `blocker`, `capability`, `human-only` | the hive can't do this itself | The item is blocked on something the hive cannot do: a permission the GitHub App lacks, or a step only a person may take. No decision clears it; grant the permission (and re-check) or do the step by hand (hivecommons/hive#15099). |
| `behind` | the branch is behind the base branch | The branch is behind the base branch and must be updated before it can merge. |
Expand Down
6 changes: 3 additions & 3 deletions src/docs/operator-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -478,9 +478,9 @@ verified owner or an authorized user with the `merger` role:

| Decision | What it does | Audit / ledger |
|---|---|---|
| `merge-now` β€” *Approve & merge as maintainer* | Comments on the PR that @you merged it from the dashboard, then merges it at once through the hive's GitHub App (`MergePRVia`, audit path `dashboard`). Refused when the PR is merged or closed, or when you are its author. | `repo_item_decision_merge`; `last_operator_action.action: merge-now`; toast *merged*. |
| `merge-now` β€” *Merge now as maintainer* (secondary; *Approve and let hive merge* leads) | Comments on the PR that @you merged it from the dashboard, then merges it at once through the hive's GitHub App (`MergePRVia`, audit path `dashboard`). Refused when the PR is merged or closed, or when you are its author. | `repo_item_decision_merge`; `last_operator_action.action: merge-now`; toast *merged*. |
| `merge-now` on a PR whose `mergeable_state` is `dirty` or `behind` β€” *Rebase, then merge as maintainer* | Never a GitHub 405. Records your approval first (/lgtm + /approve naming you), arms a rebase-then-merge follow-through (`/data/rebase-merge-followups.json`), kicks the rebase (update-branch on the hive's own PR when only behind; otherwise the fixer lane, which owns a parked PR with an armed follow-through), and answers `202 rebase-queued`. A 2-minute ticker then reads the PR: `mergeable_state: clean` on the rebased head β†’ merges it with your approval attributed; still `dirty` after 2 h, CI red, or no rebase within the deadline β†’ `failed` with the conflicting files and the options *Adopt into fresh branch* / *Close as superseded* (also left as a note on the PR). Refused on a fork whose author has not allowed maintainer edits (`head-not-pushable`). The approval is bound to the head you read: a new head on a contributor's PR counts as the rebase only when GitHub says the hive committed it (the fixer's rebase or update-branch under the App); a head anyone else pushes after your click settles the follow-through as `failed` (`foreign-head`) with nothing merged, a note on the PR, and *Approve the new head & merge* / *Close as superseded* as the ways out. | `repo_item_decision_merge` with `status: rebase-queued`; `last_operator_action.action: merge-now`, outcome `pending` β†’ `applied` / `failed`, `followed[]` steps `approval-recorded`, `rebase-kicked`, `rebased`, `ci-green`, `merged` / `failed`; row `rebase_merge.state`; toast *rebase queued, merge to follow*. |
| `queue-merge` β€” *Approve β€” let hive merge* | Leaves an `APPROVED` review in your name with a note, adds the automerge label, and leaves the merge to the App self-merge sweep, which merges on its next pass once CI is green and the head has soaked. Refused on your own PR. | `repo_item_decision_queue_merge`; `last_operator_action.action: queue-merge`; toast *queued for merge*. |
| `queue-merge` β€” *Approve and let hive merge* (lead) | Admits the head (`admitted_by: operator-approval:<you>`), leaves an `APPROVED` review in your name with a note, adds the automerge label, and leaves the merge to the hive's auto-merge sweep, which merges through its own App on the next tick once CI is green and the head has soaked. On an untrusted author's PR that admission is the one thing that lets the trusted-author lane merge it: the lane's `untrusted-author-role` skip yields to the recorded approval for that exact head, and the merge comment names you (*merged by Hive on behalf of @you …*). Refused on your own PR. | `repo_item_decision_queue_merge`; `last_operator_action.action: queue-merge`; toast *approved β€” hive will merge on the next tick once CI is green*. |

**Approve is the trust override for that head
([#15136](https://github.com/hivecommons/hive/issues/15136)).** Before, an
Expand Down Expand Up @@ -513,7 +513,7 @@ decision instead of answering that it cannot merge

| PR head | Hive decides | βœ“ hover |
|---|---|---|
| review passed (no reviewing / changes-requested / requires-human `review.verdict_labels` label), CI green, mergeable | approve β€” the same path as *Approve β€” let hive merge* (needs the `merger` role): admits the head (`admitted_by: operator-approval:<you>`), approves it and adds the automerge label; no adoption, and the sweep merges the PR under its own number after soak | *hive decided: approve Β· review passed, CI green* |
| review passed (no reviewing / changes-requested / requires-human `review.verdict_labels` label), CI green, mergeable | approve β€” the same path as *Approve and let hive merge* (needs the `merger` role): admits the head (`admitted_by: operator-approval:<you>`), approves it and adds the automerge label; no adoption, and the sweep merges the PR under its own number after soak | *hive decided: approve Β· review passed, CI green* |
| CI red | adopt in supersede mode | *hive decided: adopt Β· CI red* |
| conflicting | adopt in supersede mode to rebase | *hive decided: adopt Β· conflicting, needs rebase* |
| review not passed | adopt in supersede mode | *hive decided: adopt Β· review not passed* |
Expand Down
2 changes: 1 addition & 1 deletion src/docs/scale-envelope.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ones to:
2. **Truncation must preserve the prioritization signal, not cut an arbitrary slice.**
This holds today and is easy to assume backwards:
- Issues are sorted by actionable rank tier, then **oldest first** within each tier before any cap is applied
(`RankActionableIssues`, `src/pkg/github/client.go:4859-4869`, descending `AgeMinutes` within each tier).
(`RankActionableIssues`, `src/pkg/github/client.go:4936-4946`, descending `AgeMinutes` within each tier).
- PRs are sorted by **review class then oldest-first within class**
(`SortPullRequestsForReview`, `src/pkg/github/review_priority.go:334`;
fixes β†’ refactors/docs β†’ tests).
Expand Down
19 changes: 17 additions & 2 deletions src/pkg/dashboard/api_repo_item_decide_delegated.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package dashboard

import (
Expand Down Expand Up @@ -791,10 +791,25 @@
continue
}
if mergerRole {
if err := client.QueuePRAutoMergeWithNote(ctx, repoFull, number, user, marker); err != nil {
queued, err := client.QueuePRAutoMergeWithNoteResult(ctx, repoFull, number, user, marker)
if err != nil {
return notes, fmt.Errorf("approving PR head: %w", err)
}
notes = append(notes, "Approve review submitted on the head and queued for auto-merge (the engine merges per repo settings)")
if queued.ReviewSubmitted {
notes = append(notes, "Approve review submitted on the head and queued for auto-merge (the engine merges per repo settings)")
} else {
// The hive's own PR: no review is possible, so the
// operator's approval goes on record the way Approve
// records it and the self-authored lane merges on it.
if _, err := client.RecordOperatorPullRequestApprovalWith(ctx, repoFull, number, user, ghpkg.PullRequestApprovalOptions{
HumanChangeRequests: repoItemDecisionChangeRequests(),
LiftNeedsHuman: true,
SentinelLabel: s.sentinelLabel(),
}); err != nil {
return notes, fmt.Errorf("approving PR: %w", err)
}
notes = append(notes, "approval recorded on the hive's own head and queued for auto-merge (the App cannot review its own pull request; the self-authored lane merges once CI is green)")
}
} else {
if _, err := client.RecordOperatorPullRequestApproval(ctx, repoFull, number, user); err != nil {
return notes, fmt.Errorf("approving PR: %w", err)
Expand Down
33 changes: 19 additions & 14 deletions src/pkg/dashboard/api_repo_item_decide_delegated_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
// the button expecting an approval and got three superseding PRs: "I was
// not asked to supersede them". The SPA now asks for the plan first and
// shows a confirm popover β€” Hive would: …; Why: … β€” with [Let hive do
// that] [Approve & merge as-is] [Cancel]; nothing is written until a
// that] [Approve and let hive merge] [Cancel]; nothing is written until a
// button is pressed, and the ledger records which one.

// delegatedDecisionPlan is the wire shape of POST …/decide-delegated/plan:
Expand Down Expand Up @@ -50,10 +50,11 @@ type delegatedDecisionPlan struct {
// and the rungs ruled out above it (hivecommons/hive#15289); the
// dialog shows it under Details.
Ladder *delegatedecision.Ladder `json:"ladder,omitempty"`
// MergeableAsIs is true when "Approve & merge as-is" is an honest
// alternative: the ladder said mergeable-as-is, or (no ladder) the head
// is green, conflict-free and signed off. When false the merge-now
// alternative is left out so the dialog cannot contradict itself.
// MergeableAsIs is true when "Approve and let hive merge" (and the
// secondary merge-now) is an honest alternative: the ladder said
// mergeable-as-is, or (no ladder) the head is green, conflict-free and
// signed off. When false both merge alternatives are left out so the
// dialog cannot contradict itself.
MergeableAsIs bool `json:"mergeable_as_is"`
// Alternatives are the other buttons, in the popover's option shape;
// the SPA adds Cancel itself.
Expand All @@ -67,8 +68,9 @@ type delegatedDecisionPlan struct {
Notes []string `json:"notes,omitempty"`
}

// delegatedPlanAlternativeLabel is the preview's approve-as-is button.
const delegatedPlanAlternativeLabel = "Approve & merge as-is"
// delegatedPlanAlternativeLabel is the preview's merge button: the
// operator approves and the hive merges on its next tick once CI is green.
const delegatedPlanAlternativeLabel = decisionQueueMergeLabel

func (s *Server) handleRepoItemDecideDelegatedPlan(w http.ResponseWriter, r *http.Request) {
owner, repoName, number, ok := s.parseRepoItemPath(w, r)
Expand Down Expand Up @@ -155,11 +157,13 @@ func (s *Server) planDelegatedDecision(ctx context.Context, repoFull string, num
}
kept := plan.Alternatives[:0]
for _, alt := range plan.Alternatives {
if alt.Action == decisionActionMergeNow {
if alt.Action == decisionActionMergeNow || alt.Action == decisionActionQueueMerge {
if !plan.MergeableAsIs {
continue
}
alt.Label = delegatedPlanAlternativeLabel
if alt.Action == decisionActionQueueMerge {
alt.Label = delegatedPlanAlternativeLabel
}
}
kept = append(kept, alt)
}
Expand Down Expand Up @@ -308,7 +312,7 @@ func delegatedPlanPlain(text string) string {
return strings.TrimSuffix(strings.TrimSpace(text), ".")
}

// delegatedPlanMergeableAsIs says whether "Approve & merge as-is" is an
// delegatedPlanMergeableAsIs says whether "Approve and let hive merge" is an
// honest alternative: the ladder's own verdict when it ran, otherwise the
// head's facts. A preview that says the head is not mergeable must not
// offer to merge it (hivecommons/hive#15332's dialog).
Expand All @@ -322,8 +326,8 @@ func delegatedPlanMergeableAsIs(in delegatedecision.Input, d delegatedecision.De
return !in.Conflicting && in.CIGreen && !in.DCOMissing
}

// delegatedPlanAlternatives are the other buttons: approve & merge as-is
// (merge-now, in-tracker, for a merger) or approve and let hive merge,
// delegatedPlanAlternatives are the other buttons: approve and let hive
// merge (queue-merge, the lead, for a merger), merge now as maintainer,
// send back, close as superseded.
func delegatedPlanAlternatives(in delegatedecision.Input, d delegatedecision.Decision, mergerRole bool) []StageTrackerDecisionOption {
if in.Kind != delegatedecision.KindPR {
Expand All @@ -333,8 +337,9 @@ func delegatedPlanAlternatives(in delegatedecision.Input, d delegatedecision.Dec
}
opts := delegatedHumanMergeOptions(in, in.Number, mergerRole)
if d.Verdict == delegatedecision.VerdictApprove {
// The hive would approve anyway: the as-is merge is the same thing
// done now.
// The hive would approve anyway, so "Approve and let hive merge" is
// the primary button under another name; merge-now is the one
// alternative left that does something different.
for i := range opts {
if opts[i].Action == decisionActionQueueMerge {
opts = append(opts[:i], opts[i+1:]...)
Expand Down
Loading
Loading