From c855720aaea580fbcd6fdeb091fcc769a6e01eb4 Mon Sep 17 00:00:00 2001 From: Danathar Date: Wed, 28 Oct 2026 13:59:26 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(reaper):=20ask=20for=20a=20D?= =?UTF-8?q?CO=20re-sign=20in=20the=20red-PR=20kick=20only=20when=20DCO=20g?= =?UTF-8?q?ates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `no-dco` is written on every managed repo but gates only where DCO is enforced (#12544): on projectbluefin/utah and bluefin-bling, unsigned mergeraptor and github-actions commits carry it while no DCO check exists. redPRFixKick nonetheless made "re-sign … git push --force-with-lease" the required first step whenever the label was present, so a re-dispatched fixer on a red bot PR in an ungated repo was told to rewrite a branch nothing asked to change. The re-sign stays the required first step when a DCO check (github.IsDCOContext) is among the failing checks; otherwise the kick carries one note to re-sign only if the repository asks for it. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar --- ...ixed-red-pr-kick-resign-only-when-gated.md | 1 + src/cmd/hive/main.go | 13 +++++++++++-- .../hive/redpr_fix_kick_no_ci_wait_test.go | 19 +++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 changelog.d/fixed-red-pr-kick-resign-only-when-gated.md diff --git a/changelog.d/fixed-red-pr-kick-resign-only-when-gated.md b/changelog.d/fixed-red-pr-kick-resign-only-when-gated.md new file mode 100644 index 0000000000..e5fcdcd8b5 --- /dev/null +++ b/changelog.d/fixed-red-pr-kick-resign-only-when-gated.md @@ -0,0 +1 @@ +- **The red-PR fix kick asks for a DCO re-sign only where DCO is enforced.** `no-dco` is written on every managed repo but gates only where the repository enforces DCO ([#12544](https://github.com/hivecommons/hive/issues/12544)); the FIX-BEFORE-NEW kick nonetheless told the fixer, whenever the label was present, to re-sign the PR's commits and `git push --force-with-lease` first — on a Renovate-style bot branch in a repo with no DCO gate, a rewrite nothing asked for. The re-sign is now the required first step only when a `DCO` check is among the failing checks; otherwise the kick carries one note to re-sign only if the repository asks for it. diff --git a/src/cmd/hive/main.go b/src/cmd/hive/main.go index c2ca7483a4..13730183b4 100644 --- a/src/cmd/hive/main.go +++ b/src/cmd/hive/main.go @@ -9306,9 +9306,18 @@ func redPRFixKick(o escalation.Observation, rerouted bool) string { fmt.Fprintf(&b, "Its owning agent (%s) is not reachable right now, so this repair is routed to you.\n\n", redPRFixOwner(o.Agent)) } b.WriteString("Repair it BEFORE claiming new issues or opening any new PR:\n") + // `no-dco` is written on every managed repo but gates only where DCO is + // enforced (hivecommons/hive#12544): a re-sign is the first repair only + // when a DCO check is among the failures. Elsewhere — a Renovate-style + // bot branch in a repo with no DCO gate — demanding a force-pushed + // re-sign would rewrite a branch nothing asked to change. if slices.Contains(o.Labels, stagelabels.NoDCOLabel) { - fmt.Fprintf(&b, " FIRST (required): the PR is %s — it inherited unsigned commits. Re-sign them: gh pr checkout %d --repo %s → git rebase --signoff (original authors preserved) → git push --force-with-lease\n", stagelabels.NoDCOLabel, o.Number, o.Repo) - b.WriteString(" THEN fix any failing CI the same way.\n") + if slices.ContainsFunc(o.FailingChecks, github.IsDCOContext) { + fmt.Fprintf(&b, " FIRST (required): the PR is %s — it inherited unsigned commits. Re-sign them: gh pr checkout %d --repo %s → git rebase --signoff (original authors preserved) → git push --force-with-lease\n", stagelabels.NoDCOLabel, o.Number, o.Repo) + b.WriteString(" THEN fix any failing CI the same way.\n") + } else { + fmt.Fprintf(&b, " Note: the PR carries %s, but no DCO check is failing here; re-sign its commits only if this repository asks for it. Fix the failing CI first.\n", stagelabels.NoDCOLabel) + } } fmt.Fprintf(&b, " gh pr checkout %d --repo %s → fix → git commit -s → git push\n", o.Number, o.Repo) b.WriteString("Push to the SAME branch. Do NOT open a replacement PR.\n") diff --git a/src/cmd/hive/redpr_fix_kick_no_ci_wait_test.go b/src/cmd/hive/redpr_fix_kick_no_ci_wait_test.go index d744b54888..4b3b25bee7 100644 --- a/src/cmd/hive/redpr_fix_kick_no_ci_wait_test.go +++ b/src/cmd/hive/redpr_fix_kick_no_ci_wait_test.go @@ -40,3 +40,22 @@ func TestRedPRFixKickNamesDCORehomeFirstForNoDCO(t *testing.T) { t.Errorf("DCO action leaked into a signed PR's kick:\n%s", plain) } } + +// `no-dco` is written on every managed repo but gates only where DCO is +// enforced (#12544). A red bot PR in a repo with no DCO check must not be told +// to force-push re-signed commits; it gets one soft note instead. +func TestRedPRFixKickDemandsResignOnlyWhenDCOGates(t *testing.T) { + ungated := redPRFixKick(escalation.Observation{Repo: "projectbluefin/utah", Number: 987, Labels: []string{"no-dco"}, FailingChecks: []string{"build_main"}}, false) + if strings.Contains(ungated, "FIRST (required)") || strings.Contains(ungated, "git rebase --signoff") || strings.Contains(ungated, "--force-with-lease") { + t.Errorf("ungated no-dco kick still demands a re-sign:\n%s", ungated) + } + if !strings.Contains(ungated, "no DCO check is failing here") { + t.Errorf("ungated no-dco kick lacks the soft note:\n%s", ungated) + } + for _, gate := range []string{"DCO", "dco"} { + gated := redPRFixKick(escalation.Observation{Repo: "hivecommons/hive", Number: 1, Labels: []string{"no-dco"}, FailingChecks: []string{"build", gate}}, false) + if !strings.Contains(gated, "FIRST (required)") { + t.Errorf("gated (%s) no-dco kick lost the re-sign:\n%s", gate, gated) + } + } +}