Skip to content

πŸ› fix(github): fork PRs that allow maintainer edits no longer read as unpushable when the GraphQL PR batch is on - #16995

Merged
hivecommons-hive[bot] merged 2 commits into
hivecommons:v6from
Danathar:fix/graphql-batch-maintainer-edits
Nov 7, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
hivecommons:v6from
Danathar:fix/graphql-batch-maintainer-edits

Conversation

@Danathar

@Danathar Danathar commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Summary

The GraphQL PR batch (graphql_pr_batch, on by default) stores each open PR's detail without maintainerCanModify. The scan reuses that stored detail instead of making a REST call, so every fork PR came out as "maintainer edits off". The hold guard trusted that value and stopped keeping held fork PRs up to date without ever asking GitHub, then told people the fork could not be pushed to. This PR adds maintainerCanModify to the batch query and keeps it in the stored detail.

What went wrong

  • gutenprint-printer-app#196 and hplip-printer-app#199 are held fork PRs (sentinel-alert). Both forks have Allow edits by maintainers on (maintainerCanModify: true from gh pr view).
  • At 2026-11-06 23:04Z the hive posted "Hold-gate mergeability: Hive could not update this branch … a fork the Hive app cannot push to" on both.
  • The hive log for those lines shows reason=fork-not-editable and no error field. stopHeldPRUpdate adds error whenever GitHub refused the update, so this came from the guard's own early check (pr.FromFork && !pr.MaintainerCanModify in cmd/hive/main_helpers.go). GitHub was never asked.
  • That field came from enrichPRCI. It copies MaintainerCanModify from the cached PR detail, and when the batch is on, that cached detail is the one storeGraphQLPRBatchNode built without the field.

