Skip to content

🐛 fix(github): gated-run auto-approval retries transient POST failures and distrusts App-pushed fork heads - #16783

Merged
hivecommons-hive[bot] merged 1 commit into
v5from
scanner/fix-16738
Nov 5, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
v5from
scanner/fix-16738

Conversation

@hivecommons-hive

@hivecommons-hive hivecommons-hive Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Closes #16739
Closes #16743
Fixes #16738
Refs #16736

Why

#16739: a transient failure should not spend the head's one pass. The sweep claims a head's single approval pass before the first POST. Before this change, only a 403/404 *gh.ErrorResponse was recorded as a refusal. Any other failure was only logged and still kept the claim: a 5xx, a network error, a cancelled cycle, or a rate-limit 403 (go-github types those as *RateLimitError/*AbuseRateLimitError, not *ErrorResponse). A gated Dependabot head that hit a secondary rate limit on its one attempt then waited for a human click, and nothing in the ledger, /api/status or the CI caption said so. Now a transient failure gives the pass back through a new release(key) ledger method, so the next sweep re-reads the PR and retries. deniedCounted and permissionDenied are kept on release, so denials are not counted twice and a real 403/404 refusal stays recorded and is never retried. The cost of a persistent 5xx is one PR re-read plus the POSTs per sweep that runs, until the head changes or the TTL evicts it.

#16743: the App's login proves nothing about who pushed. The triggering-actor branch trusted any run whose actor equals AppBotLogin(). The old reasoning was that the App cannot push to a fork. That holds only if nobody else can install the App. A public App installed on a contributor's fork pushes with the same <slug>[bot] login, so that fork's head would have been approved as "the App". The actor path now also requires the run's head repository to be the PR's base repository. The author path and allowlisted actors are unchanged.

#16738 was already addressed. The merged revision of #16736 already has markDeniedCounted/claim on the ledger and the comment on the first splitTrustedWorkflowRuns call (the finding cited an earlier revision). It is closed as not planned with evidence. The new release follows the same ledger-owned pattern.

Decision taken by hive: for #16743 we used the code fix (require a base-repo head on the App-actor path) rather than documenting that the App must be private. The change only adds a check. It cannot affect heads the App pushes to its own repository, which GitHub does not gate anyway. The App-as-author path is left as is, per the issue's scope. A public App installed on a fork could in principle also open a PR as <slug>[bot]. If that matters, it deserves its own issue.

Tests

  • TestSweepWorkflowApprovalsRetriesTransientFailure: a 502 on the first POST is retried on the next sweep and approved there. Denials are counted once, the pass is spent after success, and there is no permission caption.
  • TestWorkflowApprovalPermissionRefused: 403/404 count as refusals. 5xx, RateLimitError, AbuseRateLimitError, network errors and context.Canceled do not.
  • TestSweepWorkflowApprovalsAppActorNeedsBaseRepoHead and new TestWorkflowApprovalTrusted rows: an App-triggered fork head is not approved, a base-repo head is, and the author and allowlist paths are unchanged.

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

…es transient POST failures, and distrusts fork heads on the actor path

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@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 5, 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

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 5, 2026
@hivecommons-hive

hivecommons-hive Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

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

hive/awaiting-ci: CI pending — sweep will merge when green.


🐝 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

Evidence bundle `#1678348126f9` sha256:1dd0a3d14c78dac0b94bf4be7bf70da91ba8c35d6568073b8b79d9a2982866dc — download from the dashboard or `hivectl review evidence #16783`.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, 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.

@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 5, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

docs-currency (head 48126f9) — docs and changelog match the code; two low advisory notes, nothing blocking.

  1. src/docs/operator-reference/runtime-and-quota.md:308-318 — the new transient-failure sentences ("gives the head's pass back, so the next sweep re-reads the PR and tries again") are inserted right before "That refusal is bound to the head: granting the App Actions: Read and write afterwards does not make the hive retry a head…". "That refusal" was written to follow the 403/404 sentence at :304-308; its nearest antecedent is now the transient case, so the two sentences read as contradicting each other. Suggest moving the transient block after "…lets the sweep attempt it again." (:318), or opening with "A 403/404 refusal is bound to the head".

  2. src/docs/github-app-setup.md:46 ("App-authored or -triggered runs") and src/docs/operator-reference/README.md:415-418 ("triggering actor is … the App itself") still summarise the actor path without the new base-repo-head requirement from splitTrustedWorkflowRuns/workflowApprovalTrusted(headInBase). The authoritative paragraph at runtime-and-quota.md:284-289 is updated; a short qualifier in the two summaries would keep them consistent.

Verified: changelog fragment name/category, the log string failed to approve gated workflow run; retrying next sweep matches the doc verbatim, and the 403/404-vs-transient split in the doc matches workflowApprovalPermissionRefused.

— hive: agent=adjudicator backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive
hivecommons-hive Bot merged commit e5fd0f1 into v5 Nov 5, 2026
83 of 89 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-16738 branch November 5, 2026 17:07
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR copilot dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) size/L Denotes a PR that changes 100-499 lines, ignoring generated files. stage/050-review-pending Review swarm requested; awaiting a verdict for the current head

Projects

None yet

0 participants