Skip to content

✨ dependency-bot: opt-in hive adoption of red dependency-bot PRs that need a code change - #18510

Closed
Danathar wants to merge 2 commits into
hivecommons:v6from
Danathar:fix/dep-bot-red-ci-adopt
Closed

Danathar wants to merge 2 commits into
hivecommons:v6from
Danathar:fix/dep-bot-red-ci-adopt

Conversation

@Danathar

Copy link
Copy Markdown
Contributor

Some dependency bumps need a code change before they can go green. The fix loop never pushes to another bot's branch, so today the hive only hands such a PR to a person, and that person's one step is clicking Adopt. This PR adds an opt-in switch, off by default, that lets the hive take that step itself. When the review swarm asked for changes on the red head, the dependency-bot sweep adds the same adoption/supersede label the dashboard adds.

What changes

  • The switch only acts at the moment the dependency-bot sweep's red-CI hand-off would fire: red on the same head for 4 hours, and after the transient re-run hold.
  • It applies to a dependency-bot PR (Renovate, Dependabot, mergeraptor) whose bot is also in auto_merge.trusted_bot_authors.
  • It reads the swarm's own aggregate verdict for exactly that head from review-verdicts.json. This is the raw verdict, not the trusted-bot lane's advisory downgrade, which normalizes it to advisory.
  • If the verdict is changes_requested, the sweep adds adoption/supersede once per bot head and posts no hand-off for that head. The write is gated as write-back kind contributor_adopt and logged as one INFO line with the repo, PR, head and reason.
  • The existing adoption path is unchanged. It copies the PR to hive/adopt-<n>, and the fix loop repairs the copy.
  • Requests persist per head in dependency-bot-conflicts-adopt.json, so a restart does not repeat one. A new bot head is eligible again.
  • The person hand-off stays in these cases:
    • the switch is off;
    • the head has no changes_requested verdict (missing, advisory, approve or requires_human);
    • the PR has hold, do-not-merge or a human-merge label or title prefix;
    • the head touches auto_merge.human_merge_paths (the pin-only exception is honored) or its files cannot be read;
    • stage adoption is off on the hive;
    • the write-back gate refuses the write.
  • If the label write fails, the head is not asked again, and the person gets the hand-off on the next pass.
  • pkg/github gains a read-only Client.HumanMergePathHeld. The relay's pin-only check moved into a shared helper and behaves the same.
  • With the switch off, behaviour is unchanged.

Setting

  • auto_merge.dependency_bot_adopt.enabled, default false.
  • Dashboard: Settings → Features → Auto-merge → "Adopt red dependency-bot PRs that need a code change". Saved through PUT /api/config/auto-merge as dependency_bot_adopt_enabled.
  • Admin MCP: the auto_merge.update field dependency_bot_adopt_enabled. Turning it on counts as widening.
  • Docs: hive-merge.md (new section), the operator reference table and the dependency-bot bullet, and the write-path table in sweeps-and-operations.md.

Evidence

In projectbluefin/chairlift on 2026-11-16:

Tests

  • cmd/hive/dependency_bot_adopt_test.go:
    • switch off keeps the hand-off;
    • red past the grace with changes_requested gives exactly one label request and no hand-off;
    • the same head again, including after a restart, gives no second request;
    • a new head is eligible again;
    • a held PR, a needs-owner-merge label, a human-merge path, an unreadable path check, stage adoption off, an untrusted bot, and every non-changes_requested verdict (including one on another head) each keep the hand-off;
    • a green PR does nothing;
    • a failed label write falls back to the hand-off on the next pass;
    • head-exact verdict lookup;
    • the policy built from config.
  • pkg/github: TestHumanMergePathHeld covers unconfigured, no match, match, moved head, fail-closed errors, and the pin-only exception admitting or not. It also checks that the call writes nothing.
  • The setting round-trips through config (pkg/config), the dashboard API and its rendered toggle (pkg/dashboard), and the admin MCP op (pkg/adminmcp). The golden config is updated.
  • Locally only gofmt -l was run, per AGENTS.md. static/index.html was regenerated by concatenating static-src in manifest order, the generator's documented byte-for-byte contract; the unchanged tree reproduced the committed file exactly first.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1

… need a code change

Add auto_merge.dependency_bot_adopt.enabled (default off). With it on, the
dependency-bot sweep, at the point it would hand a red trusted-bot
Renovate/Dependabot/mergeraptor PR to a person (red on the same head past
the 4h grace and the transient re-run hold), reads the review swarm's own
aggregate verdict for exactly that head from review-verdicts.json. When it
is changes_requested, it adds adoption/supersede (the dashboard Adopt
decision's label) once per bot head, gated as write-back kind
contributor_adopt, and posts no hand-off for that head. The existing
adoption path copies the PR to hive/adopt-<n> and the fix loop repairs it.

Held, human-merge-labelled or -titled PRs, heads touching
auto_merge.human_merge_paths (read-only check sharing the relay's pin-only
exception), heads without a changes_requested verdict, hives with stage
adoption off and write-back refusals keep the person hand-off. A failed
label write is recorded for the head and the hand-off follows next pass.
Requests persist in dependency-bot-conflicts-adopt.json.

The setting is wired through config, PUT /api/config/auto-merge
(dependency_bot_adopt_enabled), the Features → Auto-merge toggle and the
admin MCP auto_merge.update op, with docs and a changelog fragment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1
Signed-off-by: Danathar <6772335+Danathar@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 16, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign danathar for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Nov 16, 2026
@hivecommons-hive

hivecommons-hive Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

@Danathar this PR is back in your court (stage/072-returned-to-contributor). The hive will not merge it until the head changes.

Review asks:

  • the branch conflicts with the base and needs a rebase

Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path.

Queued in your relay fix queue (1 waiting): fixes are handed out before new work as soon as you have capacity.

The sweep's write calls moved into sweepDependencyBotConflictsWith, so
the notification write-site inventory and its doc row name that function.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1
Signed-off-by: Danathar <6772335+Danathar@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

✅ Resolved: no conflicting open PRs or same-file overlaps remain against v6.

@github-actions github-actions Bot added conflicts-with-open-pr Open PR has a merge conflict with another open PR and removed conflicts-with-open-pr Open PR has a merge conflict with another open PR labels Nov 16, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@clubanderson asked the hive to adopt this pull request now, without waiting for its author's hive. The hive opens its own PR carrying the author's commits and sign-off unchanged on the pass now running; this PR closes when that copy merges.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Superseded by hive: re-authored as #18529 with the same commits and sign-off because CI stayed red and the author was unavailable. This PR is closed; if #18529 fails, hive reopens it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adoption/supersede Owner-delegate request: adopt now in supersede mode dco-signoff: yes Indicates the PR's author has signed the DCO. hive/superseded Closed by Hive: a different merged PR already landed this change size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant