Repository navigation
feat(dispatch): R1 ownership cap, no auto-fix in squabbler and licence categories - #1088
Conversation
…d licence categories Owner ruling R1 and the owner answers on #1080 (2026-11-14): - .machine_readable/fix-ownership-policy.json lists the capped recipes: squabbler_owned (groups A pins and locks, B workflow content, C safe code fixes) and flag_only (group D licence and SPDX). Groups E and F are not listed and keep their confidence tier. - TriangleRouter.ownership_cap/1 and recipe_strategy/1 read the policy at compile time (a missing or malformed file stops the build). A capped recipe is report_only whatever its confidence, so Bayesian updating cannot raise it back to auto_execute. - FleetDispatcher: a capped eliminate or substitute recipe is never fixed by any path (fleet, direct PR or substitution PR). It becomes a sustainabot advisory that refers it to cicd-squabbler or flags it. - DispatchManifest: capped entries are report_only with auto_fixable false and an ownership_cap field, for the bash runner. - fixer/: missing-spdx-header, unpinned-action and missing-toolchain-input are reported with auto_fixable false, and the 3 matching catalog entries are false, so cicd-fixer fix applies none. Tests: test/fix_ownership_cap_test.exs (one test per group A-F plus the manifest) and fixer test fix_repo_reports_but_never_applies_r1_categories. Both fail when the cap is removed. dispatch_manifest_test now uses an uncapped example id, since recipe-shell-quote-vars is group C. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0136P7Zo6VBPrBWYUmDJZR1H
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 27 seconds. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1c9807ce85
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ], | ||
| "B_workflow_content": [ | ||
| "recipe-scorecard-dangerous-workflow", | ||
| "recipe-scorecard-sast", |
There was a problem hiding this comment.
Add the wildcard SAST recipe to the ownership cap
When an SC-014-sast finding comes from a repository whose inferred language is not yaml, RecipeMatcher rejects recipe-scorecard-sast and selects recipe-add-sast-workflow, which matches the same pattern, uses the same fix-sast-workflow.sh, and permits every language. Because that recipe is absent from this group, its 0.90 confidence still routes to rhodibot and can open the parallel SAST-fix PR that R1 is intended to prohibit; cap this alias as well.
Useful? React with 👍 / 👎.
| def dispatch_routed_action({tier, recipe, pattern} = action) | ||
| when tier in [:eliminate, :substitute] do | ||
| case TriangleRouter.ownership_cap(recipe) do | ||
| nil -> dispatch_uncapped(action) | ||
| cap -> dispatch_capped(cap, recipe, pattern) |
There was a problem hiding this comment.
Preserve ownership caps when neural routing returns control
When the neural coordinator marks a capped action novel or recommends :report_only, DispatchGuard.enforce/2 converts it to {:control, pattern} and discards the recipe before this clause runs. The control handler consequently emits the generic “no safe fix available” advisory, rather than the required cicd-squabbler referral or licence/SPDX flag-only message, and the manifest also loses ownership_cap; preserve the cap or recipe ID through that demotion so capped findings retain their intended disposition.
Useful? React with 👍 / 👎.
| An `:eliminate` or `:substitute` recipe with an ownership cap | ||
| (`TriangleRouter.ownership_cap/1`, owner ruling R1) is never fixed here, by | ||
| any path: it becomes a sustainabot advisory that refers the finding to | ||
| cicd-squabbler, or flags it for a person (licence/SPDX). |
There was a problem hiding this comment.
Enforce the pinning cap in the public direct-PR API
The documented public DirectGitHubPR.create_fix_pr/1 and batch_create_prs/2 entrypoints still accept SC-013 findings and directly run the pinning fix script before opening a PR. Any caller using that standalone API bypasses this dispatcher clause entirely, so the claim that capped pinning recipes are blocked from every direct-PR path is false; the direct-PR module must reject SC-013 or consult the ownership policy itself.
Useful? React with 👍 / 👎.
| def recipe_strategy(recipe) do | ||
| case ownership_cap(recipe) do | ||
| nil -> dispatch_strategy(Map.get(recipe, "confidence", 0.0)) | ||
| _cap -> :report_only |
There was a problem hiding this comment.
Apply recipe_strategy to auto-executable summaries
The new strategy helper is not used by the existing reporting paths: PatternAnalyzer.generate_summary/2 still counts any eliminate recipe with confidence at least 0.95 as auto-executable, while VCL.Query.pipeline_health/0 uses confidence plus the recipe's unchanged auto_fixable field. High-confidence capped recipes are therefore reported as eligible for automatic execution even though the manifest and dispatcher refuse them, producing contradictory batch summaries and pipeline-health metrics; these counters should classify recipes through recipe_strategy/1.
Useful? React with 👍 / 👎.
| dispatch_to_sustainabot(%{ | ||
| type: :eco_score, | ||
| repo: get_pattern_repo(pattern), | ||
| score: 0.5, |
There was a problem hiding this comment.
Preserve the finding severity in capped advisories
When a capped pattern carries a computed severity_score, this new advisory path discards it and always reports 0.5; the control, Dependabot-control, and ordinary report-only paths all use Map.get(pattern, "severity_score", 0.5). Consequently a high or critical capped security finding is downgraded in Sustainabot while a low-severity one is inflated, which can distort its prioritization; retain the supplied score and use 0.5 only as the fallback.
Useful? React with 👍 / 👎.
## Summary Follow-up to #1088, from the owner's answer on #1080 (2026-11-14): group E is reported to the owner. The 4 repository-settings recipes (`scorecard-branch-protection`, `scorecard-code-review`, `scorecard-webhooks`, `scorecard-signed-releases`) no longer auto-execute. A commit cannot fix a repository setting, so a bot should not try one. Hypatia now sends the finding to the owner as an advisory. - `.machine_readable/fix-ownership-policy.json` gains a `report_to_owner` list (group E). - `TriangleRouter.ownership_cap/1` returns `:report_to_owner` for these recipes, so `recipe_strategy/1` is `report_only` whatever the confidence. The manifest entries carry `ownership_cap: "report_to_owner"`. - The `FleetDispatcher` advisory text says "report to owner: a repository setting no commit can fix". Group F (seeds and Hypatia operations) still keeps its confidence tier. **Manual reconciler (Codex P1, owner answer 2026-11-14):** `mix hypatia.reconcile` changed branch protection and required reviews (`BranchProtectionID`, `CodeReviewID`) through the GitHub settings API by default. It now escalates them to the owner by default. `ScorecardReconciler.reconcile/3` defaults to `:conservative`, and the mix task changes settings only with the new `--apply-settings` flag. `--conservative` is still accepted, and it wins if both flags are given. Settings findings escalated this way now count in the summary's `escalated` total. **Known, not changed here:** `recipe-scorecard-signed-releases` and `recipe-scorecard-webhooks` target the categories `SignedReleases` and `Webhooks`, but `ScorecardIngestor` emits `ReleaseSigning` and `WebhookSecurity`. So `RecipeMatcher` never selects these 2 recipes (this is already so on `main`). Their findings take the generic control route, which is a report-only advisory, so the owner's "report, no fix" result already holds. Aligning the categories would only change the advisory text. ## Test plan - [x] `test/fix_ownership_cap_test.exs`: group E moves from the uncapped list to the capped list, and must be `report_only` even at confidence 0.99. Group F is still checked as uncapped. - [x] Mutation check: with the group E list emptied, the group E test fails. - [x] `test/scorecard_reconciler_test.exs`: new tests pin the reconcile/3 default and the mix task flags. With the old `:full_auto` default restored, the reconcile/3 test fails. - [x] `escalated?/1` test: a default-escalated settings finding counts as escalated; it fails when that clause is removed. - [x] Full Elixir suite (OTP 27.3.4.19, Elixir 1.17.3): 3161 tests, 0 failures, 246 excluded. `mix compile --warnings-as-errors` is clean; changed files are formatted. --- _Generated by [Claude Code](https://claude.ai/code/session_0136P7Zo6VBPrBWYUmDJZR1H)_ --------- Co-authored-by: Claude <[email protected]>



Summary
Implements owner ruling R1 with the owner's answers on #1080 (2026-11-14). Hypatia no longer auto-fixes in cicd-squabbler's categories or in licence/SPDX. It reports and refers instead.
pin-github-actions,pin-dependencies,scorecard-pinned-depsscorecard-dangerous-workflow,scorecard-sast,add-dependabot,scorecard-dependency-updatefix-http-to-https,shell-quote-vars,remove-believe-meadd-license-file,fix-spdx-license,fix-pmpl-drift,fix-spdx-double-suffix,scorecard-licenseadd-security-policy, 3 scorecard seeds,close-obsolete-pr,budget-resume-sweep,retired-descriptile-policyHow
.machine_readable/fix-ownership-policy.json:squabbler_owned(A-C) andflag_only(D), by recipe id.TriangleRouter.ownership_cap/1andrecipe_strategy/1read it at compile time. A missing or malformed file stops the build. A capped recipe isreport_onlywhatever its confidence, so Bayesian updating cannot raise it back toauto_execute. Recipe confidences are not changed.FleetDispatcher: a capped:eliminateor:substituterecipe is never fixed by any path (fleet, direct PR or substitution PR). It becomes a sustainabot advisory that says "refer to cicd-squabbler" or "flag only".DispatchManifest: capped entries getstrategy: report_only,auto_fixable: falseand anownership_capfield, so the bash runner applies nothing.fixer/:missing-spdx-header,unpinned-actionandmissing-toolchain-inputare reported withauto_fixable: false, and the 3 matching catalog entries arefalse.cicd-fixer fix/batch --fixnow apply nothing (the same approach as Permission fixers write least privilege, never read-all #1057 for permissions).Behaviour change: these 15 recipes and 3 fixer categories stop auto-fixing today. Group D removes auto-fix that existed before, as approved in #1080 question 2.
Not in this PR: the Bustfile referral response (the advisory text is the interim referral), and group E.
Closes #1080.
Test plan
test/fix_ownership_cap_test.exs: one test per group. A-D are capped and stayreport_onlyeven at confidence 0.99. E and F are uncapped and stillauto_execute. One test checks the manifest entries.ownership_cap/1returningnil, 5 of the 7 new tests fail.fix_repo_reports_but_never_applies_r1_categories: the 3 issues are still reported, none is auto-fixable, andfix_repoleaves the workflow byte-for-byte unchanged. It fails before the change.test/dispatch_manifest_test.exsuses an uncapped example id, becauserecipe-shell-quote-varsis now group C.mix compile --warnings-as-errorsis clean; changed files are formatted.fixer/:cargo test4 passed;cargo fmt --checkandcargo clippy --all-targetsclean.Generated by Claude Code