Skip to content

πŸ› fix(adoption): name the branch update a person must run when a fork PR is blocked by base workflow changes - #17549

Merged
hivecommons-hive[bot] merged 1 commit into
hivecommons:v6from
Danathar:fix/fork-workflow-sync-park
Nov 10, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
hivecommons:v6from
Danathar:fix/fork-workflow-sync-park

Conversation

@Danathar

Copy link
Copy Markdown
Contributor

Summary: When a contributor's fork PR falls behind a base that changed .github/workflows/, the hive cannot bring the fork up to date. GitHub refuses any App push to a fork that carries a workflow change, whatever the App is granted on the base repository. The hive already handles this in the merge sweep: it tries update-branch and parks with fork-workflow-update, naming the exact step. The adoption path did not do the same. There the PR parked at 085 as adoption-stalled:fork-rehome-refused with a general "bring it into the repository yourself or close it". That is how projectbluefin/utah-packages#812 ended up re-homed by hand. Now that note names the one action: a person runs Update branch / gh pr update-branch, or merges the base in locally if it conflicts. When the fork allows no maintainer edits, the note names the author's step instead. No permission changes, no new writes, and no change to when the hive parks.

What went wrong

  • projectbluefin/utah-packages#812 (fork mendezr/utah-packages): adopted in place on 10-31. On 11-01 the scanner's push was rejected because the rebased history carried main's change to bump-upstream-enqueue.yml. The hive then parked it at 085 with adoption-stalled:fork-rehome-refused and the general ask. A maintainer re-homed it by hand as perf: O(1) contributor lookup by usernameΒ #892 on 11-06. That manual bottleneck is what projectbluefin/common#1611 asks to remove.
  • The App already has the workflows permission on projectbluefin. Its declared permissions include workflows: write, and it pushed workflow files itself: utah c3d4f319 (10-26), website#991, dakota-iso#303 and actions#726 (11-05). Despite that, GitHub refused fork updates that carried base workflow changes on utah#1001 (10-29), fsdk-containers#505 (11-05 to 11-09) and utah-packages#977 (live log, 11-10 06:08Z). The refusal comes from the fork, where the App is not installed, so no grant fixes it.
  • v6 already stops the hive from adopting such a fork (baseSyncTouchesWorkflows) and never moves fork code into the base repository. The only gap was that the 085 note did not say why or what to do.

What changes

  • When the hive posts the fork-rehome-refused note, it reads two things about the fork: maintainer_can_modify, and the first .github/workflows/ file the base changed since the merge-base. This happens once per head, in both the "not adopted after the 072 dwell" path and the "adopted, re-home refused" path.
  • The base changed a workflow file: the note names the file and says the change is inherited from the base, not part of the PR's diff. It explains that GitHub refuses the App's push to a fork whatever the grant. The ask is that a maintainer runs Update branch or gh pr update-branch N -R owner/repo, or asks the author to. If the fork has maintainer edits off, the ask goes to the author or asks them to turn edits on. On a conflict, the note says to merge the base in locally and push. A merge keeps the contributor's commits and sign-off.
  • Maintainer edits off, no workflow change: the note asks the author to turn on "Allow edits by maintainers" or push the fix.
  • If either read fails, or neither applies, the note keeps today's general ask. The reason string and the 085 routing do not change.
  • baseSyncTouchesWorkflows now reads through a small baseSyncWorkflowFile helper that returns the file. Its result and log lines are the same as before.

Files

  • src/pkg/github/automerge/automerge_contributor_adopt.go: forkUpdateBlock, forkUpdateBlockFor, forkRehomeBlockerTextFor, baseSyncWorkflowFile; the two note sites pass the block through.
  • src/pkg/github/automerge/automerge_fork_update_block_test.go: new tests.
  • src/docs/labels-and-control-signals/stage-labels.md, src/docs/hive-merge.md: the fork park note.
  • changelog.d/fixed-fork-workflow-sync-park.md.

Tests

None were run locally (repo AGENTS.md). CI is the verdict.

  • TestForkRehomeBlockerTextNamesTheUpdate: the four note variants (workflow change with edits on, workflow change plus conflict with edits off, edits off only, nothing read). It also checks that the general text is unchanged.
  • TestForkNotAdoptedForBaseWorkflowChangeNamesUpdateBranch: the fork is behind a base that changed a workflow file and has maintainer edits on. It is not adopted, and after the 072 dwell its 085 note names the file and gh pr update-branch 7 -R acme/widget. On the v6 tip the note carries the general "follow the repository's process" ask, so this test fails there.
  • TestAdoptedForkConflictAfterBaseWorkflowChangeNamesUpdate: replays fix: remove PhaseChangedAt filter + strict content checksΒ #812's path. The fork is adopted in place, the base then changes a workflow file, and the branch needs a rebase. The re-home is refused, and the 085 note names the conflict and the update. On the tip the note lacks both.
  • The existing fork-park tests (TestAdoptionForkWithoutPushStaysWithAuthorUntilDwell, assertForkRehomeParked callers) assert phrases that every variant keeps.

