Skip to content

fix(reputation): never cadence-downgrade a trusted submitter, and never claim a review was skipped when it ran - #9800

Merged
JSONbored merged 1 commit into
mainfrom
fix/cadence-trusted-exemption
Jul 29, 2026
Merged

fix(reputation): never cadence-downgrade a trusted submitter, and never claim a review was skipped when it ran#9800
JSONbored merged 1 commit into
mainfrom
fix/cadence-trusted-exemption

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

What happened

The repo owner's own PRs started showing:

⏸️ Required AI review was skipped by a submitter-reputation downgrade — the submitter's recent-submission signal downgraded this PR to deterministic-only checks.

…and on #9764, that bullet rendered directly above a successful AI review summary, holding the gate for a review that had already run.

Root causes (both verified live)

1. The cadence leg has no notion of an earned record. shouldSkipAiForReputation has two legs: the quality/burst signal, and isMachinePacedCadence (≥5 submissions in 24h with a median gap under 10 minutes). The maintainer's remediation campaign measured 50 submissions / 7.2-minute median gap — machine-paced by definition — so every PR was downgraded, even though the same module's quality signal rates them trusted (145 recent merges classified success; verified by running the production query against the live ledger).

The cadence check is a spend control against unproven accounts. A trusted submitter — the module's own definition of proven: 5+ recent merged successes at a low fail rate, recency-windowed — now short-circuits it. The exemption can't be farmed into a loophole: reaching "trusted" requires real merged PRs on that repo inside the window, and a single prompt-injection row hard-locks the signal to low before success counting — pinned by an invariant test.

2. The hold finding described the heuristic, not reality. forceAiReview (the panel checkbox / @loopover review) and aiReviewAllAuthors both bypass the reputation skip in shouldStartAiReviewForAdvisory — but maybeAddReputationSkipHold pushed the "was skipped" finding on reputationSkipped alone. So a forced re-run produced a real review and a bullet claiming it was skipped, and held the gate anyway. The hold now returns early on either bypass.

Operational note

LOOPOVER_REVIEW_REPUTATION is commented out on the ORB (with a dated note) until this ships in an image — the owner shouldn't be rate-limited by their own anti-abuse system in the meantime. Re-enabling is a one-line uncomment.

Tests

4 new: the trusted-exemption regression (6 merges + 8 PRs at 4-minute pace → no downgrade), the prompt-injection invariant (banked merges + one injection → still downgraded), and one regression per bypass for the hold (forced re-run, aiReviewAllAuthors). 39 + 15 pass in the touched files; tsc clean.

…er claim a review was skipped when it ran

Two defects found live on the ORB, both surfaced by the maintainer's own PRs:

1. The machine-paced cadence leg of shouldSkipAiForReputation downgraded the
   repo OWNER to deterministic-only on every PR: 50 submissions in 24h at a
   7.2-minute median gap trips isMachinePacedCadence (>=5 in 24h, median gap
   under 10 minutes), regardless of a 145-merge success record. The cadence
   check is a spend control against UNPROVEN accounts; "trusted" is this same
   module's own definition of proven (5+ recent merged successes at a low fail
   rate). A trusted submitter now short-circuits the cadence read entirely.
   The exemption cannot mask genuine abuse: any prompt-injection row in the
   window hard-locks the signal to "low" before success counting, pinned by an
   invariant test.

2. maybeAddReputationSkipHold pushed the "Required AI review was skipped by a
   submitter-reputation downgrade" finding whenever the skip WOULD fire --
   without checking that aiReviewAllAuthors or a forced re-run bypassed it, in
   which case the review genuinely ran. The published panel then asserted the
   review was skipped directly above that review's own summary, and held the
   gate for a review that succeeded (observed on #9764).
   The hold now describes what happened, not what the heuristic wanted.

Operationally: LOOPOVER_REVIEW_REPUTATION is commented out on the ORB until
this ships in an image; re-enabling is a one-line uncomment.
@loopover-orb

loopover-orb Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Important

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏳ LoopOver is waiting…

LoopOver has seen this pull request and is waiting on CI checks to finish before reviewing it. This comment will update once the review runs.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed · 🟨 Waiting

@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored JSONbored self-assigned this Jul 29, 2026
@JSONbored
JSONbored merged commit c37c1ae into main Jul 29, 2026
4 checks passed
@JSONbored
JSONbored deleted the fix/cadence-trusted-exemption branch July 29, 2026 10:07
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.52%. Comparing base (f5711a3) to head (366f2fe).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9800      +/-   ##
==========================================
- Coverage   90.33%   89.52%   -0.82%     
==========================================
  Files         918      918              
  Lines      113936   113938       +2     
  Branches    26975    26977       +2     
==========================================
- Hits       102926   101998     -928     
- Misses       9681    10850    +1169     
+ Partials     1329     1090     -239     
Flag Coverage Δ
backend 94.09% <100.00%> (-1.48%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/queue/processors.ts 94.75% <100.00%> (+<0.01%) ⬆️
src/review/reputation-wire.ts 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes

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.

1 participant