Repository navigation
🐛 fix(github): gated-run auto-approval retries transient POST failures and distrusts App-pushed fork heads - #16783
Conversation
…es transient POST failures, and distrusts fork heads on the actor path Signed-off-by: scanner <280983584+hivecommons-hive[bot]@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 |
|
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: — 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`. |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of No conflicting open PRs or same-file overlaps were found. |
There was a problem hiding this comment.
docs-currency (head 48126f9) — docs and changelog match the code; two low advisory notes, nothing blocking.
-
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". -
src/docs/github-app-setup.md:46("App-authored or -triggered runs") andsrc/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 fromsplitTrustedWorkflowRuns/workflowApprovalTrusted(headInBase). The authoritative paragraph atruntime-and-quota.md:284-289is 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
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
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.ErrorResponsewas 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/statusor the CI caption said so. Now a transient failure gives the pass back through a newrelease(key)ledger method, so the next sweep re-reads the PR and retries.deniedCountedandpermissionDeniedare 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/claimon the ledger and the comment on the firstsplitTrustedWorkflowRunscall (the finding cited an earlier revision). It is closed as not planned with evidence. The newreleasefollows 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 andcontext.Canceleddo not.TestSweepWorkflowApprovalsAppActorNeedsBaseRepoHeadand newTestWorkflowApprovalTrustedrows: 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