Skip to content

feat(calibration): counterfactual prompt replay — offline harness + budget-gated advisory CI check#8271

Merged
JSONbored merged 1 commit into
mainfrom
feat/counterfactual-replay-harness
Jul 23, 2026
Merged

feat(calibration): counterfactual prompt replay — offline harness + budget-gated advisory CI check#8271
JSONbored merged 1 commit into
mainfrom
feat/counterfactual-replay-harness

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

Closes #8221. Closes #8222. (Phases 3+4 of sub-epic #8218, one PR per the fewer-larger-PRs direction.)

Implements the #8219 contract verbatim — every shape cited, none re-invented:

Validation

…udget-gated advisory CI check (#8221, #8222)

Closes the #8218 sub-epic's phases 3+4 against the #8219 contract verbatim:

- scripts/counterfactual-replay-core.ts (pure, unit-tested): abstention-safe
  variant-output parsing (never coerced), scoreBacktest mapping over the
  #8220 fixture plan, budget arithmetic + resume cursor, run-accounting
  invariant, artifact cache keys, Pareto baseline comparison
- scripts/counterfactual-replay.ts (thin IO): ollama smoke path only (BYOK
  refused loudly), raw outputs cached under a local artifacts dir so
  re-scoring is free, --baseline prints the shared renderer's comparison;
  exit reflects operational success only, never verdict
- src/services/ai-review.ts: REVIEW_PROMPT_VERSION + buildCanonicalJudgePrompt
  (the pure, input-free judge prompt the dual-checkout replay diffs)
- scripts/print-review-prompt.ts: the #8139 dual-checkout extractor
- .github/workflows/counterfactual-replay-check.yml: path-filtered on the
  judge-prompt surface, hard-gated on an explicitly configured replay budget
  (visible skipped-notice otherwise), byte-identical prompts short-circuit,
  fail-open on every step, update-in-place marker comment, persisted
  calibration.counterfactual_backtest_run events feeding the SAME
  REGRESSED-verdict track record as the threshold/logic backtests
- docs: worked ollama example + the prompt-change workflow
@github-actions

Copy link
Copy Markdown
Contributor

Logic backtest

Replayed 0 historical case(s) for linked_issue_scope_mismatch through the base (590befd) and head (7d81d1a) versions of its detection logic (corpus checksum 4f53cda18c2b).

Backtest comparison: linked_issue_scope_mismatch

Verdict: unchanged — no comparable axis moved.

Advisory only — this check never blocks merge (#8105).

@cloudflare-workers-and-pages

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 7d81d1a Commit Preview URL

Branch Preview URL
Jul 23 2026, 09:47 PM

@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 8.42kB (0.11%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
loopover-ui 7.46MB 8.42kB (0.11%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: loopover-ui

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/add-scalar-classes-C3YjslFQ.js (New) 2.17MB 2.17MB 100.0% 🚀
assets/tanstack-vendor-BDGYoO5p.js (New) 740.2kB 740.2kB 100.0% 🚀
assets/docs.fumadocs-spike-api-reference-9Fh13gmB.js (New) 442.92kB 442.92kB 100.0% 🚀
assets/AgentScalarChatInterface.vue-Dc3SZeJw.js (New) 201.71kB 201.71kB 100.0% 🚀
assets/modal-BK8i-o-w.js (New) 184.38kB 184.38kB 100.0% 🚀
assets/client-BZLnaAJ8.js (New) 146.06kB 146.06kB 100.0% 🚀
assets/maintainer-panel-DpZNY977.js (New) 78.99kB 78.99kB 100.0% 🚀
assets/ui-vendor-gFbJKT0G.js (New) 57.04kB 57.04kB 100.0% 🚀
assets/backtest-calibration-CpyZbFe_.js (New) 45.75kB 45.75kB 100.0% 🚀
assets/routes-jdWYtWkv.js (New) 34.98kB 34.98kB 100.0% 🚀
assets/owner-panel-BTMsUlca.js (New) 27.36kB 27.36kB 100.0% 🚀
assets/app-CtUMFl-W.js (New) 25.7kB 25.7kB 100.0% 🚀
assets/app.runs-B7zyFs6l.js (New) 23.56kB 23.56kB 100.0% 🚀
assets/miner-panel-CxyN3UZa.js (New) 20.28kB 20.28kB 100.0% 🚀
assets/api._op-Cxuhz0Fn.js (New) 17.57kB 17.57kB 100.0% 🚀
assets/self-hosting-docs-audit-B0FirIRR.js (New) 16.61kB 16.61kB 100.0% 🚀
assets/app.index-DZkzx25H.js (New) 15.62kB 15.62kB 100.0% 🚀
assets/docs._slug-CB_eW_8g.js (New) 15.37kB 15.37kB 100.0% 🚀
assets/playground-panel-BRhxA7ng.js (New) 14.49kB 14.49kB 100.0% 🚀
assets/fairness-B7Sz2g5y.js (New) 10.6kB 10.6kB 100.0% 🚀
assets/app.audit-D4OvMwph.js (New) 10.11kB 10.11kB 100.0% 🚀
assets/app.config-generator-CsynrCHH.js (New) 10.09kB 10.09kB 100.0% 🚀
assets/extension-CPSHEorR.js (New) 10.04kB 10.04kB 100.0% 🚀
assets/maintainers-DtLtkfD5.js (New) 8.09kB 8.09kB 100.0% 🚀
assets/miners-zRukiITO.js (New) 7.91kB 7.91kB 100.0% 🚀
assets/agents-Cl_Zq7wd.js (New) 7.8kB 7.8kB 100.0% 🚀
assets/commands-panel-BWjVHxOt.js (New) 6.65kB 6.65kB 100.0% 🚀
assets/maintainer-workflow-BFHEpOqu.js (New) 6.52kB 6.52kB 100.0% 🚀
assets/roadmap-CnqglAw7.js (New) 6.33kB 6.33kB 100.0% 🚀
assets/digest-panel-D1z2D2J8.js (New) 6.18kB 6.18kB 100.0% 🚀
assets/repos._owner._repo.quality-hv4jozcs.js (New) 6.14kB 6.14kB 100.0% 🚀
assets/docs.index-BG-L3Gt5.js (New) 5.79kB 5.79kB 100.0% 🚀
assets/docs-nav-C-ReOsg3.js (New) 5.59kB 5.59kB 100.0% 🚀
assets/api.index-I-0idIRE.js (New) 4.7kB 4.7kB 100.0% 🚀
assets/docs-6fAbVfbm.js (New) 2.7kB 2.7kB 100.0% 🚀
assets/api-CQG8svSu.js (New) 2.69kB 2.69kB 100.0% 🚀
assets/docs-page-Cqvy_-Qx.js (New) 2.1kB 2.1kB 100.0% 🚀
assets/table-CD0_VsnC.js (New) 1.75kB 1.75kB 100.0% 🚀
assets/app.workbench-C9zU_G3I.js (New) 1.58kB 1.58kB 100.0% 🚀
assets/session-n_dBYMl5.js (New) 1.45kB 1.45kB 100.0% 🚀
assets/tooltip-DO9IvUhC.js (New) 1.45kB 1.45kB 100.0% 🚀
assets/tabs-C3-9L3i7.js (New) 1.39kB 1.39kB 100.0% 🚀
assets/app.repos-DrRBrxaG.js (New) 1.07kB 1.07kB 100.0% 🚀
assets/input-ZyXsCRev.js (New) 796 bytes 796 bytes 100.0% 🚀
assets/file-cog-B9_iw9I5.js (New) 758 bytes 758 bytes 100.0% 🚀
assets/app.maintainer-DofS_aRV.js (New) 502 bytes 502 bytes 100.0% 🚀
assets/sparkles-DFqhZbL9.js (New) 494 bytes 494 bytes 100.0% 🚀
assets/app.owner-BSQEsznM.js (New) 474 bytes 474 bytes 100.0% 🚀
assets/app.commands-CtCI9aIG.js (New) 455 bytes 455 bytes 100.0% 🚀
assets/app.playground-Dc2YE2Rj.js (New) 442 bytes 442 bytes 100.0% 🚀
assets/reveal-cMgwJOja.js (New) 442 bytes 442 bytes 100.0% 🚀
assets/index-BdDQV3XP.js (New) 438 bytes 438 bytes 100.0% 🚀
assets/app.digest-hiRcjaIn.js (New) 430 bytes 430 bytes 100.0% 🚀
assets/eye-off-BjCjU0J2.js (New) 430 bytes 430 bytes 100.0% 🚀
assets/app.miner-9iZvDkOb.js (New) 422 bytes 422 bytes 100.0% 🚀
assets/key-round-BD2San90.js (New) 355 bytes 355 bytes 100.0% 🚀
assets/bot-aVeG4Xrx.js (New) 328 bytes 328 bytes 100.0% 🚀
assets/trash-2-DPKmZnJ5.js (New) 328 bytes 328 bytes 100.0% 🚀
assets/save-DUcjWdXh.js (New) 327 bytes 327 bytes 100.0% 🚀
assets/git-pull-request-arrow-C5f4g5wh.js (New) 321 bytes 321 bytes 100.0% 🚀
assets/wrench-CetIRk4B.js (New) 303 bytes 303 bytes 100.0% 🚀
assets/list-checks-BW8w-ilC.js (New) 279 bytes 279 bytes 100.0% 🚀
assets/shield-DLdaAweC.js (New) 272 bytes 272 bytes 100.0% 🚀
assets/workflow-0eXSTqp4.js (New) 265 bytes 265 bytes 100.0% 🚀
assets/compass-Dtm28W7t.js (New) 251 bytes 251 bytes 100.0% 🚀
assets/history-BfQHgDer.js (New) 237 bytes 237 bytes 100.0% 🚀
assets/activity-ZhDxHcbD.js (New) 234 bytes 234 bytes 100.0% 🚀
assets/message-square-18yi-GKZ.js (New) 233 bytes 233 bytes 100.0% 🚀
assets/lock-CSbGmKAQ.js (New) 206 bytes 206 bytes 100.0% 🚀
assets/rotate-cw-DsdmqKM8.js (New) 201 bytes 201 bytes 100.0% 🚀
assets/play-D5TKXEVf.js (New) 190 bytes 190 bytes 100.0% 🚀
assets/circle-check-BRE3966w.js (New) 178 bytes 178 bytes 100.0% 🚀
assets/search-oqYhjtCQ.js (New) 174 bytes 174 bytes 100.0% 🚀
assets/circle-D3rcEQ6W.js (New) 130 bytes 130 bytes 100.0% 🚀
assets/add-scalar-classes-BsJTICVr.js (Deleted) -2.17MB 0 bytes -100.0% 🗑️
assets/tanstack-vendor-BVe1POcw.js (Deleted) -740.2kB 0 bytes -100.0% 🗑️
assets/docs.fumadocs-spike-api-reference-CKXrmw_X.js (Deleted) -442.92kB 0 bytes -100.0% 🗑️
assets/AgentScalarChatInterface.vue-AWCX2gFS.js (Deleted) -201.71kB 0 bytes -100.0% 🗑️
assets/modal-Brv4hO9A.js (Deleted) -184.38kB 0 bytes -100.0% 🗑️
assets/client-0bNtF57C.js (Deleted) -146.06kB 0 bytes -100.0% 🗑️
assets/maintainer-panel-CAL5OvDf.js (Deleted) -78.99kB 0 bytes -100.0% 🗑️
assets/ui-vendor-B7yueYW8.js (Deleted) -57.04kB 0 bytes -100.0% 🗑️
assets/backtest-calibration-h2RVymvg.js (Deleted) -37.33kB 0 bytes -100.0% 🗑️
assets/routes-CQ4IxHyD.js (Deleted) -34.98kB 0 bytes -100.0% 🗑️
assets/owner-panel-Do0sUXrG.js (Deleted) -27.36kB 0 bytes -100.0% 🗑️
assets/app-J5sQ8YWc.js (Deleted) -25.7kB 0 bytes -100.0% 🗑️
assets/app.runs-BD1dAPqq.js (Deleted) -23.56kB 0 bytes -100.0% 🗑️
assets/miner-panel-CLjvRMPP.js (Deleted) -20.28kB 0 bytes -100.0% 🗑️
assets/api._op-BR9dbW9W.js (Deleted) -17.57kB 0 bytes -100.0% 🗑️
assets/self-hosting-docs-audit-BCC-ww7q.js (Deleted) -16.61kB 0 bytes -100.0% 🗑️
assets/app.index-DDY9jf1u.js (Deleted) -15.62kB 0 bytes -100.0% 🗑️
assets/docs._slug-DVNP8Xth.js (Deleted) -15.37kB 0 bytes -100.0% 🗑️
assets/playground-panel-BQrKPQl_.js (Deleted) -14.49kB 0 bytes -100.0% 🗑️
assets/fairness-DnGtCO9U.js (Deleted) -10.6kB 0 bytes -100.0% 🗑️
assets/app.audit-DlT9W5qV.js (Deleted) -10.11kB 0 bytes -100.0% 🗑️
assets/app.config-generator-CpI-NEn0.js (Deleted) -10.09kB 0 bytes -100.0% 🗑️
assets/extension-6dsaMKat.js (Deleted) -10.04kB 0 bytes -100.0% 🗑️
assets/maintainers-Df7ezH8r.js (Deleted) -8.09kB 0 bytes -100.0% 🗑️
assets/miners-9DlefBzs.js (Deleted) -7.91kB 0 bytes -100.0% 🗑️
assets/agents-DcDm9LHU.js (Deleted) -7.8kB 0 bytes -100.0% 🗑️
assets/commands-panel-D6m5GM-_.js (Deleted) -6.65kB 0 bytes -100.0% 🗑️
assets/maintainer-workflow-CtIMUJth.js (Deleted) -6.52kB 0 bytes -100.0% 🗑️
assets/roadmap-D6vUxolW.js (Deleted) -6.33kB 0 bytes -100.0% 🗑️
assets/digest-panel-cntDl-Wn.js (Deleted) -6.18kB 0 bytes -100.0% 🗑️
assets/repos._owner._repo.quality-ByBdrbaF.js (Deleted) -6.14kB 0 bytes -100.0% 🗑️
assets/docs.index-CoX-t_rW.js (Deleted) -5.79kB 0 bytes -100.0% 🗑️
assets/docs-nav-DEQ5Eqq6.js (Deleted) -5.59kB 0 bytes -100.0% 🗑️
assets/api.index-IhvpIJjX.js (Deleted) -4.7kB 0 bytes -100.0% 🗑️
assets/docs-5c5XKUdE.js (Deleted) -2.7kB 0 bytes -100.0% 🗑️
assets/api-Crg9A-1y.js (Deleted) -2.69kB 0 bytes -100.0% 🗑️
assets/docs-page-DDbbA5My.js (Deleted) -2.1kB 0 bytes -100.0% 🗑️
assets/table-Bc0ieidC.js (Deleted) -1.75kB 0 bytes -100.0% 🗑️
assets/app.workbench-E3WFqcQG.js (Deleted) -1.58kB 0 bytes -100.0% 🗑️
assets/session-BY98JhIb.js (Deleted) -1.45kB 0 bytes -100.0% 🗑️
assets/tooltip-B0BnDKa7.js (Deleted) -1.45kB 0 bytes -100.0% 🗑️
assets/tabs-DQmEOwr7.js (Deleted) -1.39kB 0 bytes -100.0% 🗑️
assets/app.repos-B9FNQRxk.js (Deleted) -1.07kB 0 bytes -100.0% 🗑️
assets/input-CQSjwPGM.js (Deleted) -796 bytes 0 bytes -100.0% 🗑️
assets/file-cog-D5dP8kJW.js (Deleted) -758 bytes 0 bytes -100.0% 🗑️
assets/app.maintainer-DKFiR_m0.js (Deleted) -502 bytes 0 bytes -100.0% 🗑️
assets/sparkles-DFyYmoOI.js (Deleted) -494 bytes 0 bytes -100.0% 🗑️
assets/app.owner-BNwKnBaP.js (Deleted) -474 bytes 0 bytes -100.0% 🗑️
assets/app.commands-84N41wct.js (Deleted) -455 bytes 0 bytes -100.0% 🗑️
assets/app.playground-BBZRG7LY.js (Deleted) -442 bytes 0 bytes -100.0% 🗑️
assets/reveal-DFWjBRz6.js (Deleted) -442 bytes 0 bytes -100.0% 🗑️
assets/index-DVJ6kKSS.js (Deleted) -438 bytes 0 bytes -100.0% 🗑️
assets/app.digest-CsMrPJcL.js (Deleted) -430 bytes 0 bytes -100.0% 🗑️
assets/eye-off-Dp_DmeoX.js (Deleted) -430 bytes 0 bytes -100.0% 🗑️
assets/app.miner-BOas9UUV.js (Deleted) -422 bytes 0 bytes -100.0% 🗑️
assets/key-round-BK1WDFms.js (Deleted) -355 bytes 0 bytes -100.0% 🗑️
assets/bot-Bhxzt91C.js (Deleted) -328 bytes 0 bytes -100.0% 🗑️
assets/trash-2-CwggLPiz.js (Deleted) -328 bytes 0 bytes -100.0% 🗑️
assets/save-9SWapsQh.js (Deleted) -327 bytes 0 bytes -100.0% 🗑️
assets/git-pull-request-arrow-Btbb6kqc.js (Deleted) -321 bytes 0 bytes -100.0% 🗑️
assets/wrench-D1pQ5bgw.js (Deleted) -303 bytes 0 bytes -100.0% 🗑️
assets/list-checks-CMda3nW4.js (Deleted) -279 bytes 0 bytes -100.0% 🗑️
assets/shield-ZGxNQT8e.js (Deleted) -272 bytes 0 bytes -100.0% 🗑️
assets/workflow-ge8KHNQC.js (Deleted) -265 bytes 0 bytes -100.0% 🗑️
assets/compass-CDFDLGsY.js (Deleted) -251 bytes 0 bytes -100.0% 🗑️
assets/history-DGr8OiOc.js (Deleted) -237 bytes 0 bytes -100.0% 🗑️
assets/activity-D7mqqVFT.js (Deleted) -234 bytes 0 bytes -100.0% 🗑️
assets/message-square-rFm_MiV7.js (Deleted) -233 bytes 0 bytes -100.0% 🗑️
assets/lock-CBwkiukE.js (Deleted) -206 bytes 0 bytes -100.0% 🗑️
assets/rotate-cw-Dfj5dm5B.js (Deleted) -201 bytes 0 bytes -100.0% 🗑️
assets/play-CSdj5v19.js (Deleted) -190 bytes 0 bytes -100.0% 🗑️
assets/circle-check-1qnm7PVr.js (Deleted) -178 bytes 0 bytes -100.0% 🗑️
assets/search-BlRZP3Vt.js (Deleted) -174 bytes 0 bytes -100.0% 🗑️
assets/circle-BiX0qJ2S.js (Deleted) -130 bytes 0 bytes -100.0% 🗑️

@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.16%. Comparing base (590befd) to head (7d81d1a).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8271   +/-   ##
=======================================
  Coverage   92.16%   92.16%           
=======================================
  Files         786      786           
  Lines       78941    78943    +2     
  Branches    23840    23840           
=======================================
+ Hits        72757    72759    +2     
  Misses       5062     5062           
  Partials     1122     1122           
Flag Coverage Δ
shard-1 57.83% <100.00%> (+1.12%) ⬆️
shard-2 49.88% <50.00%> (-0.30%) ⬇️
shard-3 52.97% <50.00%> (-2.21%) ⬇️

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

Files with missing lines Coverage Δ
src/services/ai-review.ts 96.88% <100.00%> (+<0.01%) ⬆️

@JSONbored
JSONbored merged commit 1f15694 into main Jul 23, 2026
21 checks passed
@JSONbored
JSONbored deleted the feat/counterfactual-replay-harness branch July 23, 2026 22:00
JSONbored added a commit that referenced this pull request Jul 23, 2026
orb-v3.3.0 shipped stable, so the beta cutter is idle until the manifest's
declared target moves forward. The calibration-expansion epic's merges since
(per-repo loosening #8264, reviewer votes #8265, tightening #8267, AMS loop
#8270, counterfactual replay #8271) are feats — the inferred bump is minor,
so the next automated snapshot targets orb-v3.4.0-beta.1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant