Repository navigation
π adoption: keep a same-repo PR in place across a base workflow change when the fixer can push it - #19308
Conversation
β¦e when the App can push it canPushToPRBranch ran baseSyncTouchesWorkflows before its same-repo check, and baseSyncTouchesWorkflows assumed the App can never push a base-sync that carries a .github/workflows/ change. That holds for a fork head (the fork is not in the installation), but on a branch of the base repository the push lands once the installation grants workflows: write. So the hive superseded same-repo PRs it could have adopted in place, closing them and losing their approvals (projectbluefin/common#1689 -> hivecommons#1708, hivecommons#1690 -> hivecommons#1710). A same-repo head now supersedes on a base workflow change only when hgithub.Client.WorkflowsPushable is false (no grant, or no trusted or merger lane serving the repo). Fork heads and compare failures behave as before. Adopted-PR recovery also logs a refused update-branch with the merge sweep's reasons (fork-workflow-update, workflow-permission) instead of the catch-all update-branch-failed, which is what projectbluefin/utah-packages#1173 and projectbluefin/actions#752 showed: both are fork heads that no App grant can update. 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>
β¦, not any lane Review of the previous commit: WorkflowsPushable asks whether any trusted or merger lane serves the repo, but an adopted head that conflicts (or stays red) is pushed by the fallback fixer that routeConflictFixAgent picks, scanner. A hive with ci-maintainer at trusted and scanner at contributor tier passed the gate, adopted in place, and then scanner's push was refused, the hivecommons#12865 dead end. - pkg/github: FallbackFixAgent is the one name for that fixer, used by routeConflictFixAgent and the adoption sweep. AgentWorkflowsPushable reports an agent's own capability: its tier asks for Workflows (SetWorkflowsSelfPushFunc) and the installation grants workflows: write. - automerge: baseSyncTouchesWorkflows keeps a same-repo head in place only when AgentWorkflowsPushable(FallbackFixAgent) holds. The comment now says the premise of hivecommons#12865 changed (hivecommons#14664 found the grant; pr_merge_state.go fences only forks). - Tests: TestAgentWorkflowsPushable for the real predicate (contributor fixer with the grant, trusted fixer, token client, read-only grant, failed read); TestAdoptedRecoveryForkWorkflowRefusalNamed drives recoverByUpdateBranch end to end on a fork head. - Docs and changelog name the fixer condition and the DCO in-place repair it also unlocks. 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>
|
[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 |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
Hive status β updated in place; edits do not notify. Full history is in the Activity Monitor. Evidence bundle `#193084a39e77` sha256:87f5d0ff63a1d6d328da5849dc28a80d4e28ae02739935bf9f3e12b8406041a5 β download from the dashboard or `hivectl review evidence #19308`.merged by Hive trusted-author auto-merge: author |
When a base-sync carries
.github/workflows/changes, an adopted same-repo PR now stays on its own branch if the agent that would rebase it can push workflow files. Before, it was always closed and re-opened as a copy. Fork heads are unchanged.What was wrong
#12865 / #12872 superseded every adopted PR whose base-sync touched
.github/workflows/. That was deliberate at the time. Its premise came from #6985: the App had no Workflows grant, so neither a fork nor the base repo could take the push.The premise has since changed. Installations now grant
workflows: write(#14664), and v6'spr_merge_state.goalready fences only forks. Same-repo PRs were still being closed and re-opened, losing their approvals and numbers. On 11-18, projectbluefin/common#1689 was superseded into #1708, and castrojo's approval was lost. The log line was "base-sync touches .github/workflows/ which the App cannot push; superseding". No GitHub call had been refused.What it wasn't: the governor's update-branch token isn't missing the grant. It's an unscoped installation token (
AppAuth.Token(), minted with no options), so it carries every installation permission. The two 403s from 11-19 have different causes:BranchUpdateForkWorkflowUpdate).What changed
routeConflictFixAgentβscanner). Red CI on an adopted head goes there too. So the gate asks that agent, not "any trusted lane":AgentWorkflowsPushable(ctx, FallbackFixAgent)needs the agent's tier to request Workflows (trusted or merger) and the installation to grantworkflows: write.FallbackFixAgentis now one shared constant used by bothrouteConflictFixAgentand automerge.fork-workflow-updateorworkflow-permissioninstead of the catch-allupdate-branch-failed.On a hive whose
scanneris below the trusted tier, these PRs still supersede. That's safe, and the docs now say so.Tests
TestAgentWorkflowsPushablecovers the real predicate:TestAdoptionInPlaceWorkflowGuardHonoursGrantcovers four outcomes: the fixer can push β in place; it can't β supersede; a compare error β supersede; no workflow change β no capability read. It also asserts that the agent asked isFallbackFixAgent.TestAdoptionForkWorkflowGuardIgnoresGrant: a fork with the grant is still not adopted or copied, and the grant isn't read.TestAdoptedRecoveryForkWorkflowRefusalNamed(end to end): a fork head 18 behind whose update-branch gets the 403 logsskipped:fork-workflow-update, with no copy.TestAdoptionRecoveryUpdateBranchSkipchecks the reason mapping.labels-and-control-signals/stage-labels.md(in-place and supersede modes) andhive-merge.md(recovery reasons). Changelog:changelog.d/fixed-adopt-in-place-workflows-grant.md.No App permission change is needed or proposed.
π€ Generated with Claude Code
https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1