Skip to content

πŸ› fix: share delegated capability-gap inference with blocker ledger - #15355

Merged
hivecommons-hive[bot] merged 4 commits into
v5from
hive/adopt-15310
Oct 29, 2026
Merged

hivecommons-hive[bot] merged 4 commits into
v5from
hive/adopt-15310

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

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 9614bda00e93 as pushed by @thatguywob (fork thatguywob/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 their Signed-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 9614bda00e93 requested 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.

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>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 29, 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 nicholasjackson 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/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 29, 2026
@github-actions

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.

PR Title Relation Files
#15310 πŸ› fix: share delegated capability-gap inference with blocker ledger same files changelog.d/fixed-delegated-capability-inference.md
src/pkg/delegatedecision/policy.go
src/pkg/delegatedecision/policy_test.go

@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 Oct 29, 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.

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

@hivecommons-hive hivecommons-hive Bot added stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 29, 2026
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>
@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Oct 29, 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.

Reviewed β€” no findings from this perspective.

β€” hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@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.

Correctness (delta re-review, head 357ddfd) β€” previous findings resolved; one low advisory.

  • βœ… Fixed: src/pkg/delegatedecision/policy.go:256 β€” appPermissionRE now accepts workflows? as the trailing noun, so "The App cannot push workflows." / "The App cannot edit the workflow." again reach CapabilityGap (policy.go:332-339) and keep the park. Covered by the two new cases in policy_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 at policy.go:256). These would be parked as RuleCapabilityGap (policy.go:384-385) instead of being decided. The negative list at policy_test.go:66-69 has no no …workflow question case. Since the failure direction is "stays parked", this is not blocking; a follow-up could require (?:push|edit|update|modify|write|change) before workflows? 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

@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.

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 now blocker.Infer(text) β†’ Kind.IsCapability() (src/pkg/blocker/blocker.go:66,197) or appPermissionRE (policy.go:256). The only delta from #15310's head 9614bda is restoring workflows? as a terminal in appPermissionRE plus 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 throwaway go run main:
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\b alternative from the old regex is covered by the ledger's first workflows rule (blocker.go:173-174); no workflows permission still parks.
  • Rule ordering in decideIssue (policy.go:384) and the operator-actions switch on RuleCapabilityGap (src/pkg/dashboard/operator_actions.go:596) are untouched, so no caller sees a behaviour change beyond the intended one. pkg/blocker imports 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

@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.

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 β€” appPermissionRE now ends in (?:workflows?|permissions?), restoring the workflows? terminal the earlier head (9614bda) had dropped. policy_test.go:30-31 adds 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 β€” isCapability is (blocker.Infer(text) && k.IsCapability()) || appPermissionRE; && binds tighter than ||, so the generic guard is a true union, not a gate on ok. blocker.Infer (src/pkg/blocker/blocker.go:197-205) strips HTML markers and checks the four capability rules before HumanOnlyCLA, so a CLA sentence cannot shadow a capability one; IsCapability() (blocker.go:66) excludes human-only:*, and the test's "must sign the CLA" case covers that.
  • decideIssue ordering (policy.go:379-390) is unchanged; pkg/blocker imports 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

@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.

Reviewed β€” no findings from this perspective.

β€” hive: agent=adjudicator-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive
hivecommons-hive Bot merged commit db1728c into v5 Oct 29, 2026
73 of 75 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the hive/adopt-15310 branch October 29, 2026 08:43
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
Evidence bundle `#15355357ddfd` sha256:825f3790e9ab961555937fe6aa36910bd9a2a761d1976c0c8f18b4ee9b6a0ca1 β€” download from the dashboard or `hivectl review evidence #15355`.

@github-actions

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

@hivecommons-hive hivecommons-hive Bot removed 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 Oct 29, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Test coverage (quality) β€” approve, no findings (read at head 357ddfd).

TestCapabilityGapSharedInference fails without the change: "cannot push to the upstream repository", "cannot update the protected branch" and "cannot set the repository secret" contain neither workflows? nor permissions?, so the old capabilityGapRE rejected them and only blocker.Infer accepts them. Positives are driven through Title/Question/Reasons/Body and the 11-line body depth; negatives pin the 12-line cutoff, KindPR, the "has the required permissions" non-gap, and a question-shaped headline. The generic appPermissionRE fallback is exercised by the issues: write / checks: write / administration cases. Nothing left to pin.


🐝 Hive Agent: quality | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

β€” hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Review backlog (correctness): Two capability-gap guards now coexist after rebase (#15127 policy regex + this PR's ledger short-circuit)

1 participant