Skip to content

feat(scripts): backfill the risk-control calibration set from decision history - #8944

Merged
JSONbored merged 4 commits into
mainfrom
feat/calibration-label-backfill
Jul 26, 2026
Merged

feat(scripts): backfill the risk-control calibration set from decision history#8944
JSONbored merged 4 commits into
mainfrom
feat/calibration-label-backfill

Conversation

@JSONbored

@JSONbored JSONbored commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Advances #8828.

The risk-control guarantee (#8835) needs adjudicated (confidence, correct?) pairs and the naive path is weeks of live label accrual. But ai_review_cache has retained per-finding confidence since 2026-06-28 and review_audit holds every acted gate decision — this backfill stages calibration candidates from that existing evidence, and adds the pre-registered α(n) tightening schedule so the published guarantee strengthens itself as labels accrue.

  • Pure core (scripts/backfill-decision-labels-core.ts): acted closes stage as close_arm (a close whose realized outcome is merged = reopened-and-merged = the definitive incorrect class). Holds whose only blockers were AI-judgment findings stage as holdout_close for ANALYSIS only — adjudicating the backfill proved surviving holds are not valid close counterfactuals (a hold that survived means a non-confidence criterion blocked the close), so apply inserts close_arm rows only; the live ε-holdout (calibration: randomized ε-holdout on would-close PRs with propensity logging #8831) samples the would-close population and stays the valid source going forward.
  • Thin IO wrapper: stdin candidates → {records, labels, worklist}. Records reuse buildDecisionRecord/canonicalJson (byte-identical digests); configDigest: "backfill:unavailable" is the honest provenance sentinel; no decision-ledger writes (the chain attests live finalizations only). Labels stage status='pending' — invisible to loadCalibrationPairs until adjudication flips them.
  • Pre-registered α(n) schedule (src/review/risk-control-wire.ts): when no env α pins an arm, the close arm's budget follows a deterministic function of usable-label count — 0.05 under 350 pairs, 0.025 from 350, 0.015 from 700. Sample size is information, not the test statistic, so the walk is not outcome-snooping and each daily recalibration still runs exactly one level-δ test; the homepage claim self-tightens 95% → 97.5% → 98.5% with zero human steps. (The α-grid alternative needs a Bonferroni δ-split that raises every floor ~35% and certifies nothing at today's volume.)

Ran against production history: 653 candidates → 331 staged (232 close_arm, 99 analysis-only holdout_close), 280 mixed-blocker holds excluded, 42 duplicates deduped. Adjudicated close_arm set: 226 usable pairs, 9 incorrect (96.0% acted-close precision, coherent with the published 95.7% baseline); at today's volume the schedule's first tier certifies λ̂=0.62 at 57% coverage.

…n history

ai_review_cache has retained per-finding confidence since 2026-06-28 and
review_audit holds every acted gate decision, so the risk-control label
floor can be cleared from existing evidence instead of weeks of live
accrual. Pure core stages acted closes (close_arm; closed-then-merged is
the definitive incorrect class) and AI-judgment-only holds (holdout_close,
the below-floor strata a lower certified threshold needs); the wrapper
reuses buildDecisionRecord/canonicalJson so backfilled records are
byte-compatible, with configDigest 'backfill:unavailable' as the honest
provenance sentinel and no ledger writes (the chain attests live
finalizations only).
@superagent-security

Copy link
Copy Markdown
Contributor

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

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 26, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
loopover-ui d8bf3f8 Commit Preview URL

Branch Preview URL
Jul 26 2026, 02:13 PM

When no env alpha pins an arm, the close arm's error budget now follows a
deterministic schedule of usable-label count: 0.05 under 350 pairs, 0.025
from 350, 0.015 from 700. Sample size is information, not the test
statistic, so walking the schedule as labels accrue is not outcome
snooping and each daily recalibration still runs exactly one level-delta
test; the published guarantee self-tightens 95% -> 97.5% -> 98.5% with no
human step. Also documents the backfill population finding: staged
holdout_close rows are analysis-only — surviving holds are not valid
close counterfactuals; only acted closes enter calibration.
@JSONbored JSONbored self-assigned this Jul 26, 2026
@JSONbored
JSONbored merged commit 0df902b into main Jul 26, 2026
2 checks passed
@JSONbored
JSONbored deleted the feat/calibration-label-backfill branch July 26, 2026 14:28
@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
21936 1 21935 21
View the top 1 failed test(s) by shortest run time
test/unit/miner-worktree-allocator-collisions.test.ts > loopover-miner worktree allocator collisions (#4298) > returns distinct worktree paths when multiple processes acquire simultaneously
Stack Traces | 0.453s run time
AssertionError: expected 2 to be 5 // Object.is equality

- Expected
+ Received

- 5
+ 2

 ❯ test/unit/miner-worktree-allocator-collisions.test.ts:148:41

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

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