Repository navigation
✨ feat(github): merge the base into a red PR whose failing checks are now green on the base tip - #17544
Conversation
… green on the base tip A PR that went red on a check its base also broke stays red after the base is fixed: a re-run reuses the old merge ref, so only a new head picks the fix up. projectbluefin/actions#544 sat red on pytest for six hours after main repaired the baseline (projectbluefin/actions#734), until a person pressed "Update branch". The automerge lanes only do this for PRs the hive adopted, and never in repositories with auto-merge off. The eval cycle now runs a stale-red base refresh (at most every 5 minutes, an unstick step): for an open PR that is red on named checks, behind its base, with every failing check completed green on the current base tip, it calls update-branch pinned to the evaluated head. It skips drafts, held and exempt PRs, open shared-CI incidents, base-red checks, forks without maintainer edits, dependency-bot branches, stage 072 and 074, and repos whose base refresh belongs to the automerge preparation front. At most 2 updates per repo and 6 per pass, once per (head, base tip). Each update goes through a new base_refresh write-back kind (hive-authored PRs, else L6 with the opt-in label), and the reaper holds its fix kick for a PR it refreshed in the same cycle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar <Danathar@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Read the diff against v6 at merge-base 292d11d and the code it leans on. This looks correct to me, and the body matches what the code does.
What I verified in the tree:
- Every helper the new code calls exists with the signature used:
latestCheckRunsByNameAndApp(commit_ci.go:1079),checkConclusionIsRed(:749),isMetaCheck(client.go:2975),UpdateBranchExpectedHead/IsUpdateBranchStaleHead(pullrequest.go:635-660),ClassifyBranchUpdateError,baseRefreshScheduled,BranchHead,WritebackItemForPR/WritebackAllowed, and incmd/hivehasLabel,fullRepoName,reaperSkipAfterRerun,budgetDecision.SkipUnstick,dashSrv.AuditLogRecord. CompareCommits(base.SHA, pr.HeadSHA)→BehindByis the right direction (commits on base the head lacks).- The update is pinned to the enumerated head and the memo key is
(head, base tip), so a head that moves under the request ishead-moved, unsettled, and re-evaluated next pass rather than merged onto unseen commits — same discipline as the automerge current-base gate. - Verdict logic is conservative in the right direction: a base-red check wins over unknown, and a check with no completed run on the base tip (PR-only check, or still running) blocks the refresh rather than being assumed fixed.
KindBaseRefresh {MinLevel: 6, RequireLabel: true}matchesKindCIRerun, which is the closest existing unsolicited-write kind, and the acmm matrix / write-surface docs were updated in step.- The skip list in
staleRedRefreshSkipmatches the body's list (draft, held/exempt, not-red, CI running, shared-CI incident, base-red, fork without maintainer edits, dependency bot, stage 072/074).
One open question, not a finding: pr.FailingChecks can presumably include failures reported as commit statuses (Prow-style contexts), while StaleRedBaseStateFor reads only check runs on the base tip. If so, a PR whose only red item is a status context will always get base-unknown and never be refreshed. That is the safe failure mode, so it only matters if the projectbluefin repos in the report rely on statuses; worth a line in the sweeps doc if it does.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. Review findings from Read the diff against the v6 tree plus the helpers it calls. The code looks correct to me; the one thing I cannot settle is the policy question the body itself raises, so I'm routing that rather than guessing. Decision needed (from the PR body, "Deliberate exception"): What I verified as correct:
Non-blocking observation: |
Keep both new docs sections: the shared-CI tracking issues sweep and the stale-red base refresh (hivecommons#17544). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar <Danathar@users.noreply.github.com>
Summary: When a PR goes red on a check its base branch also broke, fixing the base does not fix the PR: a re-run reuses the old merge ref, so the PR stays red until someone presses "Update branch". The hive already does that for PRs it adopted, but for nothing else, and never in a repository with auto-merge off. This adds a small, capped eval-cycle step that merges the base into a red PR that is behind its base when every failing check has completed green on the current base tip. It goes through a new
base_refreshwrite-back kind, so on someone else's PR it needs L6 plus the opt-in label unless the operator widens it.What went wrong
01f4643(2026-11-09 23:06Z) was red onpytest(test_zizmor_baseline_pins), inherited from main at460aab7, wherepytestwas also red. Main repaired it with fix(pinned-fetches): skip only the gate checkout at the scan root projectbluefin/actions#734 (09d8fba, 05:00Z on 2026-11-10,pytestgreen). The PR stayed red and behind until a maintainer pressed "Update branch" at 11:33Z, andpytestthen passed on0cc822c.projectbluefin/actionshas auto-merge off (every automerge lane logsrepo-auto-merge-disabled), so the adoption recovery (automerge_adoption_recovery.go) never saw it. The current-base gate and the "behind" update only run for PRs that are otherwise ready to merge. The hold guard and the PR follow-up base sync only act onbehind/dirtymergeable states, and GitHub reports neither when up-to-date branches are not required. The shared-CI rerun only re-runs jobs, which reuses the old merge ref.fork-workflow-update). actions#731 stayed red after its manual update, so the failure was its own.What changes
refreshStaleRedBehindPRs, runs at most every 5 minutes just before the stuck-PR reaper. It is an API-budget unstick step, so it is shed only incriticalmode and on cached-snapshot cycles.auto_merge.require_current_base.update-branchpinned to the evaluated head. It runs once per (head, base tip), with at most 2 updates per repo and 6 per pass, and posts no comment. Each update is logged and audited asstale-red-base-refresh, and the reaper does not kick a fixer for that PR in the same cycle.base_refresh, default{min_level: 6, require_label: true}. It is always allowed on hive-authored PRs. On other PRs it needs the opt-in label, orwriteback.kinds.base_refresh.unlabeled_min_level: 6.needs-human(and the other gated-band labels) are not skipped. The dashboard's Gated band says "automation does not continue" on them, but this step only brings the branch up to date (the same as GitHub's "Update branch" button, pinned to the head it checked); it never merges, approves or decides. The one real case behind this PR, ci(reusable-sync-branches): make force-reset opt-in, never on the default branch projectbluefin/actions#544, carriesneeds-human, and a maintainer did exactly this update by hand. If owners prefer the strict reading, skipping them is a one-line change instaleRedRefreshSkip.Files
src/pkg/github/stale_red_base_refresh.go: reads the base tip state, gives the verdict, and does the gated compare + update-branch.src/cmd/hive/stale_red_base_refresh.go: candidate filter, caps, interval and memo.main_eval_cycle.gowires it in.apibudget.golists it as an unstick step.src/pkg/writeback/kinds.go,dedupe.go: thebase_refreshkind.operator-reference/sweeps-and-operations.md(new section, write-surface table row, budget list),operator-reference.mdindex,github-write-surface.md,acmm-policy-matrix.md.design/agent-turn-model.mdgets two line citations ofmain_eval_cycle.gothat shifted.changelog.d/added-stale-red-base-refresh.md.Tests
None were run locally (repo AGENTS.md). CI is the verdict.
pkg/github:TestStaleRedBaseVerdictFor,TestStaleRedBaseStateFor(newest run wins, running and meta checks ignored) andTestRefreshStaleRedPR. The last one covers a behind PR updated and pinned to its head, a current PR, a gate refusal making no call, a foreign PR without the label refused, a repo owned by automerge, a conflict that settles, and a head that moved staying open.cmd/hive:TestRefreshStaleRedBehindPRs_OncePerHeadAndBaseTip,_Interval,_BaseMustClearEveryFailingCheck,_PerRepoCap,_ErrorRetriesNextPassandTestStaleRedRefreshSkip.pkg/writeback:TestKindSetsnow listsbase_refreshamong the kinds that are not content-deduped.Refs projectbluefin/actions#544
🤖 Generated with Claude Code
https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1