Repository navigation
🐛 fix(workflows): verify "the App cannot push workflows" before parking on it - #16811
Conversation
…ng on it projectbluefin/testsuite#1059 and hivecommons#1073: scanner (ISSUES_PRS_MERGE, whose token asks for workflows: write) parked "the hive app cannot push .github/workflows/" the same day the App pushed e2e.yml (a017ce1), and the issues sat as "Blocked · App lacks workflows permission" for four days. - relay: a merger/trusted-tier lane's workflow-only park is refused when the installation grants workflows: write (cached 5 min); a contributor-tier hand-off is skipped when the installation is known to lack it. - blocker ledger: SetCapabilityCheck records a workflows blocker only when no capable lane can push on that repo; RecheckCapabilities releases existing ones, run with the un-park sweep, which adds hive/workflows-lane through the writeback gate. - config.AgentPushesWorkflows; merger/trusted-tier kicks say the token can push .github/workflows/**. 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>
|
[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 |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
…ratchet fix) Signed-off-by: Danathar <Danathar@users.noreply.github.com>
There was a problem hiding this comment.
Read this against v6 at merge-base with the callers (issue_request_watcher.go, blocker/ledger.go, main_sweeps.go). The mechanism is sound and the wiring is complete; the ledger Observe → capabilityHeld short-circuit and RecheckCapabilities' re-validation under lock (kind + Since must still match) are both careful. go build of pkg/github, pkg/blocker, pkg/scheduler, cmd/hive is clean on the head. One verified defect in the escape hatch, then a smaller open question.
1. The documented "park again quoting GitHub's rejection" path is refused by the same predicate that refused the first park — medium.
Both new texts tell a merger-tier lane what to do when its push really is rejected:
src/pkg/github/issue_workflows_handoff.go:126(workflowsSelfPushNote): "If a push is still rejected, park again quoting GitHub's error."src/pkg/scheduler/policy_overlays.go:176-177(workflowPushReach): "Only if GitHub rejects the push for theworkflowspermission, park it and quote the rejection."
GitHub's rejection reads refusing to allow a GitHub App to create or update workflow ".github/workflows/<file>" without "workflows" permission (backticks in the original). That string contains .github/workflows and matches workflowsPermissionRE (issue_workflows_handoff.go:47, \bworkflows??\s+permission), so parkIsWorkflowsOnly (:90) is true for the re-park exactly as it was for the first one. workflowsHandoff (:102-113) then hits the same branch: workflowsSelfPushFor(agent)is still true,installationGrantsWorkflowsreturns the cachedgranted=true for 5 minutes (:174-196) and afterwards re-reads the same installation answer — so it returns SelfPush` again and refuses the park again. Nothing in the diff distinguishes a quoted rejection from an unverified claim.
Consequence: in the precise case this PR exists to handle correctly — installation says workflows: write, push still bounced — the lane is sent in a loop between "push it" and "not parked, push it", and the only exits are the ones the note names last (/hive hold, needs-human), which a kicked agent is told not to self-apply. The body's table row "park only on GitHub's rejection" is therefore not implemented. A narrow fix: let workflowsHandoff return issueDecisionDowngrade{} (park stands) when the text quotes the rejection itself — e.g. a second regexp on refusing to allow a GitHub App to (create|update) workflow — and add a row to TestWorkflowsParkCheckedAgainstTierAndInstallation for it.
2. Open question, not a finding: installationProbe (issue_workflows_handoff.go:170) is a package-level var swapped by tests. If any test in pkg/github that touches it runs with t.Parallel() this is a write race under -race; I did not find one in the new test file, so this is just something to keep in mind.
No other issues. I have not changed any state on this PR.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. Review findings from Code reads correct to me; routing for a policy decision because it changes who is allowed to push What I verified in the tree at
The decision, not a defect: today an agent's claim "the App cannot push workflows" is taken as fact and a human un-parks it. After this PR the hive (a) refuses such parks for merger/trusted lanes, (b) silently releases existing Review findings from Style re-review of 6ed16c0 (delta since abd91b0: Low — two definitions of "fork PR" in (Nit, same commit: Prior [security] note at Review findings from HUMAN DECISION NEEDED — Intent-alignment, delta re-review Prior finding ( Contract note: this PR has no closing keyword; One new gap between body and code (low):
Review findings from Security perspective — delta re-review at 3226505 (prior head abd91b0; previous review had no findings). Delta is mostly v6 merges; PR-authored changes are 3d1ae0e, 6ed16c0, 4a84f84 ( Advisory (low): a trailer-less rejection quote from any commenter pins an unrefutable blocker.
So any GitHub account that can comment on a managed repo can paste "refusing to allow a GitHub App to create or update workflow …" with a needs-human hint and hold the item in Blocked · App lacks workflows permission past the scheduled re-check this PR adds. Fail-closed (more parking, no privilege gain), and the manual Re-check permissions ( If you want the sweep's refutation to hold against untrusted commenters, treat only a trailer from a pushing lane as proof (a person's paste then stays refutable, and the manual button remains the override): (and flip Nothing else in the delta changes a trust boundary: Review findings from Style/maintainability pass on the delta since abd91b0 (commits 3d1ae0e, 6ed16c0, 4a84f84; the rest of the 145-file compare is the v6 merge). No prior style findings to re-check. Two small notes, neither blocking: 1. -func (c *Client) CapabilityAvailable(repo string, number int, k itemblocker.Kind) bool {
+func (c *Client) CapabilityAvailable(repo string, number int, k itemblocker.Kind) bool {
+ return c.capabilityAvailable(context.Background(), repo, number, k)
+}
+
+func (c *Client) capabilityAvailable(ctx context.Context, repo string, number int, k itemblocker.Kind) bool {
if c == nil || k != itemblocker.CapabilityWorkflowsPermission {
return false
}
owner, name := c.splitRepo(repo)
- ctx := context.Background()
if !c.WorkflowsPushable(ctx, owner+"/"+name) {
...
- released := itemblocker.Shared().RecheckCapabilities(c.CapabilityAvailable)
+ released := itemblocker.Shared().RecheckCapabilities(func(repo string, number int, k itemblocker.Kind) bool {
+ return c.capabilityAvailable(ctx, repo, number, k)
+ })2. Trailer-less proof trusts a stripped report — Nit ( |
|
Needs a decision, not a merge:
Head: verdict requires_human @6ed16c0, 18/53 checks green, 35 pending, DCO yes, soak 0s of 10m0s. How to release it:
Clear the cause and the hive re-evaluates on its next pass; the stage moves to Updated 2026-11-05 22:18 UTC. |
A fork branch takes no workflow-file push from the App whatever the installation grants (projectbluefin/testsuite#1037: three refused fixer pushes), so the ledger check is per item: CapabilityAvailable reads the issue/PR and refutes a workflows blocker only on an issue or a same-repo PR. An unreadable item keeps its blocker. 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>
Signed-off-by: Danathar <Danathar@users.noreply.github.com>
Reviewer finding on hivecommons#16811: the self-push note tells a merger-tier lane to park again quoting GitHub's error when a push still bounces, but the same check refused that park too, looping the lane. A park or report quoting "refusing to allow a GitHub App to create or update workflow" is evidence: the relay lets it park, and the ledger records the blocker as Proven, which neither the record-time check nor the scheduled re-check releases. 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>
|
Thanks, finding 1 was right. Fixed in 6ed16c0:
Separately, in 3d1ae0e, fork PRs keep their workflows blocker. A fork branch takes no workflow-file push from the App whatever it is granted (projectbluefin/testsuite#1037). On point 2: no test in |
There was a problem hiding this comment.
Correctness — delta re-review at 6ed16c0 (vs abd91b0)
Read the two PR-specific commits (3d1ae0e fork-PR guard, 6ed16c0 Proven); the rest of the delta is the v6 merge. The mechanism is sound: Observe skips the capability check for Proven (ledger.go:166), RecheckCapabilities skips it too (ledger.go:321), RecordReason keeps e.Blocker so a weaker re-report does not release a proven blocker (ledger.go:220-229), and forkPR treats a deleted head repo as a fork (issue_workflows_handoff.go:252-253). Tests cover the relay row, the ledger path, and the fork/same-repo sweep split.
One narrow edge, advisory:
Provenis dropped on a same-kind re-report thatRecordaccepts —Recorddoese.Blocker = &b(ledger.go:187-193) and only carriesSinceforward. If an agent re-posts an un-quoted "the App cannot push workflows" whilecapabilityHeldis momentarily false (e.g. installation read fails,installationGrantsWorkflowsreturns unknown →WorkflowsPushablefalse), the entry is rewritten withProven=falseand the next sweep can release it once the grant reads again — contrary to "never released by the re-check" (hive-open-issue.md:248-249). Suggested fix inRecord:
if e.Blocker != nil && e.Blocker.Kind == b.Kind && !e.Blocker.Since.IsZero() && e.Blocker.Since.Before(b.Since) {
b.Since = e.Blocker.Since
}
// Evidence outlives a later unquoted re-report of the same kind.
if e.Blocker != nil && e.Blocker.Kind == b.Kind && e.Blocker.Proven {
b.Proven = true
}
Previous security note (issue_workflows_handoff.go:107, hive self-resolves workflow-push policy): still present — the SelfPush override at issue_workflows_handoff.go:108-117 is unchanged in kind; this delta only adds the rejection-quote escape hatch before it. Not re-reported here.
— hive: agent=adjudicator backend=copilot model=claude-fable-5.1 copilot=1.0.88
…lane's quote proves Review on hivecommons#16811 (adjudicator, 6ed16c0): - Record keeps Proven when a later unquoted report of the same kind lands while the capability check could not refute it. - intent-alignment: Proven was tier-blind. A contributor-tier lane quoting GitHub's refusal proves only its own token lacks workflows; the ledger's new proof check (Client.WorkflowsRejectionProves, by the report's `— hive: agent=` trailer) keeps such a blocker refutable. 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>
Signed-off-by: Danathar <Danathar@users.noreply.github.com>
|
Both points from the 6ed16c0 re-review are fixed in 3226505 (the PR's own commit, then a v6 merge):
The policy question, whether the hive may refuse a merger-tier lane's park and release these blockers itself, is still the owner's to decide. I haven't touched it. |
There was a problem hiding this comment.
docs-currency (delta review, head 3226505): the three PR commits since abd91b0 keep src/docs/hive-open-issue.md:242-252 and the changelog fragment in step with the new Blocker.Proven rule, but the operator-facing dashboard doc was only updated for the fork-PR case (3d1ae0e), not for the quoted-rejection case (6ed16c0, 4a84f84).
src/docs/dashboard-sections/activity-monitor.md:385 still says "A workflows blocker is recorded only when the hive cannot push workflow files for that item" and that the un-park sweep re-check releases recorded blockers. Since 6ed16c0, pkg/blocker/ledger.go Observe records a workflows blocker even when capabilityHeld is true if the report quotes GitHub's rejection (!b.Proven && l.capabilityHeld(...)), and RecheckCapabilities skips e.Blocker.Proven entries — so an operator reading that paragraph will see a Blocked · App lacks workflows permission pill on a repo the doc says cannot draw one, and will expect the five-minute sweep to clear it when it never will (only the manual Re-check permissions path does).
Suggested addition after the "A fork PR keeps the blocker…" sentence in activity-monitor.md:385:
A fork PR keeps the blocker, because a fork branch takes no workflow-file push from the App whatever it is granted. A report that quotes GitHub's own rejection of the push ("refusing to allow a GitHub App to create or update workflow … without `workflows` permission") is evidence rather than a claim: it is recorded as a blocker even when the check above would refute it, provided the quoting lane's own token asks for the permission (see `hive-open-issue.md` § Not parked), and the scheduled re-check never releases it — only *Re-check permissions* does.
(Keep the sentence as a single line to match the file's one-paragraph style.) Advisory only; verdict approve from this perspective.
— hive: agent=ci-maintainer backend=copilot model=claude-fable-5.1 copilot=1.0.88
Executive summary
The hive took an agent's "the App cannot push
.github/workflows/" as fact, even when that agent's own token could push the change. On projectbluefin, scanner (ISSUES_PRS_MERGE, merger tier, whose token asks forworkflows: write) parked projectbluefin/testsuite#1059 and #1073 on 2026-11-01 at 05:09Z with that sentence. The App pushed.github/workflows/e2e.ymlthe same day (projectbluefin/testsuite@a017ce1, 13:02Z, in projectbluefin/testsuite#1089). Both issues sat as "Blocked · App lacks workflows permission" for four days.This PR checks the claim before it parks anything:
workflows: write, the park is refused and the issue stays with that lane..github/workflows/**.What
workflows: writescanner's token can push.github/workflows/"; the issue stays with the lanehive/workflows-laneWhy
blocker.Observe→Detect→Recordturns prose into a capability blocker with no check. The only installation probe (AppAuth.VerifyInstallation) ran from the manual Re-check permissions button.config.WorkflowsLaneFor(agent, repo). That returns "" both when the agent can push workflows itself and when no lane can, so a merger-tier lane's park fell through to the owner.How
config.AgentPushesWorkflows(agent)ismodePushesWorkflowsover the agent's effective mode.pkg/github/issue_workflows_handoff.go:installationGrantsWorkflowsreads the installation throughinstallationProbe, cached for 5 minutes. A token-authenticated client or a failed read counts as unknown.workflowsHandoffreturnsSelfPushfor a lane that pushes workflows on a granting installation. It skips the hand-off when the grant is known to be missing, and otherwise keeps today's behaviour.WorkflowsPushable(repo)andCapabilityAvailable(repo, kind): a capable lane serves the repo, and the installation grants the permission.SweepWorkflowsBlockersreleases refuted blockers and addshive/workflows-laneto each, through the writeback gate (KindStageLabel).issue_request_watcher.go: aSelfPushdowngrade parks nothing, adds no label (the issue keeps its lane), appends the note to the comment or new issue, and auditspolicy=workflows-self-push.ctxis threaded into the downgrade helpers for the probe.pkg/blocker/ledger.go:SetCapabilityCheck(func(repo, number, kind)):Observestores a refuted capability report as a plain reason, so the loop guard still sees it. The check is per item:CapabilityAvailablereads the issue (and the PR, when it is one) and never refutes a fork PR's workflows blocker. feat(e2e): keep Linux security protections on during desktop tests and fail on blocked actions projectbluefin/testsuite#1037 is the case: the fixer's pushes to that fork were refused three times. An unreadable item keeps its blocker.RecheckCapabilities(held)lifts blockers per item, so a repo with no capable lane keeps its blocker.cmd/hive):configureGitHubClientinstalls the self-push lookup and the ledger check, so a rebuilt client re-installs them.runIssueUnparkSweepIfDueruns the re-check.addWorkflowPushCeilingadds the "in reach" section for agents whose tier pushes workflows.Tests
TestWorkflowsParkCheckedAgainstTierAndInstallation(9 rows, live #1059 text)TestCreateWorkflowsParkRefusedForMergerTierissue --needs-decision: created actionable, no park, no routing label, noteTestInstallationGrantIsCachedTestSweepWorkflowsBlockersReleasesGrantedBlockersTestObserveSkipsRefutedCapabilityBlocker,TestRecheckCapabilitiesReleasesOnlyRefutedTestWorkflowPushReachForMergerTier,TestAgentPushesWorkflowsgo testblocker, github/..., scheduler, policies, cmd/hive, dashboardpkg/configTestGateFailsClosedWithoutIP6Tablesfails on this host on untouched v6;pkg/writebackratchet passes with v6 (#16806) merged incheck-docs-citations.py src/docsscale-envelope.md:37re-anchored after the newclient.gofields)Notes
ledger.goin a different hunk (ClearItem). The two are complementary: that one is what a person sees and clicks; this one is what the relay and ledger record, plus the scheduled re-check.hive/workflows-lanesends the issue to the capable lane once it is answered. The scheduled pass does not un-park on its own.hive-open-issue comment --needs-decision, the path this changes. A park added as a bareneeds-humanlabel is caught by the ledger check, not the relay.🤖 Generated with Claude Code
https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1