Skip to content

review: merge main into the Pi harness branch and A/B the reviewers on gemini 3.8 flash - #406

Closed
jwbron wants to merge 42 commits into
mainfrom
agent/review-pi-gemini-eval
Closed

jwbron wants to merge 42 commits into
mainfrom
agent/review-pi-gemini-eval

Conversation

@jwbron

@jwbron jwbron commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

What

This revives #305's branch as a measurement vehicle: main is merged in, and every sub-agent model: pin flips to gemini-3.8-flash so the live A/B measures that model against main's claude baseline on the same Pi harness. Gemini 3.8 flash shipped yesterday (2026-09-02) with reported opus-parity coding benchmarks at flash pricing ($0.75/$3.75 per MTok intro), which makes it the obvious first cross-provider A/B for the reviewer. This is a measurement state, not a production pin decision: the engine pin, the prose judge, and the eval's judge/arbiter stay on claude, and production gemini traffic is deliberately not wired (the awf api-proxy meters anthropic only).

The merge

Main moved 81 commits since the branch forked, and two of them landed inside code this branch deletes or restructures. The resolution ports them onto the Pi harness:

  • The prose judge (review: a prose judge on every posted finding #362): judge-prose-runner.ts is rebuilt on pi-ai (one completion call, no tools, pinned judge model, fail-open construction), since the Claude Agent SDK it ran on leaves the dependency tree with this branch. The submit_result tool awaits the prose gate after the contract check, exactly like the SDK runner did.
  • The salvage and metering hardening (review: real metering on salvage paths; gate lastText on a delivered result record #377): the runner holds the last contract-valid payload as provisional while the prose gate bounces it, and every salvage path returns captured ?? provisional, so a style bounce can cost prose quality but never a dimension. The SDK's Stop hook becomes Pi's follow-up seam: an agent that ends its turn without an accepted submission gets pointed back at submit_result, at most twice, with the reason branching on whether the tool was ever called.

The runner also split along its seams to hold the lint file-size cap: dispatch-models.ts (pin routing), dispatch-exec.ts (the sandboxed subprocess seam), and dispatch-tools-pi.ts (the tool surface), all re-exported from dispatch-runner-pi.ts so importers are unchanged.

The gemini setup

  • Pins route by provider (dispatch-models.ts): gemini-* pins resolve against Pi's google catalog, everything else stays anthropic, and an unknown pin still throws with the candidates listed.
  • pi-ai 0.83.0's catalog predates gemini-3.8-flash, so the runner registers the google provider with one local catalog entry at the launch intro pricing. A future pi-ai bump's own entry supersedes it by id, so the shim retires itself.
  • The eval workflow passes GEMINI_API_KEY beside ANTHROPIC_API_KEY and skips the live phases loudly when it's missing. The repo needs that secret configured before the A/B can spend.

Turns out the ANTHROPIC_BASE_URL steer on this branch was also broken: createProvider({...provider, baseUrl}) throws in pi-ai 0.83.0 (createProvider wants the provider's input shape, which the built provider doesn't re-expose), and only unsteered environments ever ran that path. The steer now rewrites each catalog model's own baseUrl, the field the API layer actually reads, so let's just fix it here where the provider registration already changed.

Checks

Full deterministic suite (2245 tests), lint, and tsc --noEmit green locally. The per-PR A/B runs the smoke subset on this PR; the full-eval label or a dispatch lifts it to the full corpus for the powered read.

KORE-2631

James Wiesebron and others added 21 commits July 31, 2026 14:19
…ess behind the runner seam

Rebuilt directly on main. The visibility and refusal-fallback work this branch
used to carry landed separately via #315, so replaying it would have conflicted
with itself; what remains here is the harness alone.

Scripted dispatch gains a second AgentRunner implementation
(lib/dispatch-runner-pi.ts) built on Pi's multi-provider libraries, selected by
REVIEW_DISPATCH_RUNNER=pi. The Claude Agent SDK runner stays the default and
the production path; no model pin moves, the orchestrator engine is untouched,
and dispatch.ts imports neither runner directly (the CLI entry loads one
lazily). With the env var unset, behavior is unchanged.

A harness switch, not a model switch: both runners honor the same per-role
model: pins, so pi-vs-sdk on an unchanged review.md isolates the loop. Pi's
libraries are multi-provider, so once the harness is anchored, moving a role
off Anthropic becomes a pin change rather than a second bespoke agent loop.

live-ab.ts also gets PER-ARM runners. It previously built one and used it for
both arms, which is right when the variable is review.md but made
REVIEW_DISPATCH_RUNNER put both arms on the same harness — four earlier runs
reported as sdk-vs-pi were in fact pi-vs-pi. The baseline is now always
sdkRunner (the reference the corpus was measured on); the candidate takes the
selected harness.
…ary, and fix two selection-seam smells

Addresses the blocking item plus three non-blocking ones from the re-review.

Blocking: allowedTools shipped untested. It is the boundary on what a Pi
sub-agent can touch, and it rests on a stronger guarantee than an allowlist:
an unregistered tool cannot be called, because Pi has no permission layer to
fall back on. Three tests now cover it: a restricted surface excludes Bash and
LS, an omitted option grants the full five, and submit_result survives
restriction (the contract channel is not an investigation tool, so restricting
the toolbox must not cost the agent its only way to deliver a result).

Also fixed:

- The refused flag keyed only off rawStopReason while both sibling runners key
  off the normalized stopReason, and this file's own refusal fixture sets only
  stopReason, under which refused was false. Either field now trips it, so a
  refusal reaches dispatch.ts's fallback whichever field the provider fills.
- selectedRunner silently mapped any non-pi value to the SDK runner, so a typo
  would run the SDK arm while the operator believed they were measuring Pi. It
  now throws like dispatch.ts does: the arm under test swapping invisibly is
  the worst failure this seam has.
- The selection seam itself was untested; live-runner.test.ts covers the
  default, both known values, and the throw.

Documented, not fixed, two tool-surface parity gaps the review found. Pi's Glob
uses find -path, whose star crosses a slash, giving a WIDER file set than the
SDK arm; Pi's Read has no offset/limit windowing, giving a NARROWER view of
large files. Both change what a Pi arm can see relative to the SDK arm, so they
are called out at the tool definitions for anyone reading an A/B result.
…rness; the Pi runner is the only dispatcher

The re-anchoring A/B (run 30666183461, two full-corpus repeats, identical
pins, byte-identical review.md) showed arm-to-arm quality parity with the
Pi loop at roughly half the cost and 60% of the wall clock, so the SDK
harness earns its deletion:

- lib/dispatch-runner.ts and its test are gone; dispatch.ts's CLI entry
  loads the Pi runner unconditionally.
- The REVIEW_DISPATCH_RUNNER seam is gone with it. A leftover setting
  fails loudly (rejectStaleRunnerSelection) rather than silently running
  a different harness than the operator believes.
- The eval takes the same single harness: live-runner.ts keeps only
  piRunner (pinned to the eval's Read/Grep/Glob surface), live-ab.ts runs
  both arms through one shared runner, rereview-sweep follows, and the
  A/B workflow drops its dispatch_runner input.
- @anthropic-ai/claude-agent-sdk and zod leave both dependency trees.

No model pin changes; pins resolve through Pi's Anthropic catalog as
before. The SDK-era corpus numbers do not transfer; run 30666183461 is
the anchor for Pi-harness numbers.
…cess inside an srt OS sandbox

The tools' execution moves behind an injected ToolExec seam, and the
production executor wraps each argv with @anthropic-ai/sandbox-runtime
(the engine behind Claude Code's own sandbox: bubblewrap on Linux,
Seatbelt on macOS):

- Checkout read-only. 'Reviewers never get edit or write' was a
  tool-surface promise that Bash could bypass; now it is a mount-level
  boundary, and a prompt-injected reviewer cannot poison the checkout
  its siblings read or the staged routing.json/out/ downstream phases
  trust. The investigation-cap journal is the one writable staging
  path (the cap CLI needs the append), plus a scratch dir.
- Tool-level network deny-all. In production this stacks inside the
  awf firewall; in the eval, which runs on a bare runner VM with the
  real API key in its environment, it is the only network boundary the
  tools have. The A/B workflow installs bubblewrap+socat for it.
- Fail-closed. If the sandbox cannot initialize (bubblewrap missing,
  user namespaces blocked in a nested container), createPiRunner
  throws rather than silently running unsandboxed; REVIEW_SANDBOX=off
  is the explicit, logged escape hatch and restores exactly the
  pre-srt posture.

The wrap is covered both ways in unit tests (sandboxed exec quoting,
env forwarding, fail-closed init, the off switch); whether srt can
initialize inside the awf agent container is the integration point the
next CI smoke has to prove, same as the ANTHROPIC_BASE_URL assumption.
…leases only, never across tiers

resolveModelId's prefix fallback picked the LONGEST catalog id starting
with the pin, so a family pin like claude-sonnet-4 would resolve to
claude-sonnet-4-5-<date> (the longer id) over claude-sonnet-4-<date>,
silently running a different model tier than the pin claims; the
function's whole contract is that it never does that. The fallback now
accepts only the pin's own dated releases (pin-YYYYMMDD exactly) and
picks the latest date; anything else throws with the candidates.
…e the turn cap, build one Pi runner

Three behavior fixes from the #305 review, all in the harness swap's blind
spots.

Sub-agent turns had no retry budget. gh-aw pins ANTHROPIC_MAX_RETRIES=0 and
pi-ai does not read that env var at all: its Anthropic provider calls the SDK
with a hardcoded maxRetries: 0 and delegates to its own retryProviderRequest
helper, which also defaults to 0 unless the caller passes one. So a transient
429/529 on any turn ended the sub-agent, and dispatch.ts recorded the throw as
a failed dimension with no retry of its own: one overload shed a whole review
lens. The deleted SDK harness restored 2 for exactly this; the runner now
passes 2 through the stream options, where pi-ai actually reads it.

The turn cap was indistinguishable from a clean finish. Both returned a
free-text final with `structured` unset, so dispatch.ts read an out-of-turns
transcript as malformed output and spent its one re-dispatch correcting a JSON
shape that was never the problem. The cap path now reports
stopReason=max_turns, dispatch.ts threads stopReason and toolCalls into
PerAgentReport, and the corrective note tells an out-of-turns agent to
conclude from what it found instead of investigating further.

piRunner memoized the resolved runner rather than the promise, so the eval's
first concurrent wave (DEFAULT_CONCURRENCY=4) all observed undefined and each
constructed its own runner, initializing the srt sandbox four times over.

Also: the salvage path dropped every diagnostic it had (tool count, stop
reason, error detail), which is the one path where a session died mid-flight
and the cause is worth reporting.
…st, and stop pointing at the deleted SDK

The sandbox tests proved the wrap happens, that init fails closed, and that
REVIEW_SANDBOX=off bypasses, but nothing asserted what the policy actually
enforces: the mock forwarded SANDBOX_CONFIG to initialize and discarded it, so
adding the checkout to allowWrite or dropping deniedDomains: ['*'] would reopen
the boundary with every test still green. The config handed to srt is now
asserted literally.

New coverage for the fixes in the previous commit (max_turns, salvaged
diagnostics, the retry budget, one-runner-per-wave) plus the diagnostics-array
append into errorMessage, which the error-path test never reached.

live-ab-plan.md still told contributors to build the live eval runner on
@anthropic-ai/claude-agent-sdk, which this PR deletes; it now points at the Pi
runner, with the SDK named only as the pre-re-anchoring history. The changeset
also overstated the zod removal: the direct devDependency is gone, but zod
stays in both lockfiles transitively via pi-ai / sandbox-runtime / mcp-sdk.
…achinery out of dispatch.ts

Both dispatch.ts (1011) and dispatch.test.ts (1066) crossed eslint's
1000-line max-lines cap once the retry/refusal work landed, so Lints and
the push-test job are red on this branch. Main is already at 950/981, so
a disable comment would just move the wall one commit further out.

Split along the seam the file already has: dispatch-calls.ts owns calling
ONE agent (the model seam types, the per-agent report entry, the
usage-policy refusal fallback, and the single malformed-output retry) and
knows nothing about rosters, phases, gating, or note lines. runDispatch
owns the run and gets the two closures from createAgentDispatcher; the
moved code is byte-identical apart from perAgent.push becoming an
injected report callback. dispatch.ts re-exports the seam types, so
dispatch-runner-pi and its test import exactly what they did before.

The malformed-output/retry describe block moves to dispatch-retry.test.ts
alongside it, matching the sibling split of dispatch-gate-hardening and
dispatch-trial-followups. Also drops a section banner in dispatch.ts left
empty when loadAgents moved to dispatch-agents.

756/351/813/373 lines; 115 tests over the four files, same count as before.
…ace under srt, and fix what that proved broken

The A/B arms run the eval's three-tool surface (Read/Grep/Glob) because the
corpus was calibrated on it. Production runs Read/Grep/Glob/LS/Bash, with Bash
running the investigation-cap CLI, which is the one thing in the review that
must WRITE inside a sandbox built to deny writes. So nothing measured the
surface production actually runs, and #305 makes that surface live at merge.

New `sandbox-smoke` job in review-eval-ab, two phases split by determinism:

  Phase A, free and the hard gate: five boundary probes through
  `createToolExec()`, the same function the production runner calls (extracted
  here, not copied: a probe with its own sandbox setup would be testing a
  second policy). Read the checkout, write to the checkout, append to the cap
  journal via the REAL CLI as the prompts invoke it, write to the scratch dir,
  open a TCP connection. An empty probe set fails; a probe that cannot be
  evaluated fails.

  Phase B, one live case on the production surface: asserts the loop reaches
  Bash at all (`PiRunnerOptions.onToolCall`, since `toolCalls` cannot tell a
  Bash call from a Read). Journal growth is reported, not gated: whether a
  reviewer opens a budget request is the model's call. Drafts run probes only,
  so the paid phase lands on ready PRs and dispatches.

Phase A immediately failed on the cap journal, locally, against real
bubblewrap: `npx -y tsx workflows/review/lib/investigation-cap.ts` cannot run
with the network denied (`403 Forbidden - GET registry.npmjs.org/tsx`).
Probes ruled out the near fixes: `npx --offline` fails ENOTCACHED even with a
warmed cache, and tsx itself cannot start in the sandbox at all -- it opens a
unix socket and bubblewrap answers EPERM, including inside the writable
scratch dir. Every cap request would have failed in production, and the
prompt's fallback for a denied budget is "stop investigating and report what
you have", so bounded investigation would have gone quietly inert.

The fix is `node`, on the node 24 the agent job already pins (review.lock.yml
495, 1554): native type stripping runs the .ts CLI with no runner to fetch.
Type stripping reparses the file as ESM, where `require.main === module` never
fires -- which would have turned every cap request into a silent no-op success
-- so the entry guard is argv-based (as live-runner.ts's is) and node:fs is a
static import. Two constraints follow and both are commented in place: the
file's imports stay type-only or node: builtins, and it runs under `node`,
never tsx. `--disable-warning=MODULE_TYPELESS_PACKAGE_JSON` keeps the
model's tool output to the decision line.

The prompt change lands in workflows/review/review.md only. The local
`.github/workflows/review.md` must match the pinned release outside LOCAL
OVERRIDE hunks (review-pins.test.ts), and this repo's own bot runs the pinned
lib, so prompt and lib move together at the next installed-reviewer bump --
which is the same bump that brings srt.

All five probes pass locally after the fix (journal 0 -> 1 through the real
CLI, checkout write refused EROFS, TCP denied ENETUNREACH). 1672 tests pass.
…g the Pi arm loses

The re-anchoring A/B lost incident-sql-missing-index:dm-default-backfill in
both repeats, and #305's merge turns on quality parity, so the plan makes
diagnosing it a merge precondition.

What the run 30666183461 artifact settles. No failed agents, no absent
agents, and droppedByProvenance / snappedByProvenance / droppedByScope /
droppedByValidation all empty in both arms: nothing mechanical dropped it.
Nor is it a matcher artifact -- the Pi arm's second finding is a different,
weaker observation both repeats (untyped-status suggestion; contract-change
note) where the baseline's is the seeded defect (every existing row defaults
to 'pending' and nothing ever writes another status, so the work queue never
drains). Pi: 2 candidates, $0.49, 8 correctness tool calls. Baseline: 4 and 3
candidates, $1.19, 5 tool calls. More investigation, fewer conclusions, 40%
of the spend. The data-migrations lens returned an empty findings list in both
Pi repeats after 9-11 tool calls.

Tools were like-for-like: the eval's own sdkRunner pinned the same
Read/Grep/Glob, so the production SDK harness's five-tool list never entered
the A/B. That leaves exactly two asymmetries at the A/B's sha (d62a33b): the
SDK arm passed no systemPrompt and so ran on Claude Code's full default
framing, and it had no submit_result tool, so its final was free-text JSON.
This runner supplies a terse five-line SYSTEM_PROMPT and a validated
structured-final tool, which is an invitation to stop once the object is
well-formed.

The probe runs the one case per configuration, varying exactly one of those:
as-is, completeness framing added, and submit_result off (a `validate`-less
request, which is already the runner's gate for that tool -- no runner change
needed). Deterministic matching only, no judge fallback, because the question
is whether the finding is there. SYSTEM_PROMPT is exported and
PiRunnerOptions grows a systemPrompt override for it; production sets neither.
Not wired into the A/B workflow: it answers one question and then it is done.
… is why no green srt run exists

The sandbox smoke's first CI run failed at initialization (run 30867013094):
"Sandbox dependencies not available: ripgrep (rg) not found". srt shells out
to rg on Linux to expand deny-path globs into concrete paths for bwrap, so it
is as mandatory as bubblewrap and socat, and the eval workflow installed only
those two. Both jobs now install all three.

This is also the answer to a standing question in the migration plan: the A/B
has produced no green measurement since the srt commit, and it could not
have. srt initialization is fail-closed, so every arm would have died before
the first case on a runner image that carries none of the three.

Local runs pass because a dev machine happens to have rg on PATH, which is
exactly why the boundary probes belong in CI rather than in a developer's
hands.
…nd stop a broken sandbox reading as green

Two things the smoke's second CI run (30867350588) showed. srt now initializes
with ripgrep installed, but every sandboxed command died with "bwrap:
loopback: Failed RTM_NEWADDR: Operation not permitted": Ubuntu 24.04 runners
restrict unprivileged user namespaces under AppArmor, and bwrap cannot
configure loopback in a netns it is not allowed to own. Both jobs now relax
that sysctl on the ephemeral runner, with before/after `bwrap --unshare-net`
probes printed so the log confirms the cause rather than leaving the fix as an
assertion. Production is a different environment and answers this separately.

And the probe set had a hole worth more than the fix: `write to the checkout`
scored "as expected" in that run, because the write never happened -- the
sandbox was not running. A denial by breakage is not a denial by policy.
Wrapper-failure signatures in a probe's evidence now fail it whatever it
expected, and render as SANDBOX BROKEN rather than a quiet pass. Without this,
the one configuration where the sandbox is entirely absent is also the
configuration where the deny-side probes look their best.
… deadline on both eval jobs

The probes went green in CI and the job hung anyway. Run 30867526519 printed
the full table and "Sandbox smoke passed." at 01:03:43, then held a runner
until it was cancelled 25 minutes later: srt's initialize starts a proxy
nothing shuts down, so the event loop never empties and the process outlives
its own verdict. A PASSED smoke that presents as a pending check is worse than
a failure, because the check never resolves either way.

Three guards, in order of directness:

  The script exits explicitly once stdout has drained. Draining matters and a
  bare process.exit would not do: Actions gives this process a pipe, pipe
  writes are asynchronous, and exiting over a buffered write truncates the last
  lines of the table the job exists to print. An unref'd 2s fallback covers a
  drain callback that never fires.

  Every probe runs under a 60s deadline. The runner's 120s subprocess timeout
  kills its direct child, but a sandboxed command is a process tree (bwrap,
  then a proxy, then the command) and a grandchild holding the pipes open
  leaves the executor's promise unresolved with nothing left to kill it. A
  probe that has not answered is inconclusive, and inconclusive fails.

  Both jobs get timeout-minutes (20 for the smoke, 180 for the A/B, whose
  full-eval run is ~75 minutes of real model work). This is the backstop for
  the next thing that holds the loop open, not the fix.

Also worth recording from that run's log, which the diagnostic step was added
to produce: the runner is Ubuntu 24.04.4 with
kernel.apparmor_restrict_unprivileged_userns = 1, "bwrap netns: FAILS before"
and "OK after". The AppArmor hypothesis was right, and it is now evidence in
the log rather than an assertion in a comment. All five probes pass on the
runner: read allowed, checkout write refused EROFS, cap journal 0 -> 1 through
the real CLI, scratch write landed, TCP denied ENETUNREACH.

Locally: 1.8s to verdict and exit, where before it never exited.
…tch-only CI path

The probe needs a real Anthropic key and there is none on the dev box (an
OAuth token is not one, and the cllm proxy serves non-Claude models via
OpenRouter, so it cannot carry the reviewer's Anthropic pins). The key already
lives in CI, which is also where every other eval dollar is spent, so the
probe runs there.

Dispatch only, off by default, and never on a PR: it is a diagnosis rather
than a check, and it costs ~$0.50 per config. It initializes srt like any
other job that dispatches sub-agents, so it installs the same three
dependencies and relaxes the same userns restriction.
…step, and print before scoring

Run 30872172052 dispatched all three configs, spent about $1.50 of model work,
and then died with `TypeError: posted is not iterable` in matchCase. My bug:
matchCase scores POSTED candidates, so it needs the deterministic runner's
RunResult, and I handed it produceLive's output instead. runCase is the missing
step, exactly as live-ab.ts wires it: it puts the produced findings through the
same provenance gate, scope filter, and verdict logic production uses.

The second change is the one that matters more. The probe now prints what the
models produced BEFORE it scores anything, because the failure mode above threw
away completed, paid-for output for a bug in the cheap step that came after it.
Expensive results get printed the moment they exist.
…e dispatch from running the eval

Two bugs found by reading tonight's runs rather than by testing.

**The A/B never exits.** Runs 30872172052, 30872187609 and 30877187141 each
scored all nine cases on both arms, wrote their report artifact, and were then
killed by the job timeout with the work already complete. Same cause as the
sandbox smoke's hang: srt's initialize starts a proxy nothing shuts down, so the
event loop never empties. This is why no A/B run has ever concluded green, and
it means the July re-anchoring run showing "cancelled" was the same thing rather
than an operator cancelling it. `live-ab.ts` and `harness-probe.ts` now exit
explicitly once stdout has drained, draining first because Actions gives the
process a pipe and exiting over a buffered write truncates the tail of the very
report the job exists to produce.

**A probe dispatch ran the whole eval.** `live-ab`'s condition starts with "any
workflow_dispatch", because that is how the eval is run by hand, so a dispatch
asking only for the harness probe started a full A/B beside it. Two probe
dispatches therefore spent about $18 nobody asked for. Both `live-ab` and
`sandbox-smoke` now exclude `inputs.harness_probe == true`, so a dispatch means
what it says.

The accidental runs did earn their money: three independent arm-pairs is what it
took to settle the lost finding as noise (see the plan doc), which two repeats
could not do.
…re hand-rolled

The docstring justified the hand-rolled tool surface with "the reviewers
need exactly these tools", which pi-coding-agent's createReadOnlyTools
answers. The load-bearing reason, verified against the SDK's 0.83.0 dist,
is that its tool layer cannot be uniformly sandboxed: grep spawns rg with
no interceptable seam, read is in-process fs.readFile, and only bash has a
spawnHook, so adopting the factories would leave Read/Grep running
unwrapped in the credentialed runner process. Raised by mojadem on #305.

Comment-only change.
…Grep/Bash, window Read, and align the eval to it

LS added nothing over sandboxed Bash; Glob's find -path emulation was
wrong, not just limited (* matched across /). Read gains offset/limit
windowing so large files stop being silently truncated at the output cap
with an unreachable tail. The eval's measured arms drop their
Read/Grep/Glob restriction and run the production surface unrestricted,
so the A/B measures what production ships by construction. Raised by
mojadem on #305; re-anchor A/B run to follow on this PR.
…ack (env scrub, Read errors, probe hygiene)

Review feedback on #305 (the blocking allowedTools test gap was already
closed at head):

- Sandboxed tool subprocesses no longer inherit the runner's
  credentials: makeSandboxedExec scrubs ANTHROPIC_API_KEY,
  GITHUB_TOKEN, GH_TOKEN, GITHUB_MCP_SERVER_TOKEN, and
  MCP_GATEWAY_API_KEY from the env srt returns. The sandbox is a
  mount/network boundary, not an env boundary. Test added.
- A failed Read is never windowed: cat's error text survives verbatim
  instead of being sliced into '(no lines in window...)'. Test added.
- The spawn-failure vs plain-non-zero-exit classification is pinned by
  a test (ENOENT resolves 'command failed: ...').
- 'Operation not permitted' removed from WRAPPER_FAILURES: EPERM text
  is what a WORKING sandbox emits on a policy denial, so matching it
  failed probes whose denial was the policy working.
- The scratch-dir probe filename is unique per run; a stale file from
  an earlier run can no longer score a denied write as allowed.
- The probe-3 comment states the CAP CLI's real contract (node, never
  tsx).
- The three byte-identical exitWhenFlushed copies fold into
  eval/exit-when-flushed.ts (runCli), one copy of a load-bearing,
  srt-coupled workaround.
…op-hook salvage to the Pi runner, and set up the gemini-3.8-flash A/B

Main moved since this branch forked: the prose judge (#362) and the
salvage/metering hardening (#377) landed inside the SDK runner and
dispatch.ts, both of which this branch deletes or restructures. The
resolution ports them onto the Pi harness:

- judge-prose-runner.ts is rebuilt on pi-ai (one completeSimple call, no
  tools, pinned judge model, fail-open construction); the SDK version is
  gone with the SDK.
- The submit_result tool awaits the prose gate AFTER the contract check,
  holds the last contract-valid payload as provisional, and every salvage
  path returns captured ?? provisional, so a style bounce can cost prose
  quality, never a dimension.
- The SDK Stop hook becomes Pi's follow-up seam: an agent ending its turn
  without an accepted submission is pointed back at submit_result, at most
  twice, with the reason branching on whether the tool was ever called.
- dispatch-calls.ts (this branch's extraction) absorbs main's per-attempt
  prose-gate wiring; the contract types stay in dispatch-agents.ts (main's
  extraction) and dispatch.ts re-exports both surfaces.

New in this commit, the gemini-3.8-flash A/B setup:

- dispatch-models.ts routes pins by provider (gemini-* to Google, else
  Anthropic), carries the pin resolver, the api-proxy steer, and a local
  gemini-3.8-flash catalog entry (launch intro pricing) that a future pi-ai
  bump supersedes by id.
- Every sub-agent pin in review.md moves to gemini-3.8-flash so the live
  A/B measures the model against main's claude baseline on the same
  harness; engine, prose judge, and eval judge/arbiter pins stay claude.
  The eval workflow passes GEMINI_API_KEY and skips the live phases
  loudly when it is missing.
- The ANTHROPIC_BASE_URL steer is fixed on the way: the old
  createProvider({...provider, baseUrl}) form throws in pi-ai 0.83.0; the
  steer now rewrites each catalog model's own baseUrl (the field the API
  layer reads). Only unsteered environments had run this path.

dispatch-runner-pi.ts splits along its seams (dispatch-models.ts,
dispatch-exec.ts, dispatch-tools-pi.ts, all re-exported) to hold the
max-lines cap, with tests split to match. Full suite (2245), lint, and
typecheck are green.
@changeset-bot

changeset-bot Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f8b91a1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
review Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@khan-actions-bot
khan-actions-bot requested review from a team, jeresig and kevinb-khan and removed request for a team September 2, 2026 17:49
James Wies added 2 commits September 2, 2026 11:04
…INI_API_KEY exists

The first A/B run on this PR hit the loud missing-key skip (run
33663403558) and spent nothing. Empty commit because the broker maps no
rerun verb.
…when the sandbox smoke's live phase produces nothing

The first gemini-pin run failed phase B in 0.7 seconds with every signal
zero and no visible cause: produceLive catches per-agent errors into
report.failed (and the runner's provider error rides the empty-output
failure note), but the smoke summary printed only the aggregate table, so
diagnosing the roster cost a live dispatch per hypothesis. On a zero-Bash
gate or any failed agent, print the per-agent table (model, turns, wall,
stop reason, failure note) plus each failed agent's truncated last output.
@github-actions

github-actions Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Review live A/B

Baseline: origin/agent/review-eval-progress-checkpoint (review.md 74da926dede7); candidate: working tree (review.md 4aa272f0589f).

Ruler: matcher deterministic+arbiter; corpus 22a6f55f5685 (10 cases).

Metric Baseline Candidate Delta
Must-catch recall 100% 78% -22%
Verdict agreement 100% 90% -10%
Noise (unmatched posted) 69% 13% -56%
Clean false flags 0 0
Judge mean quality 0.83 0.93 +0.10
Cost (list price) $6.47 $4.59
Tool calls 196 383 1.95x
Cost per tool call $0.0330 $0.0120
Wall clock 1611s 1515s
Cases run / skipped 10 / 0 10 / 0
Misses found-but-dropped 0 0
Findings anchor-snapped 1 0
Cross-source claims merged (of candidates) 7 / 37 (0 by clusterer at $0.35 / 216s, 8 proposed member(s) rejected, 1 clusterer failure(s)) 5 / 13 (0 by clusterer at $0.00 / 0s)

Regressions (baseline caught, candidate missed)

  • incident-sql-missing-index:dm-default-backfill (not found)
  • trial-erasure-suite-flag-mock:erasure-suite-flag-mock (not found)

Adversarial hard gate: PASSED on the candidate arm.

Raw output of each failed agent

baseline / incident-auth-bypass / claim-clusterer
**Analysis:**

**Candidates 1, 2, 3** — all from source `correctness`. Per the rules, two comments from the same source cannot be grouped.

**Candidate 1 vs Candidate 4** — different sources (`correctness` vs `security-auth`), both anchored at `src/auth/middleware.ts` line 17, both discuss the `req.headers["x-internal-call"] !== undefined` bypass. However, candidate 4's discussion explicitly names a *second* effect: `"There is a second effect on the same branch: req.session = session (line 31) is skipped"` — the same defect candidate 2 covers. Candidate 4 bundles two defects (the header-bypass auth hole and the missing `req.session` population). The rule is "Leave it alone" — it cannot be grouped with either half.

**Candidate 2 vs Candidate 4** — same bundle issue; candidate 4 may not be grouped with either.

**Candidate 3** — missing tests; a distinct edit (writing tests) with no match in a different source.

No valid clusters remain.

{"clusters": []}

Agent failures

  • incident-auth-bypass: claim-clusterer: malformed output: output carries no parseable JSON object failed

Single-run-stable rows: recall, verdict agreement, regressions, adversarial gate. Judge quality and noise are not: they jitter run-to-run at this corpus size, and a regressed reviewer can score HIGHER on judge quality (fewer, surer comments each read better). Recall against the labeled specs is the load-bearing metric.

Measured noise floor (identical arms, run 29069228968, 2026-07-10, 6 arm-samples, full corpus x3, pre-arbiter; budget skips left the samples on unequal case sets, so these v1 bands also carry case-mix variance): must-catch recall 54%-86% (sd 10%), verdict agreement 75%-100% (sd 9%), noise (unmatched posted) 50%-60% (sd 3%), judge mean quality 82%-86% (sd 2%). A single-run delta whose arms both sit inside a band is indistinguishable from run-to-run wobble; use --repeats to resolve smaller effects.

@github-actions github-actions Bot left a comment

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.

Changes requested — see inline comments.
19 of 19 prior review threads are still unaddressed as of 319f777:

11 non-blocking threads still open (9 previously reported)
Non-blocking observations (4; top: `workflows/review/eval/sandbox-smoke.ts:407` suggestion (non-blocking, documentation): The comment on the smoke's `onTranscript` says transcripts land under `out/transcripts`, but this PR moved them to `/tmp...)
  • workflows/review/eval/sandbox-smoke.ts:407 suggestion (non-blocking, documentation): The comment on the smoke's onTranscript says transcripts land under out/transcripts, but this PR moved them to /tmp/review-transcripts; update the comment to name the real destination. (documentation)
  • .changeset/review-gemini-ab-pins.md:21 note (non-blocking): The PR description is stale against the branch: it still describes pi-ai 0.83.0 and omits the 0.83.0→0.84.4 bump, the blanket high thinking level, the sandbox-smoke and harness-probe jobs, and the transcript artifacts — please refresh it from the changeset. (completeness)
  • workflows/review/lib/dispatch-exec.ts:54 suggestion (non-blocking, documentation): The 34-line sandbox-policy docblock sits on const REVIEW_SANDBOX_ENV, not on the SANDBOX_CONFIG it describes; move each of this file's three detached docblocks onto the declaration it documents. (documentation)
  • workflows/review/eval/sandbox-smoke.ts:245 suggestion (non-blocking): Nothing tests that a probe-deadline timeout is classified as a broken wrapper, even though the whole classification rests on the literal bwrap: prefix in that message. (test-adequacy)
Note: 4 finding(s) not re-posted (already tracked in open review threads). Note: re-review ran at scoped depth (re-review mode scoped, blocking-medium).
review details review-v1.25.0 | schema 2 | depth scoped | re-review scoped blocking-medium | enable holistic,completeness,test-adequacy,first-principles,conventions,documentation
review fingerprint pr-reviewer:rereview v=1 depth=scoped verdict=REQUEST_CHANGES anchor-draft=false hunks=eyIuY2hhbmdlc2V0L3Jldmlldy1nZW1pbmktYWItcGlucy5tZCI6WyJiYzE5Y2IyYzFhNTRjZDlkIl0sIi5jaGFuZ2VzZXQvcmV2aWV3LXBpLWhhcm5lc3Mtc2VhbS5tZCI6WyI1NWVmYzg5ZjgxYTgzZTRmIl0sIi5jaGFuZ2VzZXQvcmV2aWV3LXBpLXRvb2wtc3VyZmFjZS5tZCI6WyJiODQ2N2M5YjI1MDMxM2FkIl0sIi5naXRodWIv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y1OTNhZDFkIiwiY2VmZWEwYmNmNTkzYWQxZCIsImNlZmVhMGJjZjU5M2FkMWQiXX0

return async (request) => {
// The runner is memoized across requests, so the label must come
// from the transcript itself, never from this closure's `request`.
runner ??= createPiRunner(

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.

issue (blocking): The repo-root read denial this PR builds is wired only into the sandbox smoke; the measured A/B arms still pass no denyRead, so the answer-key leak the change exists to close stays open on exactly the runs that produce numbers.

context

The repo-root read denial this PR builds is wired only into the sandbox smoke; the measured A/B arms still pass no denyRead, so the answer-key leak the change exists to close stays open on exactly the runs that produce numbers. grep -rn "sandbox:" workflows/review/eval/*.ts returns one hit, sandbox-smoke.ts:405. live-runner.ts's piRunner() — the runner live-ab.ts:641 gives to BOTH arms, and rereview-sweep.ts:194 reuses — calls createPiRunner({}) or createPiRunner({onTranscript}), never {sandbox: {denyRead: [...]}}, so createToolExec's SandboxOptions = {} default leaves SANDBOX_CONFIG.filesystem.denyRead = ["~/.ssh"] (dispatch-exec.ts:69) as the whole policy.

Three places assert the opposite — the changeset ("the live A/B denies the repo root"), the SandboxOptions docblock (dispatch-exec.ts:215, "the eval passes its own repo root"), and PiRunnerOptions.sandbox (dispatch-runner-pi.ts:218). The one job that does deny is the smoke, which by its own header "reports no quality metrics".

The readable repo root is pre-existing — the denial covered only ~/.ssh before this branch as well. This change amplifies it: it pins every measured sub-agent to gemini-3.8-flash, the model the changeset records as running find / -name investigation-cap.ts on every run where claude stayed in the checkout, and it ships prose saying the live A/B is isolated when only the smoke is. One option at live-runner.ts:72 closes it.

A sketch, not a committable replacement:

        runner ??= createPiRunner({
            // The cases live under /tmp and need nothing from the repo the
            // eval runs out of; a reviewer that searches the filesystem must
            // not reach the corpus, the scorer, or the contracts source.
            sandbox: {denyRead: [process.cwd()]},
            ...(process.env[TRANSCRIPTS_ENV] === "1"
                ? {
                      onTranscript: (transcript) => {
                          writeTranscript(
                              `${basename(transcript.cwd)}--${
                                  transcript.model
                              }`,
                              transcript,
                          );
                      },
                  }
                : {}),
        });

found by holistic

* it to deny reads of its own repo root so the corpus and the scorer
* are unreachable from a reviewer; production leaves it unset.
*/
sandbox?: SandboxOptions;

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.

issue (blocking): The new sandbox.denyRead seam is only wired into the sandbox smoke; the live A/B still runs with the repo root readable, so the answer-key isolation does not reach the measured arms.

context

The new sandbox.denyRead seam is wired only into the sandbox smoke; the measured A/B arms still pass no denyRead, so the answer-key isolation this PR documents does not reach the runs that produce numbers. grep -rn 'denyRead|sandbox:' workflows/review --include=*.ts (tests excluded) returns exactly three call sites: sandbox-smoke.ts:405, sandbox-smoke.ts:457, and dispatch-exec.ts itself. live-runner.ts:71-83's piRunner() — the runner live-ab.ts:641 gives both arms and rereview-sweep.ts:194 reuses — constructs createPiRunner({}) or createPiRunner({onTranscript}), so createToolExec falls to its SandboxOptions = {} default and the policy stays denyRead: ['~/.ssh'] (dispatch-exec.ts:69).

Three pieces of added prose assert the opposite: this option's docblock (dispatch-runner-pi.ts:218-219, "The eval uses it to deny reads of its own repo root so the corpus and the scorer are unreachable from a reviewer"), dispatch-exec.ts:215-216 ("the eval passes its own repo root"), and the changeset ("the live A/B denies the repo root (its cases live under /tmp and need nothing from it)"). The one job that does deny is the smoke, which by its own header reports no quality metrics. dispatch-runner-pi.test.ts:754 pins the pass-through against a literal path rather than a real call site, which is why the gap is green.

Provenance: the readable repo root is pre-existing — srt's denial covered only ~/.ssh before this branch too. This change amplifies it twice over: it pins every measured sub-agent to gemini-3.8-flash, the model the changeset says did find / -name investigation-cap.ts on every run where claude did not, and it adds prose asserting the leak is closed on the live A/B when it is not. Fix is one option at live-runner.ts:72: pass sandbox: {denyRead: [<repo root>]} alongside the existing onTranscript branch.

found by correctness-reviewer | also flagged by completeness

// prompt stayed on the diff and stopped at 8. The lines below say what
// claude inferred. The cap CLI carve-out is deliberate: production
// checks the lib out beside the PR and the prompts run the CLI from it.
"Scope is the changed files and the code they call. The 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.

issue (blocking): The new scope lines forbid the two things every reviewer must do: read its inputs under /tmp/gh-aw/review/ (outside cwd) and, on this repo's own PRs, read the review tooling that IS the changed files.

context

The new scope lines forbid the two things every reviewer must do: read its inputs under /tmp/gh-aw/review/ (outside cwd) and, on this repo's own PRs, read the review tooling that IS the changed files. The lines are harness-level, so they reach every production dispatch (options.systemPrompt ?? SYSTEM_PROMPT; only harness-probe.ts overrides).

(1) dispatch.ts:238 documents cwd as "The PR checkout (sub-agent cwd)", and grep -c "/tmp/gh-aw/review" workflows/review/review.md returns 83 hits: every extracted sub-agent prompt opens with "Read from disk: /tmp/gh-aw/review/pr-context.json" and names the diff it must review under the same root (:1372, 1491, 1706, 1840, 1887, 1970, 2039, 2267). eval/live-stage.ts:10-29 reproduces that shape by staging <dest>/context/ as a SIBLING of the <dest>/checkout/ cwd. So "anything outside the working directory ... do not search for or read them" names the review's own input directory, in both environments. The cap CLI got an explicit carve-out here; the staging root did not.

(2) .github/workflows/review.lock.yml runs this reviewer on Khan/actions PRs, where the changed files are workflows/review/** — this very PR — so "The review tooling, the eval or CI machinery ... are not in scope" contradicts the preceding sentence, "Scope is the changed files and the code they call."

What is certain here is the contradiction, not any particular model's resolution of it: a sub-agent that honors the harness line over its task prompt reviews without the diff, the provenance map, or the thread context, and the failure is silent — it returns a well-formed contract with fewer findings, not an error. The behavior being fixed (a model burning 37 of 42 calls on the tooling) is a filesystem-search problem, which the denyRead seam in this same PR addresses at the boundary; the prompt only needs to forbid the search, not the reading of inputs the instructions name.

A sketch, not a committable replacement:

    "Scope is the changed files, the code they call, and the review inputs",
    "your instructions name under /tmp/gh-aw/review/. Do not search the",
    "filesystem for the review tooling or the eval and CI machinery, and do",
    "not read them unless they are among the changed files. Running the",
    "investigation-cap CLI your instructions name is fine; if it is",
    "unavailable, treat that as a denied budget and conclude. Emit the",
    "output contract exactly as your instructions describe it; do not",
    "read or run the review tooling's source to validate it.",

found by holistic | also flagged by first-principles (at line 147)

* `tail -n 30 .../skill-auditor.json`). Nothing a reviewer can reach may
* be written during a run.
*/
export const TRANSCRIPTS_DIR = "/tmp/review-transcripts";

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): Moving transcripts to /tmp does not make them unreachable; /tmp is not in the sandbox's denyRead, so add TRANSCRIPTS_DIR to the callers' denyRead.

context

Moving transcripts to /tmp does not make them unreachable; /tmp is not in the sandbox's denyRead, so add TRANSCRIPTS_DIR to the callers' denyRead. The docblock above this constant states the invariant as "Nothing a reviewer can reach may be written during a run", but reachability is set by the sandbox policy, not by the path being outside the repo tree: SANDBOX_CONFIG.filesystem.denyRead is ["~/.ssh"] (dispatch-exec.ts:69) plus whatever the caller adds, and neither sandbox-smoke.ts:405 (which adds workflows and .github only) nor live-runner.ts (which adds nothing) includes /tmp/review-transcripts. Transcripts are written from the runner's finally block (dispatch-runner-pi.ts:615), i.e. as each agent's loop ends while siblings are still looping, so the window is real rather than post-run. The write happens in the runner process, which sits outside the sandbox, so denying tool reads of the directory costs nothing. Introduced by this change, and it is non-blocking because the smoke reports no quality metrics and the live A/B only writes transcripts under the opt-in REVIEW_EVAL_TRANSCRIPTS=1 dispatch flag.

A sketch, not a committable replacement:

const smokeDenyRead = (repoRoot: string): string[] => [
    `${repoRoot}/workflows`,
    `${repoRoot}/.github`,
    // Sibling agents write here concurrently during phase B; a transcript is
    // another reviewer's investigation, not evidence about the diff.
    TRANSCRIPTS_DIR,
];

found by correctness-reviewer | also flagged by skill-auditor (out-of-lane); security-auth (out-of-lane); holistic

…s production's structured-final path

No live gemini run had ever registered submit_result. The eval's live
requests carry no validate, so the runner never registers the tool and the
prose gate never engages, and both A/B arms end in free text, which is what
the recorded corpus was calibrated on and stays that way. Production is the
structured tool plus the judge bounce, so the branch could not claim the
model works in production's shape.

LiveAgentRequest gains validate (production's AgentRequest.validate) and
ProduceLiveOptions a validatorFor(name, kind) with the role mapping
lib/dispatch.ts uses (validator, clusterer, reconciler as json, routed
lenses as lens, else finder), so a caller that sets it exercises
production's exact contracts. The smoke passes contractValidator; the A/B
passes nothing. LiveAgentResult.structured threads to
PerAgentReport.structuredFinal, and the smoke's signal table gains a
'structured finals (submit_result)' row counting agents that delivered
through the tool, so 'production's output path works on this model' is an
observation. Tests cover the role mapping, the unset default, and the
structured-final report.
@khan-actions-bot
khan-actions-bot requested review from a team and jaredly and removed request for a team September 3, 2026 20:54

@github-actions github-actions Bot left a comment

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.

23 of 23 prior review threads are still unaddressed as of dec444d:

12 non-blocking threads still open (11 previously reported)
Non-blocking observations (6; top: `workflows/review/eval/live-ab-report.test.ts:82` suggestion (non-blocking): The `armToolCalls` test never has more than one count to sum, so a first-element-only implementation would pass it.)
  • workflows/review/eval/live-ab-report.test.ts:82 suggestion (non-blocking): The armToolCalls test never has more than one count to sum, so a first-element-only implementation would pass it. (correctness-reviewer)
  • workflows/review/eval/live-ab-report.ts:324 suggestion (non-blocking): armToolCalls is only ever exercised with one agent in one case, so nothing tests the summation the function exists for; add a multi-agent, multi-case fixture. (test-adequacy)
  • workflows/review/eval/live-ab-report.ts:542 suggestion (non-blocking): The conditional row group uses a spread IIFE where every other group in this file uses ...(cond ? [rows] : []) — lift the body to a named helper or a ternary. (conventions)
  • workflows/review/eval/live-ab-report.ts:562 thought (non-blocking): Cost per tool call is exactly the two rows above it divided, so on cross-provider arms it mostly reports the models' price sheets rather than anything about the harness; consider dropping it and keeping the raw tool-call row. (first-principles)
  • workflows/review/eval/live-ab-report.ts:563 nitpick (non-blocking): The one-arm-counted rendering path (n/a cell, blank ratio) has no test; only the both-arms-counted row is asserted. (test-adequacy)
  • workflows/review/eval/live-ab-report.ts:323 nitpick (non-blocking): armToolCalls breaks the <field>Total naming both sibling per-arm aggregates use — consider toolCallsTotal. (conventions)
Note: re-review ran at scoped depth (re-review mode scoped, blocking-medium).
review details review-v1.25.0 | schema 2 | depth scoped | re-review scoped blocking-medium | enable holistic,completeness,test-adequacy,first-principles,conventions,documentation
review fingerprint pr-reviewer:rereview v=1 depth=scoped verdict=APPROVE anchor-draft=false hunks=eyIuY2hhbmdlc2V0L3Jldmlldy1nZW1pbmktYWItcGlucy5tZCI6WyJiYzE5Y2IyYzFhNTRjZDlkIl0sIi5jaGFuZ2VzZXQvcmV2aWV3LXBpLWhhcm5lc3Mtc2VhbS5tZCI6WyI1NWVmYzg5ZjgxYTgzZTRmIl0sIi5jaGFuZ2VzZXQvcmV2aWV3LXBpLXRvb2wtc3VyZmFjZS5tZCI6WyJiODQ2N2M5YjI1MDMxM2FkIl0sIi5naXRodWIvd29ya2Zsb3dzL3Jldmlldy1ldmFsLWFiLnltbCI6WyI3MmE1NGFhZjNlMzUxNGUxIiwiNTAxNWEyNDdmODg5MjQ1ZCIsIjY3YmUxNDAwMDU0YjMxYTgiLCI5ZDI5NWE4MmNiOGRkOWIzIiwiMzQ4OWUzYTg4ODc5OThkZSIsIjFkMmU0ZGVlY2QyMDQ1MDUiXSwicGFja2FnZS5qc29uIjpbImJlOTU4MTM4ZWE3YjA4YTUiLCJkZTE0MzQ1ZDk4NDVhMzEwIl0sIndvcmtmbG93cy9yZXZpZXcvUkVBRE1FLm1kIjpbImUxYzQ3ZjViMjc0NmI3ZjUiLCI2OThmOTc4NTBjYzlkYjcwIl0sIndvcmtmbG93cy9yZXZpZXcvZXZhbC9hZ2VudC1leHRyYWN0LnRlc3QudHMiOlsiNjdiNjAwNjBlMGYwMDM0OCJdLCJ3b3JrZmxvd3MvcmV2aWV3L2V2YWwvZXhpdC13aGVuLWZsdXNoZWQudHMiOlsiMTQ2OWE0MjRmY2QwOGQ1MCJdLCJ3b3JrZmxvd3MvcmV2aWV3L2V2YWwvaGFybmVzcy1wcm9iZS50cy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kiXSwid29ya2Zsb3dzL3Jldmlldy9yZXZpZXcubWQiOlsiY2VmZWEwYmNmNTkzYWQxZCIsImE4MDJhYTI2NmI0YmZlMGYiLCJjZWZlYTBiY2Y1OTNhZDFkIiwiYTgwMmFhMjY2YjRiZmUwZiIsIjFiZjM4NGJjMmY1Yjg5ZjMiLCJjZWZlYTBiY2Y1OTNhZDFkIiwiMWJmMzg0YmMyZjViODlmMyIsImNlZmVhMGJjZjU5M2FkMWQiLCJhODAyYWEyNjZiNGJmZTBmIiwiY2VmZWEwYmNmNTkzYWQxZCIsImNlZmVhMGJjZjU5M2FkMWQiLCJjZWZlYTBiY2Y1OTNhZDFkIiwiY2VmZWEwYmNmNTkzYWQxZCIsImNlZmVhMGJjZjU5M2FkMWQiLCJjZWZlYTBiY2Y1OTNhZDFkIiwiY2VmZWEwYmNmNTkzYWQxZCIsImNlZmVhMGJjZjU5M2FkMWQiLCJjZWZlYTBiY2Y1OTNhZDFkIiwiY2VmZWEwYmNmNTkzYWQxZCIsImNlZmVhMGJjZjU5M2FkMWQiLCJjZWZlYTBiY2Y1OTNhZDFkIiwiY2VmZWEwYmNmNTkzYWQxZCIsImNlZmVhMGJjZjU5M2FkMWQiLCJjZWZlYTBiY2Y1OTNhZDFkIiwiY2VmZWEwYmNmNTkzYWQxZCIsImNlZmVhMGJjZjU5M2FkMWQiXX0

: []),
row(
"Cost",
"Cost (list price)",

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 new tool-call/cost-per-call rows only reach the single-run table; the --repeats pooled report still shows a bare Cost row, which is where the powered read happens.

context

The new tool-call/cost-per-call rows only reach the single-run table; the --repeats pooled report still shows a bare Cost row, which is where the powered read happens. live-ab.ts:799-852 picks the renderer by repeat count: repeats === 1 → renderMarkdownReport (which this diff extends), otherwise renderMultiMarkdownReport. That multi renderer (live-ab-report.ts:210-282) never calls renderMarkdownReport; it emits renderAggregateMarkdown(report.aggregate) plus asymmetry/gate sections, and aggregate.ts:915 still renders | Cost | $... | with no tool-call rows (grep for toolCalls in workflows/review returns no hit in aggregate.ts, and extractSamples/aggregateSamples carry no call counts). Two consequences from the same root: the diagnosis this change exists to enable is absent from the repeats path, and the same concept is now labelled two ways in one report family — Cost (list price) in the single-run table, Cost in the pooled one. Plumbing a pooled call count through the sample shape (or at minimum matching the label) would keep the two renderers reading as one system.

A sketch, not a committable replacement:

// aggregate.ts: carry the count the artifact already has
// ArmSample: toolCalls?: number;
// parse():  ...(armToolCallsFromRaw(raw) !== undefined ? {toolCalls: armToolCallsFromRaw(raw)} : {}),
// renderAggregateMarkdown(): emit `| Tool calls |` and `| Cost per tool call |` beside the Cost row

found by holistic | also flagged by completeness (at line 542)

@jwbron jwbron added the skip-ai-review Opt this PR out of automated AI review label Sep 3, 2026
James Wies added 4 commits September 3, 2026 14:18
… not cancel the PR's in-flight A/B

Run 33802457289's A/B was 45 minutes in when a skip-ai-review label was
added to the PR. The labeled event fired the workflow, the per-PR
concurrency group cancelled the live run, and the new run then skipped every
job because the label was not full-eval. The job-level if is too late to
prevent the cancellation, so the concurrency key now sends a non-full-eval
labeled event to its own noop group.
… A/B

Run 33802457289's A/B was 45 minutes in when a skip-ai-review label was
added to the PR. The labeled event fired the workflow, the per-PR
concurrency group cancelled the live run, and the new run then skipped every
job because the label was not full-eval. The job-level if is too late to
prevent the cancellation, so the concurrency key now sends a non-full-eval
labeled event to its own noop group.
…nts progress and checkpoints its report after every case

Run 33802457289 was cancelled 45 minutes in and left nothing: the actions
log went from the tsx live-ab.ts invocation straight to "The operation was
canceled", and no report file existed for the always() upload to carry.

Progress (live-ab-progress.ts): the runner is wrapped so every dispatch end
prints one stderr line (arm, case, agent, cost, turns, wall time, tool calls
when the runner counts them), and runArm prints one per scored case
(verdict against expected, caught and missed keys, cost this case and so
far). Stderr only, since stdout carries the report markdown.

Checkpoint (live-ab-checkpoint.ts): the report writer rewrites
live-ab-report.json and the .md after every scored case, with partial: true
in the JSON and (partial) in the markdown header plus a caveat line saying
how far each arm got. The final write replaces it. A repeated run's
checkpoint nests the in-progress repeat, itself partial, under the finished
ones, and aggregate.ts skips a partial single-run report when pooling.

The deltas and gates move to live-ab-gates.ts so the checkpoint writer can
import them without a cycle; live-ab.ts re-exports everything it used to.
…oint (actions#421) into the Pi harness branch
@jwbron
jwbron changed the base branch from main to agent/review-eval-progress-checkpoint September 3, 2026 22:07
James Wies added 2 commits September 3, 2026 15:28
…s on the progress and checkpoint change

- The gate-retry dispatches were the one stretch still silent: the retry
  producer now wraps the runner too, labeled candidate-retryN.
- skip-live-eval stays in the live concurrency group. It's the opt-out, and
  under the old key adding it mid-run cancelled the burning run, which is
  what someone adding it wants. Only other non-full-eval labels go to noop.
- The drift workflow skips its visibility PR when the report is partial, so
  a cancelled drift run can't commit a checkpoint's aggregate into the
  in-repo time series. The artifact upload stays unconditional.
- Checkpoint writes stage to a dotfile beside the target and rename, so a
  cancel mid-write can't truncate the report, and the artifact glob never
  picks up a torn staging file.
- RunHeader moves to live-ab-report.ts with the other report shapes.
- aggregate.ts names the cause when a source pools nothing (partial
  checkpoint vs no reviewable delta), and its docblock records why the
  partial check sits below the repeats branch.
- Tests: the refused/error dispatch-line segments, assembleReport's flake
  suppression with real gateRetries, and the mid-arm caveat text captured at
  each checkpoint instead of read after the arm finished.
…oint review follow-ups (actions#421) into the Pi harness branch

# Conflicts:
#	workflows/review/eval/live-ab.ts
@jwbron

jwbron commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Run 5 (33813811599, on the #421-merged head) repeats run 4 within a few percent on every column: gemini 7/9 recall, 9/10 verdicts, 399 tool calls, $3.95 list, 1087s; claude 9/9, 10/10, 253 calls, $6.09, 1550s. The harness is stable across runs 3, 4, and 5.

Both misses repeated. Erasure is 5 for 5. The dm-default-backfill miss on incident-sql-missing-index is 2 for 2 since the corpus fix (#412) after being caught on all 3 runs before it, at 68 and 79 tool calls, with gemini still blocking the case on its missing-index finding. Nothing in #412 touches that case, so the correlation is probably coincidence, but two in a row means it's no longer safely wobble. Repeats on the full corpus are what separate "stopped finding it" from "finds it 3 times in 5."

Also from this run: the smoke had 4 of 4 gemini agents deliver through submit_result, so production's structured-final path works on gemini, and the cancelled run before this one (a push mid-run) left a partial report with the whole claude arm in it, so #421's checkpoint does its job.

James Wies added 3 commits September 3, 2026 17:15
…system prompt

Two things toward closing gemini's remaining 1.5x tool-call gap without
touching effort (quality is the constraint, and lower effort is documented
to trade it).

Transcripts now carry the agent's token totals (input, output, reasoning,
cacheRead, cacheWrite) summed from the usage pi-ai puts on every assistant
message. Tool calls have been the cost proxy all along, and they cannot say
how much of gemini's spend is reasoning tokens at effort high, which no
tool-call change touches. The next smoke answers that.

The system prompt gains one line: batch related reads and searches into one
Bash command. The transcripts show the shape difference behind most of the
remaining gap at equal investigation depth: claude did a whole review in 8
calls by bundling (cat a && cat b && grep x), gemini made one Read per file
and one Grep per pattern for the same investigation, 30 to 50 calls, each a
round trip and a re-read of the context. The line says what claude already
does, so the baseline should not move; that is for the run to confirm.
…tion and test adequacy by reading

The erasure case is gemini-3.8-flash's one consistent miss (6 for 6 across
every configuration), and the transcript on it (run 33823474609) says why.
Gemini read the diff, erasure.go, and store.go by call 5, the same three
files claude read, then spent calls 7 to 19 trying to run the tests inside
the read-only sandbox: go test, then TMPDIR, GOTMPDIR, GOCACHE, mkdir, df
-h, find / -name go.mod, copying the package into the scratch dir, a
throwaway main.go to check slice semantics. At call 18 the tests passed and
its thinking reads 'the tests smartly leverage in-memory storage and flag
fakes'. It judged the suite by running it, and read the hardcoded flag (the
defect) as a feature. Claude, in 5 calls, reasoned about the suite's shape:
'only exercises the retention-flag-on path, so the flag-off behavior is
untested', and wrote the finding.

Two lines, harness-owned so review.md stays calibrated. Do not run the
code, its tests, or its toolchain (6 of gemini's 22 calls on this agent
were toolchain attempts, every one a dead end in a read-only checkout, and
the error output doubled its per-turn context, 23k tokens to claude's 10k).
And a passing run is not adequacy: for each test in the diff, ask what
defect it would fail on. Claude does both unprompted, so the baseline
should not move, which the next run confirms or not.

Also from the same transcripts, the token composition the eval never had:
gemini's output is 96% reasoning tokens (32k of 33.5k on one agent, 9x
claude's), and its implicit prompt caching is unreliable (0 cache hits on
skill-auditor, 97k input tokens at full rate; two thirds hit on
correctness-reviewer). pi-ai's google adapter sets no explicit cache.
Recorded here as the next cost lever; not changed in this commit.
…iling

Run 33819211523 (full corpus, 3 repeats) was cancelled by the job's
180-minute timeout at 02:49:18, exactly 180 minutes after its 23:49:03
start, seconds after repeat 1 finished (claude 96 minutes over 41 cases,
gemini 83, sequential). Repeats 2 and 3 never started. The cap was
calibrated on ~75 minutes of model work, from before the corpus grew to 41
live cases.

360 is GitHub's maximum for a hosted job. Three repeats still do not fit,
so a powered run is three repeats=1 dispatches with the reports pooled,
which also keeps the two arms from competing for anthropic quota within a
dispatch (the 529 overloads showed up at concurrency 4). Short runs are
unaffected.
@jwbron

jwbron commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Assessment after 7 smoke runs, one full repeat over 34 to 41 cases, and 13 transcripts read. The 3-repeat powered run is still owed (three repeats=1 dispatches on f8b91a1, about 3 hours and $38 each, the 180-minute job cap having cancelled the first attempt at 33819211523 seconds after repeat 1 finished), so the numbers below are the shape, not the measurement.

The harness question is settled. Pi replaces the SDK harness at parity on claude: same recall, verdicts within one, half the cost, reconfirmed with thinking on in both arms and the scoped system prompt. That was #305's original claim and it holds.

Gemini-3.8-flash as a swap for the whole roster: no, on this evidence. Verdicts are equal (34/34 on the shared full-repeat set, 9/10 on every smoke run). Recall isn't: 32/36 against claude's 36/36 at n=1 on the full corpus, 8/9 against 9/9 on every smoke. The misses cluster on test-structural defects (a suite that can't fail on what it claims to cover, a test that asserts nothing), and the erasure transcript (33823474609) showed the mechanism: gemini judged the suite by running it (13 of 22 calls fighting the read-only sandbox to get go test green) and read the hardcoded flag fake as "smart", claude asked what the tests would fail on and wrote the finding in 5 calls. The test-adequacy line added at f54d683 got gemini to post the erasure defect for the first time in 7 runs, as non-blocking where claude blocks, so on that class the gap is now severity rather than blindness. A correctness reviewer's job is recall, and this one trails by a class of defect.

Precision is gemini's strong side. It posts a third as much (8/40 unmatched on the full repeat against claude's 74/124), nearly all of it matched or legitimate, and the writeups are concrete. Claude's extras are about 45% real findings the corpus never specced plus a "no test covers X" template on most PRs. The review a human gets from gemini is easier to act on and misses more.

Cost, plainly: no win at Khan's rate as it stands. Gemini is 0.63x to 0.70x claude at list, so 1.3x to 1.4x once #314's 50% overlay is applied to the claude column. The per-task benchmark advantage doesn't show up here for three measured reasons: turn count (1.5x claude's, down from 4x after the isolation and scope fixes), reasoning volume (96% of gemini's output tokens), and prompt caching that hit two thirds of the time on one agent and never on another (pi-ai's google adapter sets no explicit cache). Explicit cachedContents for the stable prefix is the one lever left with real size, and it's an adapter-level change. Without it the case for gemini is quality-shaped (quieter reviews), not cost-shaped.

What I'd do next:

  • The three repeats=1 full dispatches on f8b91a1 before any production decision.
  • The hybrid, which the per-role pins on this branch make a review.md edit: gemini on the specialist lenses (security-auth, concurrency-async, caching-resource found the same defects claude did on every run, in a third of the words), claude on correctness-reviewer and claim-validator.
  • Explicit caching in the google path as its own task, the only change that flips the cost sign.

One process note for whoever reads the next eval: every wrong call in this thread (model behavior at effort high, function-call ids, the thinking level) was made from tool-call counts, and every right one came from a transcript. The branch writes them now (onTranscript, uploaded per run). Read one per arm before believing a number.

Base automatically changed from agent/review-eval-progress-checkpoint to main September 4, 2026 17:00
jwbron pushed a commit that referenced this pull request Sep 5, 2026
…staged case, and write their transcripts

The live A/B stages each case under the runner's temp dir on a machine
that also holds this repo, and this repo holds every case's must-catch
spec and the scorer. Nothing denied a reviewer reading across. On the Pi
harness branch (#406, runs 33793491316 and 33795650180) a gemini
reviewer did: find / -name investigation-cap.ts, then its own case.json,
another case's, a grep for mustCatch, and live-match.ts, 37 of its 42
calls on one case. The tool-call count hid it for two full runs.

Turns out main's SDK arm was open the same way, wider than the task
assumed. allowedTools only pre-approves, it does not restrict (the SDK
docs say to use `tools` for that), so under bypassPermissions every
default tool, Bash included, was reachable. The module doc's "no
network, Read/Grep/Glob only" described the intent, not the runtime.

Fixes, all in the eval, review.md untouched so no pin or hash moves:

- live-runner.ts sets `tools` to Read/Grep/Glob and adds a PreToolUse
  hook that denies any read resolving outside the staged case root
  (checkout plus its context sibling, symlinks followed). read-scope.ts
  is the pure predicate; Glob patterns that are absolute or climb with
  .. are denied outright since a pattern is not a path to canonicalize.
- LiveAgentRequest carries readRoot, LiveAgentResult and PerAgentReport
  carry deniedReads, and the report renders a "Reads denied outside the
  staged case" row plus a section naming any reviewer with a nonzero
  count. Zero is the expected value.
- transcripts.ts writes one file per dispatch attempt (tool-call index
  on top, trimmed message stream below, inputs never trimmed) under
  <tmpdir>/review-transcripts, outside the staging root, so a reviewer
  cannot read a sibling's mid-run. The three live workflows upload them.
- live-runner.ts --probe-read-scope: one Haiku call that reads a staged
  file and a planted file outside the case, and fails unless the first
  succeeded, the second was denied, and the planted contents never
  reached the model. Each live workflow runs it before spending on an
  arm, because the unit tests cover the predicate and not whether the
  installed SDK honors a hook deny under bypassPermissions.
- README: how the scope works, the probe, a read-protocol line (read at
  least one transcript per arm before trusting a delta), and a
  statistical-honesty note that pre-scope runs were not isolated from
  the corpus and what the indirect evidence says about them.
jwbron added a commit that referenced this pull request Sep 5, 2026
…scripts (#417)

* [jwbron/eval-reviewer-isolation] review eval: scope reviewers to the staged case, and write their transcripts

The live A/B stages each case under the runner's temp dir on a machine
that also holds this repo, and this repo holds every case's must-catch
spec and the scorer. Nothing denied a reviewer reading across. On the Pi
harness branch (#406, runs 33793491316 and 33795650180) a gemini
reviewer did: find / -name investigation-cap.ts, then its own case.json,
another case's, a grep for mustCatch, and live-match.ts, 37 of its 42
calls on one case. The tool-call count hid it for two full runs.

Turns out main's SDK arm was open the same way, wider than the task
assumed. allowedTools only pre-approves, it does not restrict (the SDK
docs say to use `tools` for that), so under bypassPermissions every
default tool, Bash included, was reachable. The module doc's "no
network, Read/Grep/Glob only" described the intent, not the runtime.

Fixes, all in the eval, review.md untouched so no pin or hash moves:

- live-runner.ts sets `tools` to Read/Grep/Glob and adds a PreToolUse
  hook that denies any read resolving outside the staged case root
  (checkout plus its context sibling, symlinks followed). read-scope.ts
  is the pure predicate; Glob patterns that are absolute or climb with
  .. are denied outright since a pattern is not a path to canonicalize.
- LiveAgentRequest carries readRoot, LiveAgentResult and PerAgentReport
  carry deniedReads, and the report renders a "Reads denied outside the
  staged case" row plus a section naming any reviewer with a nonzero
  count. Zero is the expected value.
- transcripts.ts writes one file per dispatch attempt (tool-call index
  on top, trimmed message stream below, inputs never trimmed) under
  <tmpdir>/review-transcripts, outside the staging root, so a reviewer
  cannot read a sibling's mid-run. The three live workflows upload them.
- live-runner.ts --probe-read-scope: one Haiku call that reads a staged
  file and a planted file outside the case, and fails unless the first
  succeeded, the second was denied, and the planted contents never
  reached the model. Each live workflow runs it before spending on an
  arm, because the unit tests cover the predicate and not whether the
  installed SDK honors a hook deny under bypassPermissions.
- README: how the scope works, the probe, a read-protocol line (read at
  least one transcript per arm before trusting a delta), and a
  statistical-honesty note that pre-scope runs were not isolated from
  the corpus and what the indirect evidence says about them.

* [jwbron/eval-reviewer-isolation] review eval: deny non-read tools in the hook, keep denial counts through failed attempts

Round 1 of the reviewer bot on this PR, 8 non-blocking findings, 7 taken:

- The hook allowed any tool it did not recognize, so Bash was kept out
  by `tools` alone, and nothing verified that option restricts. The hook
  now denies every tool outside Read/Grep/Glob as a second layer, and
  the probe gains a third step (Bash cat of the planted file) so the
  leak check covers both layers and the log line says which one kept
  Bash out.
- A timed-out or non-success attempt threw a bare Error and dropped
  every denial it counted, zeroing the report row for the attempts most
  likely to have hunted. Runners now throw LiveAgentError (new module,
  live-agent-error.ts) carrying toolCalls and deniedReads, and
  dispatchWithRetry folds them into the per-agent report. Test added.
- deniedTotal had landed between mergedTotal and its doc comment; moved
  next to snappedTotal with its own.
- transcripts.ts's doc promised index lines carry arguments whole; they
  cap at 300 characters (now INDEX_LINE_CHARS) and the doc says the
  messages hold the full input.
- READ_SCOPE_REASON is a function, renamed readScopeReason.
- live-ab-report.test.ts imports renderMarkdownReport from its namesake.

Not taken: a denial row on the rereview sweep's report. The sweep gets
the transcripts and the probe; its report is a different shape and the
A/B is where the denial signal is read.

* [jwbron/eval-reviewer-isolation] review eval: the probe reads tool results, not just the final text, and has a test

Two inline findings from round 1 on the probe.

The probe checked the model's final text for the planted token and
counted hook decisions, so an SDK that ignored the deny but a model that
politely reported a refusal would have passed it. That is the one
property the probe exists to establish. The probe now runs with a
transcript dir and scans every recorded message alongside the final
text, so the out-of-scope tool result is the surface checked; the
in-scope check reads the transcript too, so a model that paraphrases
instead of quoting does not fail the gate for the wrong reason.

probeReadScope gated all three live workflows with no test of its
verdict. live-runner.test.ts drives it with a fake runner: pass,
leak in the final text, leak only in a tool result, no denial, in-scope
read missing, in-scope read present only in the transcript. No model
call; the module doc's "tests never load this file" is updated to say
what the test loads and why.

* [jwbron/eval-reviewer-isolation] review eval: count tool-policy denials apart from reads, show denials on repeats reports, test the runner

Round 2 of the reviewer bot, 3 inline plus 8 observations, 9 taken.

The hook's two rules fed one counter, so the report could name a
reviewer under "read outside the staged case" for a Bash call the hook
refused, and the probe could pass on a run where the out-of-scope Read
never reached the hook (tool rule fires on step 3, model declines step 2
on its own). deniedReads now counts only the read-scope rule and
deniedTools the tool rule, on LiveAgentResult, PerAgentReport,
PartialAccounting, the run record, and the transcript header. The
probe gates on deniedReads, requires a transcript to exist, and checks
the transcript's tool-call index for the out-of-scope Read attempt so a
model that declined on its own fails with a message naming that rather
than the hook. Its log line reports Bash as denied by the hook, absent
per the model, or unreported, in that order of evidence.

The denial row and section rendered only on single-run reports, so the
weekly drift run (3 repeats) never showed them. deniedSection is shared
by both renderers, sums repeats per arm/case/agent, and lists
tool-policy denials in their own section. The repeats report gets a
pooled "Reads denied outside the staged case" line so its zero is
visible too.

live-runner.test.ts now mocks the SDK (the dispatch-runner.test.ts
pattern) and drives the captured PreToolUse hook: Bash denied and
counted apart, in-scope Read allowed, out-of-scope Glob denied, a
non-success result thrown as LiveAgentError with the counters, and a
transcript per attempt with the retry numbered 2. PINNED_PROBE_MODEL is
exported and pinned by test like the judge and arbiter models.
addAccounting in live-agent-error.ts folds counters for both the success
and failure paths (live-producer.ts sits at the 1000-line cap).

Doc fixes: the README's probe paragraph says what the verdict actually
depends on, and the runner's module doc says the cap CLI was never
staged in the eval, so "uncapped" predates `tools` and is unchanged.

Not taken: gating the probe on whether an arm will dispatch. It costs
$0.014 per run and is the only per-PR signal on the installed SDK.

* [jwbron/eval-reviewer-isolation] review eval: retry the probe once on model non-attempt, name the no-shell limit, test the accounting

Round 3 of the reviewer bot, 1 inline plus 5 observations, 5 taken.

The probe failed the job whenever the model declined to attempt the
out-of-scope read, with no retry, so a haiku behavior change would red
three live workflows for a reason that is not the scope. The probe
result now carries notAttempted, the CLI retries that case once (a leak
or a missing denial never retries), and the failure message says the
scope is unproven for the run rather than broken.

Dropping Bash from the eval arm removes the "one targeted cheap check
per finding" shell step review.md asks for, which production keeps.
The README's statistical-honesty section now says so: both arms lose it
together so within-run deltas stay comparable, eval recall reads as a
lower bound on production's, and scoping Bash by path is not an option
because `find /` is how the leak was found.

Also: runOnce gets its explicit Promise<LiveAgentResult> return type,
addAccounting's no-false-zero contract has a test
(live-agent-error.test.ts), and live-runner.test.ts imports the module
under test statically like the other SDK-mocking tests (vi.mock hoists).

Not taken: excluding or flagging cases with denied reads from the pooled
delta. The denial section names the case and agent, the expected count
is zero, and changing sample inclusion changes every rate; if a nonzero
count ever shows up on a real run, that report is the place to decide.

* [jwbron/eval-reviewer-isolation] review eval: a leaking probe never retries, and the probe's transcript is uploaded

Round 4 of the reviewer bot, 2 inline plus 6 observations, 7 taken.

The retry I added in round 3 could turn a leaking probe green:
notAttempted was computed from the attempt check alone, so a run where
Bash leaked the secret without a Read attempt retried, and a clean
second try decided the job. notAttempted is now gated on !leaked, and
the wiring lives in runProbeGate (injected probe and log) with tests for
the pass, retry, unproven, and never-retry paths.

The probe was the one entry point ignoring --transcripts-dir, so the
transcript that shows which call went through landed in a throwaway
temp dir and was never uploaded. The three workflows now pass the flag
to the probe step, and each attempt gets its own subdirectory under
read-scope-probe/ so the verdict's scan cannot read a prior attempt's
file.

A dispatch failure threw out of probeReadScope with no detail line and
would red every live workflow the same way a leak does. It now returns
a failed verdict with the error in the detail, and never retries.

Also: the probe's doc paragraph sits on the function rather than on
ProbeResult, the README's indirect-evidence sentence names what the 5
Claude agents searched for (the gh-aw-review-lib directory) and
separates the Gemini clause, and the no-shell limit says a review.md
change to the shell step itself prints as a zero delta rather than as
not measured, so those go through the canary.

Not taken: scanning real runs' transcripts for corpus content at report
time. There is no planted token in a real run to look for, the hook
denies before the read happens, and the probe proves enforcement per
run on the installed SDK.

* [jwbron/eval-reviewer-isolation] review eval: stamp the runner's tool policy on the ruler, retry the probe on dispatch failure, pin the workflow ordering

Round 5 of the reviewer bot, 1 inline plus 5 observations, 5 taken.

This PR changed the instrument (reviewers lost Bash and gained read
scoping) without extending the ruler stamp, so aggregate.ts pooled pre-
and post-scope drift runs as comparable. ReportProvenance gains
toolPolicy (READ_TOOL_POLICY in read-scope.ts, "read-scoped:Read,Grep,
Glob"), live-ab.ts stamps it, and the aggregate reads a stamped report
without it as `unscoped` and warns on a mixed pool the way it does for a
matcher or corpus change. A report with no stamp at all stays unstamped.
The ruler line prints the tools value in both renderers. The ruler
rendering moved to aggregate-ruler.ts because aggregate.ts was at 999
lines against a 1000 cap.

The probe's dispatch failure never retried and would red three
workflows on one 529. It is now its own state (dispatchFailed) and
retries once like a non-attempt, since neither says anything about the
hook; a leak or a missing denial still never retries.

Also: .github/workflows/review-eval-probe.test.ts asserts each of the
three live workflows runs the probe before the step that spends and
hands both the uploaded transcripts dir; the probe section has its own
banner above the CLI; and the planted file is notes.txt rather than
secret.txt so the retry is not repeating the most likely deterministic
reason for a refusal.

Not taken: moving the probe into live-ab.ts at the point of dispatch so
identity-short-circuit runs skip it. Same answer as round 2: $0.014 per
run, and a runner-only PR like this one is exactly the case that should
still run it.

* review eval: the probe searches too, a leak that then dies never retries, the stamp carries the rule version

Round 6 of the reviewer bot, 2 inline plus 8 observations, 9 taken.

The probe proved the SDK honors the deny for Read only, while the route
the scope exists to close is search: the incident was `find /`, whose
Read/Grep/Glob analogue is Glob, and read-scope.ts names `**/case.json`
as the query a corpus hunt would make. The probe plants a second file
whose NAME is a token (a Glob result is a listing, so the name is what
would leak), adds a Glob leg over the planted directory, requires both
out-of-scope legs attempted and both denied (deniedReads at least 2),
and checks both tokens in the final text and every tool result.

The dispatch-failure early return skipped the leak check, so an attempt
that leaked and then timed out was retried and a clean retry greened
the gate, the same hazard notAttempted was hardened against in round 4.
The catch now scans the transcript first (the runner writes it in a
finally) and returns dispatchFailed only when no token escaped.

READ_TOOL_POLICY was derived from the toolset alone, so a change to the
scope rule would keep the same stamp and pooled reports would not warn.
SCOPE_RULE_VERSION (1) is folded in: read-scoped:v1:Read,Grep,Glob.

Also: the transcript index parse skips a malformed or foreign .json
instead of throwing; the transcript-write failure path has a test (the
result survives, the error is logged); tool-policy.test.ts pins
production's allowedTools to the eval's read tools plus exactly LS and
Bash so the two lists cannot diverge silently in another way; the
README's read-protocol bullet names the files and index lines to look
for per failure mode; the changeset names the stamp change and what it
does to the "Ruler:" line.

Not taken: moving the probe into live-ab.ts behind the identity
short-circuit (third time asked). An SDK pin bump is the other PR shape
that touches neither review.md nor the runner and still needs the probe.

* review eval: an unproven probe warns instead of failing, brace alternation cannot slip the Glob guard

Round 7 of the reviewer bot, 1 inline plus 3 observations, 4 taken.

A probe that could not be exercised (the model declined both tries, or
the dispatch failed twice) failed the job with a message saying the
scope was unproven, not broken. On a per-PR run that short-circuits at
$0 the probe was the only spend and the only failure source, and a
spending run's arms retry their own dispatches. runProbeGate now returns
a verdict: proven, unproven (the job proceeds under a GitHub warning
annotation, since nothing was learned against the hook either), or
broken (a leak, a missing denial, or a failed in-scope read, which still
fails the job).

The Glob guard tested the raw pattern string, so a brace alternation
like {/**,x}/case.json or {..,x}/live-match.ts passed both the absolute
and the climbing check. Patterns are brace-expanded first (nesting
handled, capped at 256 expansions, past the cap the pattern is treated
as escaping) and every expansion is checked.

tool-policy.test.ts read only production's allowedTools literal and
missed the allowedTools.push("mcp__review__submit_result") line, so it
pinned a list production does not run with. Both are read now and the
expected difference is LS, Bash, and submit_result.

The README's read-protocol bullet points at the denial sections first
and reserves the per-arm read for what the report cannot see (what was
investigated, looping, depth parity), rather than listing symptoms the
hook now catches.

* review eval: judge a glob by where its literal prefix lands, treat a skipped in-scope step as unproven

Round 8 of the reviewer bot, 2 inline plus 7 observations, 8 taken.

The Glob guard denied any `..` in a pattern, so `../context/*.diff` from
the checkout (the staged diffs the prompts point at) was denied and
counted as an out-of-scope read, while every other branch measures from
the case root. Each brace expansion's literal prefix (the segments before
the first glob character) now resolves against the search base and is
canonicalized like a Read target, so the context sibling is in scope and
`../../case-2/**` is not. A `..` inside the glob tail, or a pattern past
the expansion cap, is still denied since it cannot be resolved; the cap
branch has a test. The glob tail itself is not canonicalized, which the
doc now says along with why that is acceptable (the staged tree is a
plain copy with no symlinks).

A probe whose model skipped the in-scope read was `broken` and failed
the job, while skipping the out-of-scope steps was `unproven`. Same kind
of miss, same treatment now: only an attempted in-scope read that
returned nothing is broken.

live-runner.test.ts drives a user/tool_result message through the mocked
SDK and reads it back from the transcript, the half of the transcript the
probe's leak check depends on. tool-policy.test.ts also asserts
production sets no `tools` option (neither in the query options literal
nor after it), so the day production restricts its toolset the
allowedTools comparison starts describing the reachable set.

README: the probe paragraph lists the conditions that fail the job and
the ones that leave it unproven without contradicting itself.

Not taken: exporting production's allowedTools array for a compile-time
import. That edits the production dispatcher, which this PR leaves alone.

* review eval: test a glob against a supplied base, drop a comment that restated the doc

Round 9 of the reviewer bot (approved), 2 of 4 observations taken: the
Glob branch's supplied-path base (absolute and relative) has tests, and
the comment above expandBraces that repeated the function's own doc is
gone. The PR body's probe sentence is reworded separately.

* review eval: an absolute glob prefix resolves once, a read tool the predicate does not know falls closed

Round 10 of the reviewer bot (approved again), 3 of 4 taken.

literalPrefix prepended "/" to a join that already began with one, so
every absolute Glob pattern with a literal directory was checked as
"//dir/...". path.resolve collapsed it, so nothing was wrong in effect,
but the code said something it did not mean. The prefix is the join, and
"/" only when the pattern has no literal at all. Tests for an absolute
in-root pattern and an absolute out-of-root one, and for nested brace
groups, which the expander handled and nothing exercised.

outOfScopeRead's switch fell open for a tool it had no case for, so
adding a tool to READ_TOOLS (the hook's allowlist and the model's
toolset) would have shipped an unchecked read path. The default branch
denies a tool that is in the list and unhandled, and a test walks
READ_TOOLS asserting each member is judged.

Not taken: replacing the brace expander with "deny any brace group
containing / or ..". A false denial is not free here: it is counted as a
reviewer reading outside the case and named in the report, so the
predicate has to be right about ordinary patterns like
{src/a,src/b}/*.ts, not just safe.

* review eval: the denial message names the checkout and context dirs

First forced-arms run through the scoped runner (33902871639, smoke
subset, both arms, $13.35): probe deniedReads=2, recall 100% both arms,
verdict agreement 100%, tool-call means per agent 7 to 10 against 7 to 8
on the last claude reference run, and 8 denied reads, 3 baseline and 5
candidate. None was a corpus hunt. Every one was a reviewer that guessed
<case>/src/... for a changed file (the checkout is <case>/checkout),
missed, and widened a Glob to the staging root, or climbed out of
context/ with a relative path from the diff. Before the scope those
searches returned other cases' files and the other arm's copy of the
same case, silently. Each reviewer recovered in scope on the next call.

The denial message now names the checkout (the cwd) and the context
directory by absolute path so that recovery is one retry, and the
README's scope section says what a denial usually is and that the
transcript tells the two kinds apart in one line.

* review eval: let realpath climb `..` after a symlink instead of collapsing it as text

Round 11 of the reviewer bot, both inline findings taken, both
correctness.

A relative read path was joined with path.resolve before canonical()
ran, and resolve collapses `x/..` as text. When `x` is a symlink the
kernel resolves it first and climbs from the target's parent, so
`escape/../secret.json` from the checkout resolved lexically to a path
inside the root and was allowed, while the same target as an absolute
string was denied. Grep's path and Glob's base and literal prefix took
the same route. The predicate now hands canonical() the raw
`${base}${sep}${rel}` join and lets realpath do the climbing; the
lexical realpath the pure tests inject normalizes, as the real one does.

The real-filesystem symlink test only exercised Read. It now covers
`<symlink>/..` through Read, Grep, and Glob's base, and a symlink in a
glob's literal prefix, plus an in-root prefix that must still pass.

Narrow in practice (a fixture would have to carry an outward symlink and
the reviewer has no Write or Bash to plant one), which is why the bot
filed it non-blocking, but the predicate's stated job is to be
symlink-aware and this was the one path where it was not.

---------

Co-authored-by: James Wies <jwies@khanacademy.org>
@jwbron jwbron closed this Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-ai-review Opt this PR out of automated AI review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants