Repository navigation
✨ PR gate: fail visibly when the Commit statuses grant is missing - #19063
Conversation
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
UI render evidenceRender evidence captured. Built from
These are fixture renders, not live data: the page was built from the PR head and filled with synthetic data from |
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. @clubanderson this PR is held at Why:
Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path. hive/awaiting-ci: rebased onto v5 (only docs-citation conflicts, resolved to the base side and refreshed with check-docs-citations.py --fix). CI pending - sweep will merge when green. 🐝 Hive Agent: |
Mutation testing⏱️ The 900s mutation budget ran out, so 4 package(s) were not fully mutated and the results below do not cover them:
1 mutant(s) in changed files are not reached by any test (NOT COVERED). A maintainer may apply the
Verdict: |
There was a problem hiding this comment.
Correctness review at a81230e: no blocker found. The grant check, forced-off mode, per-repo 403 cooldown and heartbeat plumbing hang together, and the nil-gate paths return early.
One low advisory, with the detail in the inline comment: the write-refused state is derived from the retry cooldown, so it clears after 15 minutes without a successful post. Tests were not run.
-- hive: agent=adjudicator backend=claude model=claude-sonnet-5-5 claude=2.1.327
|
|
||
| func (g *Gate) repoForbiddenLocked(repo string) bool { | ||
| s := g.stats[strings.ToLower(repo)] | ||
| return s != nil && g.Now().Before(s.forbiddenUntil) |
There was a problem hiding this comment.
forbiddenUntil is both the retry cooldown and the only record that a write was refused. After 15 minutes ForbiddenRepos, Cause=write-refused and HoldReason all go empty with no successful post and no change in the grant. This happens when the grant read says write but the write still gets a 403, and it only comes back on the next event. Advisory fix: set a refused bool in post() on ErrForbidden, clear it only on a successful post, and read it in HealthFor and HoldReason. Keep forbiddenUntil only for the retry gate in HandleEvent.
There was a problem hiding this comment.
Correctness review at head d4d8a91. Locking and the off-mode path look sound; one in-scope concern is inline: the new held-reason short-circuit in resolveMissingRequiredCheck can mislabel a missing required context as a grant problem and skip the workflow-approval and orphaned-run diagnosis. Fix: run that diagnosis first and use the grant reason only as the fallback.
-- hive: agent=adjudicator-3 backend=claude model=claude-sonnet-5-5 claude=2.1.327
| // by polling: the owner accepts the permission. | ||
| missing := strings.TrimPrefix(reason, requiredCheckMissingPrefix) | ||
| if held := prgate.DefaultHoldReason(owner+"/"+repo, missing); held != "" { | ||
| if c.markTerminalHoldLogged(owner, repo, number, headSHA, prGateHoldWarnKey+missing) { |
There was a problem hiding this comment.
This returns unauthorized:post-pr-gate-status before the existing workflow-approval / orphaned-run diagnosis. HoldReason only checks configured==enforce and (grant missing or a recent 403), yet enforce still runs as shadow, so the workflow, not the hive, supplies these contexts. A context missing because a run awaits approval or is orphaned would be mislabeled as a grant problem. Suggest running the existing diagnosis first and using the grant reason only as the fallback when it finds nothing.
d4d8a91 to
10dc6ff
Compare
|
@clubanderson this PR is back in your court (
Once the new head lands, CI and the review swarm re-run automatically and the PR returns to the normal path. Current head: Updates (newest last):
|
There was a problem hiding this comment.
Delta re-review at 10dc6ff: the earlier correctness finding at automerge_held_runs.go:146 is still present (hunk unchanged). See the inline thread.
-- hive: agent=adjudicator-5 backend=claude model=claude-sonnet-5-5 claude=2.1.327
| // by polling: the owner accepts the permission. | ||
| missing := strings.TrimPrefix(reason, requiredCheckMissingPrefix) | ||
| if held := prgate.DefaultHoldReason(owner+"/"+repo, missing); held != "" { | ||
| if c.markTerminalHoldLogged(owner, repo, number, headSHA, prGateHoldWarnKey+missing) { |
There was a problem hiding this comment.
Still present from d4d8a91. This early return fires on any missing gate context whenever the grant is missing or the repo was forbidden (prgate/grant.go:222-235), so approval-held or never-started runs get mislabelled unauthorized:post-status and the workflowApprovalAttention/takeover diagnostics below are skipped. Suggest running the run-based diagnostics first and falling back to held only when they find nothing specific (or when len(held)==0).
|
Baseline triage: 🐝 Hive Agent: |
|
hive/awaiting-ci: this branch has a merge conflict with v5 and is behind it, which also explains the Sign-off survives the squash and native-queue-policy failures. Suggested fix: merge v5 in (signed off), resolve the conflict, push. Not pushed, since this is not a hive-authored branch. 🐝 Hive Agent: |
|
Scanner triage: failing checks here are not caused by this diff. Baseline check says 🐝 Hive Agent: |
The hive-posted PR-contents gate never fails silently. - Grant check: at startup and every 15 minutes the hive reads the Commit statuses permission its App installation was actually granted (the installation permission map now carries statuses). A missing grant forces the gate off and never promotes it to enforce. - Runtime failure: a 403 on a status write is recorded per repository, counted, and not retried for 15 minutes; it also invalidates the grant read. - Spoke: /api/status carries prGate and the dashboard shows a banner naming the installation, what is missing, where an owner accepts it and the days left before 2026-12-02. - Hub: the heartbeat carries the cause and whether a required context depends on the gate; the health verdict goes red then, amber otherwise, with a remediation hint. - Held reason: in enforce mode a missing required gate context shows unauthorized:post-pr-gate-status instead of a bare required-check-missing. Nothing changes while auto_merge.pr_gate.mode is off. Refs #19038 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Refs #19038 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
10dc6ff to
61edb5a
Compare
There was a problem hiding this comment.
Delta re-review at 61edb5a. The compare against 10dc6ff is 164 files, almost all of it merged mainline work. I read only the PR's own files, mainly automerge_held_runs.go, prgate/gate.go and prgate/grant.go.
Previous finding (held-reason short-circuit, automerge_held_runs.go): still present.
resolveMissingRequiredCheck still returns the unauthorized:post-pr-gate-status reason straight away (automerge_held_runs.go:137-151 in the diff). That return happens before the workflow-run, approval and never-started analysis. Gate.HoldReason only fires when the grant is missing or the repo is in the 403 cooldown, so the grant is a true cause. It is not necessarily the only one. A PR with the grant missing and also a held action_required run, or a never-started head, shows only the grant reason. After the owner accepts the grant, the PR then falls back to bare required-check-missing or a workflow-approval reason, so the hold looks like it reappears.
Requested change: still compute the underlying reason, and return the grant reason only when the underlying one is the bare reason. For example, move the DefaultHoldReason block after the run analysis and apply it only where the function would otherwise return reason.
Rest of the delta in the PR's own files: no new correctness issues found. I did not run the tests, and I did not read the mainline-merge hunks.
-- hive: agent=adjudicator backend=claude model=claude-sonnet-5-5 claude=2.1.327
Signed-off-by: Andy Anderson <andy@clubanderson.com> # Conflicts: # src/docs/api-reference/hub-server.md
Signed-off-by: Andy Anderson <andy@clubanderson.com>
61edb5a to
85c91f3
Compare
|
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Second slice of the hive-posted PR-contents gate: it fails visibly instead of silently. Default off; with
auto_merge.pr_gate.modeoff or unset nothing changes (no request, no status field, no heartbeat field).statuses). A missing grant forces the gate off and never promotes it toenforce; a failed read keeps the last known answer./api/statuscarriesprGateand the dashboard shows a banner naming the installation, what is missing, where an owner accepts it (the App's pending permission request) and the days left before 2026-12-02.enforcemode a missing required gate context showsunauthorized:post-pr-gate-statusinstead of a barerequired-check-missing(enforceitself still runs asshadowin this PR).Tests are table-driven with recorded fixtures: grant present, missing, read-only, none, token credential; 403 at post time and cooldown; a repo whose required set does not depend on the gate; the red versus amber decision; held reason; banner markup.
Refs #19038