The adoptions on these PRs (and on ghostscript-printer-app#190) were not the bug. The nudge/grace adoption path already checks push access with a fresh REST read (canPushToPRBranch), and these forks allowed edits when they were adopted. The real blocker on all three is upstream: the shared fsdk-containers slim-printing include (projectbluefin/fsdk-containers#509). The hive's scanner already said so on the PRs.

What changes

  • The batch query asks for maintainerCanModify, and the stored detail carries it.
  • Everything that reads PullRequest.MaintainerCanModify after enrichment now gets GitHub's real answer when the batch is on. That covers the hold guard's early stop, ReachableAction (push vs comment-only in the repair queue) and the dashboard's adopted-PR push check.

Files

  • src/pkg/github/pr_batch_graphql.go: query field, node field, stored detail.
  • src/pkg/github/pr_batch_graphql_maintainer_edits_test.go: new test.
  • changelog.d/fixed-graphql-batch-maintainer-edits.md

Tests

  • TestGraphQLPRBatchCarriesMaintainerCanModify: two fork PRs from the batch, one with edits allowed and one without. Enrichment must reuse the batch detail (no REST GET) and report each correctly, and ReachableAction must say push for the editable one. It fails on v6 tip ("fork PR that allows maintainer edits read as not editable") and passes with this change.
  • go test ./pkg/github/ and go vet ./pkg/github/ pass. The cmd/hive hold-guard tests (-run 'Held|HoldGuard') pass.

πŸ€– Generated with Claude Code

https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1

The GraphQL PR batch stored each PR's detail without maintainerCanModify,
and EnrichCIStatus reuses that detail in place of a REST GET, so every
fork PR read as not editable. The hold guard then stopped keeping held
fork PRs current without asking GitHub ("a fork the Hive app cannot push
to") on projectbluefin/gutenprint-printer-app#196 and hplip-printer-app#199,
whose forks allow maintainer edits. ReachableAction and the dashboard's
adopted-push check read the same field.

Ask for maintainerCanModify in the batch query and carry it into the
stored detail.

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 7, 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/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 7, 2026
@hivecommons-hive

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.

Failing checks:

  • check-failure

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 (2 waiting): fixes are handed out before new work as soon as you have capacity.

@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 batch path and its consumer in the tree at 8325a54d; the fix is correct and complete for the mechanism described.

Mechanism verified. EnrichCIStatus reuses the batch-stored detail via cachedPRDetailFromList (src/pkg/github/client.go:2819) and then copies full.GetMaintainerCanModify() into pr.MaintainerCanModify (client.go:2832). Before this change storeGraphQLPRBatchNode (src/pkg/github/pr_batch_graphql.go:254-275) built the gh.PullRequest with MaintainerCanModify unset, so GetMaintainerCanModify() returned false for every fork PR whenever the batch was on. The cache clone already preserves the field (src/pkg/github/prdetailcache.go:228), so adding it to the GraphQL query and the stored detail is the whole fix. Downstream readers β€” pr_merge_state.go:57,77,85, dashboard/adopted_push.go:54, ReachableAction β€” all take the value from this one field.

Two things I checked that are not affected: automerge_contributor_adopt.go:1904,1919 call c.gh.PullRequests.Get directly, not the cache, so they were never wrong and are unchanged by this. And pushAccessLost distinguishes nil from false; the stored detail now sets a non-nil pointer, matching what the REST read produces.

The test exercises the real path (GraphQL prefetch β†’ EnrichCIStatus with REST GET asserting zero) and checks both polarities plus ReachableAction. go build ./pkg/github/ passes on the PR head.

CI: the native-queue-policy failure is not this PR β€” the job dies in the "Replay last verdict for cosmetic label flips" step with TypeError: isCosmeticLabelFlip is not a function before any policy evaluation, which is a workflow-side defect on the base branch (see #16988). Looks correct to me.

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

native-queue-policy red here (TypeError: isCosmeticLabelFlip is not a function) is a shared incident affecting every PR based on v6, not this diff: #17003. The step added by #16952 on v5 requires a symbol v6's .github/scripts/native-queue-policy.cjs does not export yet; the forward-merge #16997 brings it over. No action needed on this branch β€” the check will pass on re-run once #17003 closes.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

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

@github-actions

github-actions Bot commented Nov 7, 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.

No conflicting open PRs or same-file overlaps were found.

…ner-edits

Signed-off-by: Danathar <Danathar@users.noreply.github.com>
@hivecommons-hive

Copy link
Copy Markdown
Contributor

The hive's GitHub App lacks actions: write, so it cannot rerun shared ci for head 15c824e46514. A repository maintainer with Actions write can re-run failed jobs at https://github.com/hivecommons/hive/actions/runs/42385468610 . Alternatively, the App owner can request Actions read and write for this recovery installation and its owner must accept the update. This is a CI recovery permission block, not a source-code failure or merge approval. Hive retries after its bounded permission cooldown; no alternate credential is selected. Hive will resume automatically once the step is done; this label and note clear themselves.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Needs a decision, not a merge:

Clear the cause and the hive re-evaluates on its next pass; the stage moves to stage/090-ready-for-human-merge, stage/095-pre-merge-soak or the merge queue on its own. Approval does not bypass CI, hold labels or other merge gates.

hivecommons-hive Bot pushed a commit that referenced this pull request Nov 7, 2026
… CI incident is withdrawn (#17007)

The 072 nudge goes out the moment a contributor PR goes red ("the hive
will not merge it until the head changes"). The scanner's [shared-ci]
incident marker can land minutes later. The stage pass then moved the
PR to 050, but the nudge stayed as posted and the head's nudge count
stayed at 1. Seen on hivecommons/hive #16993, #16995, #17000 and
#17001: nudged for native-queue-policy about ten minutes before they
were deferred to incident #17003.

- When the pass reads a nudged head's red as shared-ci-incident:<n> or
  base-branch-red:<checks>, edit the hive's own nudge comments for that
  head in place to say it was withdrawn, and forget the nudge
  (Store.WithdrawNudge), so a genuine return to 072 is nudged afresh.
- After an incident closes as completed, keep a PR deferred to it until
  the rerun sweep stamps hive-shared-ci-rerun-<n> (at most 30 minutes),
  so the head is not handed back in the gap before the re-run.
- Name the head's red checks in the nudge when the CI gate's reason is
  a bare token such as check-failure (a base with no required checks).

Refs #17003, #12606, #12253


Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1

Signed-off-by: Danathar <Danathar@users.noreply.github.com>
Co-authored-by: Danathar <Danathar@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

@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.

Conclusion: looks correct to me. The diff fixes exactly the mechanism it describes, and I confirmed the read path in the tree rather than from the body.

  • pkg/github/client.go:2639 β€” enrichPRCI takes the cached detail via cachedPRDetailFromList and skips the REST GET when it hits.
  • pkg/github/client.go:2654 β€” pr.MaintainerCanModify = full.GetMaintainerCanModify(); with the GraphQL node never setting the field, go-github's getter returns false for every PR, forks included.
  • pkg/github/prdetailcache.go:228 β€” the cache clone already carries MaintainerCanModify, so once storeGraphQLPRBatchNode populates it (this diff, pr_batch_graphql.go) nothing else needs to change downstream.
  • Consumers that now get the real value: client.go:3680 (pr.FromFork && !pr.MaintainerCanModify), pr_merge_state.go:57 / :85, and ReachableAction as the new test asserts.

The test is a genuine red→green: it fails on main because the node JSON gains maintainerCanModify but the Go struct has nowhere to put it, so prs[0].MaintainerCanModify stays false. It also pins "no REST pull GET", which is the property that made this bug invisible.

One non-blocking note: the changelog fragment is a single very long paragraph with repo-specific PR links; a shorter user-facing line would read better in the release notes, but that is the hive's own call.

No security, scope or docs concerns. I have not approved or changed anything.

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

@hivecommons-hive

hivecommons-hive Bot commented Nov 7, 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 β€” no findings.

Reviewer notes

Looks correct to me. Verified the mechanism in the tree at merge-base, not just the diff.

  • EnrichCIStatus reuses the cached detail via cachedPRDetailFromList (src/pkg/github/client.go:2639) and copies pr.MaintainerCanModify = full.GetMaintainerCanModify() at client.go:2654. When graphql_pr_batch is on, that full is the gh.PullRequest built by storeGraphQLPRBatchNode (pr_batch_graphql.go:258-270 on master), which never set MaintainerCanModify β€” so GetMaintainerCanModify() returned false for every batched PR and the hold guard's pr.FromFork && !pr.MaintainerCanModify branch fired without a GitHub call. The diagnosis in the body matches the code.
  • The fix is the minimal one: add maintainerCanModify to the batch query, carry it through graphQLPRBatchNode, and set it on the stored detail. Downstream readers (pr_merge_state.go:57,77,85, client.go:3680) read the same gh.PullRequest field, so they are repaired by the same change.
  • Other fields EnrichCIStatus reads from the stand-in detail are safe: PRChangedFilesClaimsEmpty (pr_empty_diff_hive_autoclose.go:191) is nil-guarded and Base.SHA is populated by the batch.
  • The new test drives the real path (GraphQL prefetch β†’ EnrichCIStatus β†’ ReachableAction) and fails on master because MaintainerCanModify would be false for node 1.

No findings. Only tide is pending; everything else is green on 9942de8.

Evidence bundle `#169959942de8` sha256:a292d3a393d637375e933463c31a7a0017cbefdeeb618c26192428531040a13f β€” download from the dashboard or `hivectl review evidence #16995`.

@hivecommons-hive
hivecommons-hive Bot merged commit ee58a82 into hivecommons:v6 Nov 7, 2026
70 of 71 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