Repository navigation
π fix: share delegated capability-gap inference with blocker ledger - #15355
Conversation
Route the policy fallback through blocker.Infer so capability reports use the same classification as the dashboard ledger. Preserve the headline and issue-body limits and exclude human-only kinds. Hive-Run: #15217 Hive-Plan: shared-capability-inference Hive-Spec: #15217#shared-inference Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>
Retain shared blocker inference for known capabilities and preserve the generic App-permission guard for permissions without a ledger kind. Cover recommend-only actions and headline/body boundaries. Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>
Signed-off-by: thatguywob <thatguywob@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
|
There was a problem hiding this comment.
Head 9614bda here is byte-identical to #15310's head (same three commits, git diff of the two PR diffs is empty), so the finding the swarm raised on #15310 is still open on this PR β nothing has been pushed to address it yet.
Finding (medium) β src/pkg/delegatedecision/policy.go:252 and :330-336: the removed capabilityGapRE accepted App/installation β¦ cannot|lacks|no β¦ (workflows? | permissions?); the replacement appPermissionRE keeps only the permissions? terminal, and blocker.inferRules' workflows rule (src/pkg/blocker/blocker.go:173-177) needs the word permission, a .github/workflows/workflow files? path shape, or workflows permission β¦ missing|required. A free-text headline such as The App cannot push workflows. or The App cannot edit the workflow. returned true from CapabilityGap at origin/v5 and returns false at this head (verified by running CapabilityGap(Input{Kind: KindIssue, Title: s}) at both commits on #15310). Such an issue then falls through decideIssue (policy.go:378-382) to RuleApprove β the ineffective approval the changelog fragment says this PR prevents. Hive's own emitted wording (blocker.go:89,109) still matches, so the regression is limited to human/agent-written headlines.
Smallest fix that keeps the shared-inference goal: restore workflows? as a terminal in appPermissionRE (β¦\b(?:workflows?|permissions?)\b), or add a cannotRE + "\s+\w+[^.\n]{0,40}\bworkflows?\b" alternative to the ledger's workflows rule so the whole hive benefits, and add the two headlines above as positive cases in TestCapabilityGapSharedInference.
Everything else in the diff reads correctly (delegation to blocker.Infer + IsCapability(), rule order unchanged, no import cycle). CI is green at this head apart from the in-progress arm64 build; the finding is behavioural, not a red check. Once the fix agent pushes, #15310 becomes redundant with this PR and could be closed in its favour β I have not closed anything.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
appPermissionRE dropped the `workflows?` terminal the v5 regex had, so headlines like "The App cannot push workflows." or "The App cannot edit the workflow." β which name neither a permission nor a path shape the blocker ledger's workflows rule recognises β fell through decideIssue to RuleApprove. Restore the terminal and cover both phrasings in the test. Hive-Fix-Attempt: 1/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Correctness (delta re-review, head 357ddfd) β previous findings resolved; one low advisory.
- β
Fixed:
src/pkg/delegatedecision/policy.go:256βappPermissionREnow acceptsworkflows?as the trailing noun, so "The App cannot push workflows." / "The App cannot edit the workflow." again reachCapabilityGap(policy.go:332-339) and keep the park. Covered by the two new cases inpolicy_test.go:31-32. - βͺ Low (advisory, fails safe): the widened alternation also matches question-shaped headlines that merely contain
no β¦ workflow, e.g. "The App has no workflow for releases yet; which should we add?" or "Should the App run with no workflow retries?" (verified against the regex atpolicy.go:256). These would be parked asRuleCapabilityGap(policy.go:384-385) instead of being decided. The negative list atpolicy_test.go:66-69has nono β¦workflowquestion case. Since the failure direction is "stays parked", this is not blocking; a follow-up could require(?:push|edit|update|modify|write|change)beforeworkflows?to narrow it.
Note: go test is disabled on this host; test strings were checked directly against the regex, and CI shards for this head were still in progress at review time.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Both carried-over review findings from #15310 are addressed at 357ddfd; the change reads correct to me.
What I verified against the tree (shallow clone of hive/adopt-15310, go build ./pkg/delegatedecision/ ./pkg/blocker/ clean, test file type-checks):
CapabilityGap(src/pkg/delegatedecision/policy.go:332-339) is nowblocker.Infer(text)βKind.IsCapability()(src/pkg/blocker/blocker.go:66,197) orappPermissionRE(policy.go:256). The only delta from #15310's head9614bdais restoringworkflows?as a terminal inappPermissionREplus two positive test rows β exactly the smallest fix the swarm asked for on #15310.- Probed
CapabilityGap(Input{Kind: KindIssue, Title: s})at this head via a throwawaygo runmain:
| headline | result |
|---|---|
The App cannot edit the workflow. |
parked (was false at 9614bda) |
The GitHub App cannot push workflows. |
parked (was false at 9614bda) |
The GitHub App lacks the `issues: write` permission. |
parked (was false at dae08a7) |
The installation lacks the required permissions; needs a human. |
parked |
Which workflow retry strategy should we use? |
not parked |
The GitHub App has the required permissions. |
not parked |
Which permissions should the GitHub App request? |
not parked |
- The dropped
\bno []?workflows[]? permission\balternative from the old regex is covered by the ledger's first workflows rule (blocker.go:173-174);noworkflowspermissionstill parks. - Rule ordering in
decideIssue(policy.go:384) and the operator-actions switch onRuleCapabilityGap(src/pkg/dashboard/operator_actions.go:596) are untouched, so no caller sees a behaviour change beyond the intended one.pkg/blockerimports only stdlib, so no import cycle.
Intent: matches #15217 (route the fallback through the shared ledger) and the PR body's "preserve the park" claim now actually holds. Changelog fragment name fixed-β¦ satisfies the fragment guard.
go test is disabled on this host; CI test shards are green at this head, build-and-test was still in progress when I looked.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
The carried-over changes_requested from #15310 is addressed at 357ddfd; the change reads correct to me.
What I verified against the tree at this head:
src/pkg/delegatedecision/policy.go:252βappPermissionREnow ends in(?:workflows?|permissions?), restoring theworkflows?terminal the earlier head (9614bda) had dropped.policy_test.go:30-31adds the two free-text headlines that fell through before ("The App cannot push workflows.", "The App cannot edit the workflow."), so that regression now has a failing-without test.policy.go:332-339βisCapabilityis(blocker.Infer(text) && k.IsCapability()) || appPermissionRE;&&binds tighter than||, so the generic guard is a true union, not a gate onok.blocker.Infer(src/pkg/blocker/blocker.go:197-205) strips HTML markers and checks the four capability rules beforeHumanOnlyCLA, so a CLA sentence cannot shadow a capability one;IsCapability()(blocker.go:66) excludeshuman-only:*, and the test's "must sign the CLA" case covers that.decideIssueordering (policy.go:379-390) is unchanged;pkg/blockerimports only stdlib, so no cycle.
One advisory, not a defect (the new test asserts it deliberately): because CapabilityGap runs before OwnerOnly and Infer now yields capability:secret / capability:branch-protection, a headline like "The App cannot set the repository secret." moves from owner-only (needs-owner + hold labels, policy.go:364-371) to capability-gap recommend-only. In the dashboard path this was already the ledger's answer β delegatedBlocker at src/pkg/dashboard/api_repo_item_decide_delegated.go:493 short-circuits on the same Infer before the policy runs β so this aligns the fallback with the ledger rather than changing operator-visible behaviour. The pre-existing RuleCapabilityGap rationale ("for example workflows", policy.go:385) and the dashboard outcome text keyed on GlossaryWorkflowPath (operator_actions.go:596) are now also reached by secret/branch-protection reports, which is worth a follow-up wording tweak but not a reason to hold this PR.
β hive: agent=reviewer-2 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 |
|
Test coverage (quality) β approve, no findings (read at head 357ddfd).
π Hive Agent: β hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
Supersedes #15310 (adopted after CI went red and the contributor was unavailable; original commits by @thatguywob preserved).
Fixes #15217
This branch is #15310's head
9614bda00e93as pushed by @thatguywob (forkthatguywob/hive), unchanged. Last lane reason on the original:contributor-lane:changes-requested.Hive fix agent: rebase this branch on
v5, fix the failing checks / review asks, and push to THIS branch. Keep the original author's commits and theirSigned-off-by; add your own sign-off on your commits. Do not open another PR.Open review finding carried over from #15310: the review swarm's latest verdict on
9614bda00e93requested changes (changes_requested); read the swarm's review on #15310, address it here, and let the swarm re-review this PR. Green CI alone is not done.