Skip to content
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
2d746ac
[jwbron/live-eval-corpus] review: live-enabled corpus format and ten …
jwbron Jul 9, 2026
6727eb6
[jwbron/live-eval-producer-staging] review: live-producer prompt extr…
jwbron Jul 9, 2026
5c00cf3
[jwbron/live-eval-producer-staging] review: the live producer and SDK…
jwbron Jul 9, 2026
52073ef
[jwbron/live-eval-ab-runner] review: the live A/B runner (phase 3)
jwbron Jul 9, 2026
93770e6
[jwbron/live-eval-ab-ci] review: per-PR live A/B workflow (phase 4)
jwbron Jul 9, 2026
30e7527
[jwbron/live-eval-corpus] review: exclude eval-corpus trees from lint…
jwbron Jul 9, 2026
19f06cb
[jwbron/live-eval-producer-staging] Merge branch 'jwbron/live-eval-co…
jwbron Jul 9, 2026
d1b5288
[jwbron/live-eval-ab-runner] Merge branch 'jwbron/live-eval-producer-…
jwbron Jul 9, 2026
254dfc4
[jwbron/live-eval-ab-ci] Merge branch 'jwbron/live-eval-ab-runner' in…
jwbron Jul 9, 2026
917cc11
[jwbron/live-eval-producer-staging] review: namespace live finding id…
jwbron Jul 9, 2026
0ee295a
[jwbron/live-eval-ab-runner] Merge branch 'jwbron/live-eval-producer-…
jwbron Jul 9, 2026
58cd4ed
[jwbron/live-eval-ab-runner] review: judge failures degrade the A/B r…
jwbron Jul 9, 2026
b19b08d
[jwbron/live-eval-ab-ci] Merge branch 'jwbron/live-eval-ab-runner' in…
jwbron Jul 9, 2026
da1115c
[tmp-refresh] Merge remote-tracking branch 'origin/main' into tmp-ref…
jwbron Jul 9, 2026
a6883be
[tmp-refresh] Merge remote-tracking branch 'origin/jwbron/live-eval-c…
jwbron Jul 9, 2026
0d02672
[tmp-refresh] Merge remote-tracking branch 'origin/jwbron/live-eval-p…
jwbron Jul 9, 2026
93d8dec
[tmp-refresh] Merge remote-tracking branch 'origin/jwbron/live-eval-a…
jwbron Jul 9, 2026
2812679
[jwbron/live-eval-corpus] review: route the specialist lens on each l…
jwbron Jul 9, 2026
2ce35a0
[jwbron/live-eval-producer-staging] Merge branch 'jwbron/live-eval-co…
jwbron Jul 9, 2026
c0fece2
[jwbron/live-eval-ab-runner] Merge branch 'jwbron/live-eval-producer-…
jwbron Jul 9, 2026
e02ac40
[jwbron/live-eval-ab-runner] review: carry agent-failure reasons into…
jwbron Jul 9, 2026
d225bd4
[jwbron/live-eval-ab-ci] Merge branch 'jwbron/live-eval-ab-runner' in…
jwbron Jul 9, 2026
cbc838d
[jwbron/live-eval-ab-runner] review: close every A/B report with a pe…
jwbron Jul 9, 2026
63097f1
[jwbron/live-eval-corpus] Merge remote-tracking branch 'origin/jwbron…
jwbron Jul 9, 2026
9012508
[jwbron/live-eval-producer-staging] Merge remote-tracking branch 'ori…
jwbron Jul 9, 2026
25133b4
[jwbron/live-eval-producer-staging] Merge branch 'jwbron/live-eval-co…
jwbron Jul 9, 2026
0a3d212
[jwbron/live-eval-ab-runner] Merge remote-tracking branch 'origin/jwb…
jwbron Jul 9, 2026
a547972
[jwbron/live-eval-ab-runner] Merge branch 'jwbron/live-eval-producer-…
jwbron Jul 9, 2026
391151b
[jwbron/live-eval-ab-ci] Merge remote-tracking branch 'origin/jwbron/…
jwbron Jul 9, 2026
d2c4c70
[jwbron/live-eval-ab-ci] Merge branch 'jwbron/live-eval-ab-runner' in…
jwbron Jul 9, 2026
996766f
[jwbron/live-eval-ab-runner] review: identity short-circuit, gate-fli…
jwbron Jul 10, 2026
fb81be8
[jwbron/live-eval-ab-runner] review: judge economics (Haiku pin, retr…
jwbron Jul 10, 2026
a659be8
[jwbron/live-eval-ab-ci] review: document why the baseline is the bas…
jwbron Jul 10, 2026
b7c3786
[jwbron/live-eval-ab-ci] Merge branch 'jwbron/live-eval-ab-runner' in…
jwbron Jul 10, 2026
193ae69
[jwbron/live-eval-ab-runner] review: type the judge response via the …
jwbron Jul 10, 2026
7a2065c
[jwbron/live-eval-ab-ci] Merge branch 'jwbron/live-eval-ab-runner' in…
jwbron Jul 10, 2026
80da666
Merge branch 'main' into jwbron/live-eval-corpus
jwbron Jul 10, 2026
82bc5ed
Merge branch 'jwbron/live-eval-corpus' into jwbron/live-eval-producer…
jwbron Jul 10, 2026
7f2fc3a
Merge branch 'jwbron/live-eval-producer-staging' into jwbron/live-eva…
jwbron Jul 10, 2026
9cc1a89
Merge branch 'jwbron/live-eval-ab-runner' into jwbron/live-eval-ab-ci
jwbron Jul 10, 2026
205d7c7
[landtmp] Merge remote-tracking branch 'origin/main' into landtmp
jwbron Jul 10, 2026
6328aa7
review: add the review-trial skill (live A/B phase 5) (#238)
jwbron Jul 10, 2026
9baccb7
[landtmp] Merge remote-tracking branch 'origin/main' into landtmp
jwbron Jul 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/review-live-ab-ci.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"review": patch
---

CI wiring for the live A/B (live A/B plan, phase 4): the `Review Eval A/B` workflow runs on every non-draft PR touching `workflows/review/**` (plus `workflow_dispatch`), executing the arm-to-arm live eval against the PR's merge-base and posting the delta report as a sticky PR comment, a job summary, and an artifact. Per-PR runs cover the smoke-tagged live subset; a `full-eval` label (or the dispatch input) lifts that to every live case, a `skip-live-eval` label opts out, the changeset release branch is excluded, secretless runs (forks) skip green, and a new push cancels a superseded run. The job fails only when the runner's adversarial hard gate fails on the candidate arm. The runner gains `--smoke-only` and writes a markdown sibling of the JSON report for the comment step.
5 changes: 5 additions & 0 deletions .changeset/review-live-ab-runner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"review": minor
---

The live A/B runner (live A/B plan, phase 3). `eval/live-match.ts` maps a run's posted candidates onto a live case's labeled defect specs (deterministic path/window/mechanism rule first, then an injected hard-capped fallback arbiter whose matches are recorded for audit) and aggregates live metrics: must-catch recall, verdict agreement, clean false-flag, and noise. `eval/live-ab.ts` runs the model sub-agents from two review.md versions (the merge-base baseline via `git show`, the working-tree candidate) over the same live corpus, each arm under half a hard USD budget with sticky stop-and-report-skips semantics, replays each live result through the deterministic pipeline (`runner.ts` gains a `validation` override on `RunOptions` so a live validator's output replaces the recorded block), diffs spec-level regressions over the cases both arms scored, judges both arms' comments with the pinned judge (quality aggregates only; extracted to `eval/judge-live-model.ts`, now shared with `live-judge.ts`), and emits a JSON report plus a markdown table (also appended to GITHUB_STEP_SUMMARY). Report-only except the playbook's standing rule: the candidate arm failing any adversarial-injection case exits non-zero.
5 changes: 5 additions & 0 deletions .changeset/review-live-corpus-format.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"review": minor
---

Live-enabled corpus cases (live A/B eval plan, phase 1). The eval corpus gains an opt-in `live` block carrying what a REAL model run needs and the deterministic replay does not: the PR context (`prContext`, with the description treated as untrusted author text), a post-change file tree on disk next to the case (`<id>/case.json` + `<id>/tree/`, coexisting with the flat `<id>.json` layout), and labeled defect specs (`mustCatchSpecs` / `mustNotFlagSpecs`: path, line window, mechanism keyword alternates) so a live run's model-chosen finding ids can be matched to ground truth. A live case must carry the `live` tag, a cleanly-parseable diff, and every non-removed changed file in its tree; the loader enforces all of it and `loadLiveCorpus()` returns the subset. Ten cases are converted with hand-authored real diffs and trees (five smoke incidents, both clean cases, one adversarial injection whose payload lives in the diff, one golden holdout, one synthetic mutation); their recorded line anchors now point at the authored defect lines, and the deterministic suite runs them unchanged, provenance gate included.
5 changes: 5 additions & 0 deletions .changeset/review-live-producer-staging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"review": minor
---

The live producer (live A/B plan, phase 2): everything needed to run the REAL model sub-agents over a live-enabled corpus case. `eval/agent-extract.ts` parses `review.md`'s `## agent:` sections into name/description/model/prompt as pure data (string in, no fs), so an A/B can extract the baseline arm from a `git show` of the merge-base; parsing is strict and lists every malformed section at once, and an integration test runs it over the real `review.md`. `eval/live-stage.ts` materializes the production `/tmp/gh-aw/review/` staging layout for a case (pr-context.json, full/pr/full-stripped diffs, files.json with hasPatch, review-files.json, provenance.json, routing.json, out/, and the post-change checkout) and rewrites extracted prompts to point at it. `eval/live-producer.ts` dispatches the default finders plus the router's lenses through an injected runner seam, maps all three output contracts (label-shape reviewers, structured-schema lenses, the claim-validator's three-state verdicts) into the exact `RecordedFinding`/`CaseVerification` shapes the deterministic runner consumes, stages `claims.json`, resolves `{{#runtime-import}}` directives from the case tree, retries once on malformed output, keeps partial results on agent failure, and accounts per-agent cost. `eval/live-runner.ts` is the one SDK-backed runner (Claude Agent SDK; Read/Grep/Glob only, cwd pinned to the staged checkout, hard turn and wall-clock caps) plus a CLI smoke entry (`pnpm dlx tsx workflows/review/eval/live-runner.ts --case <id>`, requires ANTHROPIC_API_KEY).
9 changes: 8 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ module.exports = {
sourceType: "module",
ecmaVersion: 2022,
},
ignorePatterns: ["**/dist/", "actions/**/index.js"],
ignorePatterns: [
"**/dist/",
"actions/**/index.js",
// Live eval-corpus trees are byte-exact fixtures paired with each
// case's diff: linting (and especially prettier auto-formatting)
// would desync them from the diff the provenance gate parses.
"workflows/review/eval/corpus/**/tree/",
],
overrides: [
{
files: "**/*.ts",
Expand Down
133 changes: 133 additions & 0 deletions .github/workflows/review-eval-ab.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Review live A/B — real-model arm-to-arm evals for review-bot changes.
#
# A PR touching workflows/review/** runs the model sub-agents from BOTH the
# base branch's review.md (baseline) and the PR's review.md (candidate) over
# the live-enabled corpus subset, then posts the delta report (five live
# metrics, judge quality, cost, regressions) as a sticky PR comment and job
# summary. See workflows/review/eval/live-ab-plan.md for the full design.
#
# Why the base TIP and not the merge-base: on pull_request events the
# checkout is the PR merge commit, so the candidate tree already contains the
# base tip. Baselining on the same tip means the two arms differ only by the
# PR's own review.md changes; a merge-base baseline would fold any upstream
# review.md movement into the PR's measured delta.
#
# Report-only, with one exception (the playbook's standing rule): the runner
# exits non-zero when the candidate arm mishandles an adversarial-injection
# case, which fails this job.
#
# Cost control: per-PR runs cover only the live cases also tagged `smoke`;
# a `full-eval` label lifts that to every live case. The runner enforces a
# hard USD ceiling per arm and reports skipped cases rather than dying at the
# cap. A new push cancels a superseded run (concurrency below). A
# `skip-live-eval` label skips the job entirely.
#
# NOTE: this workflow's name must stay distinct from any gh-aw workflow a
# consumer runs (same-named workflows share a gh-aw concurrency group per PR
# and cancel each other; see the round-two doc's operational floor).

name: Review Eval A/B

on:
pull_request:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So it seems like we're running this once per PR here in this repo? (maybe twice if we start as a draft?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Slightly more than that: it runs on every push to a non-draft PR touching workflows/review/**, with cancel-in-progress superseding a stale run on a new push. Drafts skip entirely until ready_for_review, so starting as a draft does not add a run. Each run is the smoke subset (7 live cases per arm), measured at ~$7.70 and ~26 minutes in the acceptance runs; skip-live-eval opts a PR out, full-eval widens to the whole live corpus, and the runner enforces a hard USD ceiling either way. If per-push proves too spendy we can gate on a label instead, but per-push is what makes it a tripwire between a prompt edit and production.

types: [opened, synchronize, reopened, ready_for_review]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion (non-blocking): types has no labeled/unlabeled, so the full-eval and skip-live-eval labels only take effect on the next push, not when the label is added. If immediate effect is intended, add those event types and gate the job to only proceed on them when github.event.label.name is one of the two eval labels (otherwise every unrelated label re-runs a paid eval). Otherwise, documenting "labels apply on the next push" sets the right expectation.

paths:
- "workflows/review/**"
workflow_dispatch:
inputs:
base_ref:
description: "Baseline ref for review.md (default: the runner's merge-base fallback; PR runs pass the base-branch tip)"
required: false
max_usd:
description: "Total hard budget across both arms"
required: false
default: "40"
full:
description: "Run every live case (not just the smoke subset)"
type: boolean
required: false
default: false

permissions:
contents: read
pull-requests: write

concurrency:
group: review-eval-ab-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
live-ab:
name: Live A/B over the eval corpus
runs-on: ubuntu-latest
# Drafts wait until ready; the changeset release PR matches the path
# filter (it bumps workflows/review/package.json) but changes no
# behavior; skip-live-eval opts a PR out.
if: >-
github.event_name == 'workflow_dispatch' ||
(github.event.pull_request.draft == false &&
github.head_ref != 'changeset-release/main' &&
!contains(github.event.pull_request.labels.*.name, 'skip-live-eval'))
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
# The baseline arm reads review.md from the base ref via
# `git show`, so the full history is needed.
fetch-depth: 0
- uses: ./actions/shared-node-cache
- name: Run the live A/B
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
# The tip of the PR's base branch (see the header comment for why
# tip, not merge-base). workflow_dispatch may override it.
BASE_REF: ${{ inputs.base_ref || format('origin/{0}', github.base_ref || 'main') }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion (non-blocking): BASE_REF=origin/<base> is resolved at fetch time, not when the PR merge commit was created, so it can drift from the base tip the candidate tree actually contains if the base branch moves before this job fetches — the upstream-movement bias the header says the design avoids. On pull_request events, HEAD^1 (the merge commit's base parent) is the race-free tip. A minor edge case, but the header's rationale rests on it. (Also: the PR description says "against the PR's merge-base", which reads as contradicting the header's deliberate tip-not-merge-base choice.)

MAX_USD: ${{ inputs.max_usd || '40' }}
FULL_EVAL: ${{ inputs.full == true || contains(github.event.pull_request.labels.*.name, 'full-eval') }}
run: |
if [ -z "$ANTHROPIC_API_KEY" ]; then
echo "ANTHROPIC_API_KEY secret not configured; skipping the live A/B." >&2
exit 0
fi
SCOPE="--smoke-only"
if [ "$FULL_EVAL" = "true" ]; then
SCOPE=""
fi
pnpm dlx tsx workflows/review/eval/live-ab.ts \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thought (non-blocking): The header and PR description say the job fails only when the adversarial gate trips, but the runner also exits non-zero from its top-level catch and the "no case scored on the candidate arm" path (live-ab.ts:708-710, 720-723). A transient Anthropic API outage, git failure, or budget exhaustion before any case scores would red this check on a PR whose change is fine. Consider distinguishing the adversarial-gate exit from infra errors, or documenting the caveat.

--base-ref "$BASE_REF" --max-usd "$MAX_USD" $SCOPE
- name: Upload the report artifact
# always(): a partial or gate-failing run still uploads what it wrote.
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: live-ab-report
path: out/live-ab-report.*
if-no-files-found: ignore
- name: Post the sticky PR comment
if: always() && github.event_name == 'pull_request'
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion (non-blocking): The other hand-authored workflows pin github-script to v8 (node-ci.yml:59, release.yml:16, SHA ed597411...); this step uses v7 (60a0d83...). Aligning avoids running an older major and a third distinct version of the same action.

Suggested change
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8

with:
script: |
const fs = require("fs");
const path = "out/live-ab-report.md";
if (!fs.existsSync(path)) {
core.info("no report markdown; nothing to post");
return;
}
const marker = "<!-- review-eval-ab -->";
const body = `${marker}\n${fs.readFileSync(path, "utf8")}`;
const {owner, repo} = context.repo;
const issue_number = context.payload.pull_request.number;
const comments = await github.paginate(
github.rest.issues.listComments,
{owner, repo, issue_number, per_page: 100},
);
const prior = comments.find((c) => c.body?.startsWith(marker));
if (prior) {
await github.rest.issues.updateComment({
owner, repo, comment_id: prior.id, body,
});
} else {
await github.rest.issues.createComment({
owner, repo, issue_number, body,
});
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"build": "tsc -p actions/tsconfig.json"
},
"devDependencies": {
"@anthropic-ai/claude-agent-sdk": "^0.3.205",
"@changesets/cli": "^2.29.8",
"@khanacademy/eslint-config": "^0.1.0",
"@swc-node/register": "^1.11.1",
Expand Down
Loading
Loading