Skip to content

feat(dispatch): R1 ownership cap, no auto-fix in squabbler and licence categories - #1088

Merged
hyperpolymath merged 1 commit into
mainfrom
claude/r1-squabbler-cap
Nov 14, 2026
Merged

hyperpolymath merged 1 commit into
mainfrom
claude/r1-squabbler-cap

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

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.

Group Recipes Result
A pins and locks pin-github-actions, pin-dependencies, scorecard-pinned-deps squabbler-owned: report + referral
B workflow content scorecard-dangerous-workflow, scorecard-sast, add-dependabot, scorecard-dependency-update squabbler-owned: report + referral
C safe code fixes fix-http-to-https, shell-quote-vars, remove-believe-me squabbler-owned: report + referral
D licence and SPDX add-license-file, fix-spdx-license, fix-pmpl-drift, fix-spdx-double-suffix, scorecard-license flag only
E repository settings 4 scorecard recipes unchanged (not decided in #1080)
F seeds and Hypatia operations add-security-policy, 3 scorecard seeds, close-obsolete-pr, budget-resume-sweep, retired-descriptile-policy unchanged: the template owns the seeds; Hypatia keeps base compliance and its own operations

How

  • Policy file .machine_readable/fix-ownership-policy.json: squabbler_owned (A-C) and flag_only (D), by recipe id.
  • TriangleRouter.ownership_cap/1 and recipe_strategy/1 read it 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. Recipe confidences are not changed.
  • 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 says "refer to cicd-squabbler" or "flag only".
  • DispatchManifest: capped entries get strategy: report_only, auto_fixable: false and an ownership_cap field, so the bash runner applies nothing.
  • fixer/: missing-spdx-header, unpinned-action and missing-toolchain-input are reported with auto_fixable: false, and the 3 matching catalog entries are false. cicd-fixer fix / batch --fix now 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

  • New test/fix_ownership_cap_test.exs: one test per group. A-D are capped and stay report_only even at confidence 0.99. E and F are uncapped and still auto_execute. One test checks the manifest entries.
  • Mutation check: with ownership_cap/1 returning nil, 5 of the 7 new tests fail.
  • New Rust test fix_repo_reports_but_never_applies_r1_categories: the 3 issues are still reported, none is auto-fixable, and fix_repo leaves the workflow byte-for-byte unchanged. It fails before the change.
  • test/dispatch_manifest_test.exs uses an uncapped example id, because recipe-shell-quote-vars is now group C.
  • Full Elixir suite (OTP 27.3.4.19, Elixir 1.17.3): 3073 tests, 0 failures, 246 excluded. mix compile --warnings-as-errors is clean; changed files are formatted.
  • fixer/: cargo test 4 passed; cargo fmt --check and cargo clippy --all-targets clean.

Generated by Claude Code

…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
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: d0257458-13c1-4497-b4d2-16d5fdd80646
Commits

Reviewing files that changed from the base of the PR and between b7944d3 and 1c9807c.

Files selected for processing: 9

  • .machine_readable/fix-ownership-policy.json
  • fixer/src/catalog.rs
  • fixer/src/lib.rs
  • fixer/src/scanner.rs
  • lib/dispatch_manifest.ex
  • lib/fleet_dispatcher.ex
  • lib/triangle_router.ex
  • test/dispatch_manifest_test.exs
  • test/fix_ownership_cap_test.exs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@sonarqubecloud

Copy link
Copy Markdown

@hyperpolymath
hyperpolymath marked this pull request as ready for review November 14, 2026 13:16
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T13:24:32.453622Z 1c9807c Draft marked ready
🔒 Security Review ❌ Failed 2026-11-14T13:16:58.370925Z
We couldn’t complete this review. Comment @codex security review to try again.
1c9807c Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@hyperpolymath
hyperpolymath merged commit 4446507 into main Nov 14, 2026
98 checks passed
@chatgpt-codex-connector

Copy link
Copy Markdown

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.

@hyperpolymath
hyperpolymath deleted the claude/r1-squabbler-cap branch November 14, 2026 13:17

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment thread lib/fleet_dispatcher.ex
Comment on lines +57 to +61
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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread lib/fleet_dispatcher.ex
Comment on lines +52 to +55
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).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment thread lib/triangle_router.ex
Comment on lines +112 to +115
def recipe_strategy(recipe) do
case ownership_cap(recipe) do
nil -> dispatch_strategy(Map.get(recipe, "confidence", 0.0))
_cap -> :report_only

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread lib/fleet_dispatcher.ex
dispatch_to_sustainabot(%{
type: :eco_score,
repo: get_pattern_repo(pattern),
score: 0.5,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

hyperpolymath added a commit that referenced this pull request Nov 14, 2026
## 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

R1: Hypatia's own fixers become report- or referral-only in cicd-squabbler's categories (design)

3 participants