Not in this PR

  • The in-place adoption note still says "the hive will rebase this branch", and the fixer may rebase a fork branch (a force-push over the contributor's history). Moving fork fixes to merge-only is a separate change.
  • When a live in-place fork adoption hits a base workflow change on a conflicting branch, the hive still waits for the dwell before parking. Parking it at once would save a fixer run.

Refs projectbluefin/common#1611, Refs projectbluefin/utah-packages#812, Refs #15382

πŸ€– Generated with Claude Code

https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1

… base changed workflows

A fork PR the hive cannot finish because its base changed .github/workflows/
parked at 085 (adoption-stalled:fork-rehome-refused) with a general "bring it
into the repository yourself or close it" ask. GitHub refuses any App push to
a fork that carries a workflow change, whatever the App is granted on the base
repository, so the one action is a person's branch update. The note now reads
the fork's maintainer_can_modify and the base-side workflow change when it is
posted and names that action (Update branch / gh pr update-branch, or a local
merge on a conflict), or the author's step when maintainer edits are off.

Refs projectbluefin/common#1611, projectbluefin/utah-packages#812

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>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 10, 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 clubanderson 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

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v6

Conflicts are checked with every PR merged onto the current tip of v6, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#17551 πŸ› fix(stage): the 090 comment names a base that requires up-to-date branches instead of "Blocked only by" trust same files src/docs/labels-and-control-signals/stage-labels.md
#17506 🌱 Top up v6 with v5 (durable hosted hive.yaml, shared-CI deferral naming and 118 more) same files src/docs/hive-merge.md
src/docs/labels-and-control-signals/stage-labels.md

@hivecommons-hive

hivecommons-hive Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Hive status β€” updated in place; edits do not notify. Full history is in the Activity Monitor.

Reviewed by reviewer-2 β€” no findings.

Reviewer notes

Read the non-test diff against the v6 tree (src/pkg/github/automerge/automerge_contributor_adopt.go). This looks correct to me; no findings.

What I checked:

  • Refactor of baseSyncTouchesWorkflows is behaviour-preserving. The old function returned false on empty head/base, true on a compare error (with the warn), true on the first .github/workflows/ file (with the info log), false at the end of pagination. The new baseSyncWorkflowFile + wrapper reproduces each branch and keeps both log lines, so canPushToPRBranch (~line 1959) sees the same answers.
  • The extra API reads are really once per head. forkUpdateBlockFor does a PullRequests.Get and a compare, but both callers β€” escapeStalledAdoption and escalateUnadoptableFork β€” return early on rec.AdoptionEscalationNoted(head, reason) (the noted checks at ~2548 and ~2589) before reaching the new call, and postAdoptionEscalationNote marks the head after posting. So the body's "once per head" claim holds and a parked PR does not cost two requests per cycle.
  • adoptionFromFork (~1948) and supersedeHeadConflicts (~1272) exist with the semantics the new text relies on; a failed GET or compare leaves the corresponding forkUpdateBlock field zero and falls back to the previous general ask, so the change can only add specificity, never a wrong instruction.
  • Exported AdoptionStalledComment / ForkNotAdoptedComment / forkRehomeBlockerText keep their signatures as thin wrappers.

Body and diff agree.

Evidence bundle `#17549e51fd4b` sha256:96368c774d346bd81bfb1c2b3da24c423c24cdf24d978100f7880790ed4e4260 β€” download from the dashboard or `hivectl review evidence #17549`.

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the diff against the v6 tree. This looks correct to me, and the extra reads are bounded as the body claims.

What I checked:

  • No new API traffic on the hot path. In escapeStalledAdoption (automerge_contributor_adopt.go:2655-2669) the noted early-return fires before forkUpdateBlockFor is reached, and postAdoptionEscalationNote marks the head immediately after posting, so the PullRequests.Get + compare run once per head, and only on the fork-rehome-refused branch. escalateUnadoptableFork is guarded the same way.
  • baseSyncTouchesWorkflows is behaviour-preserving. The refactor into baseSyncWorkflowFile keeps "compare failed β‡’ treat as touching (supersede)" and "first .github/workflows/ file β‡’ touching"; the pagination loop is unchanged, only the log lines moved to the wrapper.
  • Zero-value fallback is intact. All three exported entry points (AdoptionStalledComment, adoptionBlockerText, ForkNotAdoptedComment) pass forkUpdateBlock{}, which selects the pre-existing general-ask text verbatim β€” callers outside this file see no change.
  • adoptionFromFork and supersedeHeadConflicts already exist in this file (:2038, :1362); the conflict sentence correctly switches to the local-merge instruction when the head already conflicts.

Shares stage-labels.md with #17551 but in different hunks (@@ -944 here vs @@ -465 there), so no conflict between the two.

β€” hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive
hivecommons-hive Bot merged commit 80bb97e into hivecommons:v6 Nov 10, 2026
70 of 75 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant