Plan: the reviewer’s call shape, observed on Vertex (#193)

Closes: #193. Branch: test/reviewer-live. Status: Done (2026-09-21) — the suite runs green on this box’s ADC

TL;DR

#192 pinned what leaves pi-workflow against faked providers and pi-ai’s real clampThinkingLevel. Nothing has yet observed the new shape reaching a real adapter and a real verdict coming back. This adds the observation as a standing suite - reflection-review.live.test.ts - and pins the plan-review log fields #192 left to the commit path.

Operator-run only, never automatic. Live suites are the same class as plan-judge.live.test.ts, safety.live.test.ts and pi-vertex’s: the root vitest.config.ts excludes */.live.test.ts unless PI_TEST_LIVE=1, and only node tools/task.mjs test:live, run by hand, sets it. validate never runs them, so neither does CI; they are not part of the model battery (tools/model-battery, a separate operator tool) either. Without credentials the suite is a visible skip.

Design

The registry. pi-modes' test/live-vertex.ts already builds the real pi-vertex provider over ADC (buildLiveRegistry, liveCredentialsPresent); pi-workflow imports it the way that file imports pi-vertex (a relative path across packages/). It returns pi-modes' JudgeModelRegistry; pi-workflow’s runReflectionReview takes ReviewModelRegistry (packages/pi-workflow/model-registry.ts) - the same three members (find, getProvider().streamSimple, getApiKeyAndHeaders), structurally compatible, passed as never exactly as the unit suites pass their fakes. Its getProvider().streamSimple is wrapped once more in the test to record the options pi-workflow passed, so "on the wire as clamped" is asserted on the object handed to pi-ai - the same seam the unit tests read, now with a real answer behind it.

Why these three levels. pi-vertex turns its catalogue into the fields pi-ai’s clampThinkingLevel reads (packages/pi-vertex/index.ts thinkingLevelMap(entry): offSupported: false → off: null; thinking: adaptive with xhigh: true → xhigh: "xhigh"; every entry with thinking set is reasoning: true). From models.json: fable is adaptive, offSupported: false, xhigh: true → map {off: null, xhigh: "xhigh"}, so off clamps up to minimal and xhigh stands; sonnet is adaptive, xhigh: false → no map, so xhigh clamps down to high and off is allowed. The same shapes are pinned against pi-ai’s clamp in review-thinking-wiring.test.ts (#192); here they land on the real catalogue and a real answer. Each live call passes timeoutMs: 170_000 in deps, under the 180 s vitest timeout, so a slow model is the review’s own unreviewed outcome, not a vitest kill. Erratum (2026-09-21): the bound is per ask and a review makes at most two (the nudge), so timeoutMs: 120_000 under a 260 s case bound (cold-review catch).

Test categories. The three live cases are a contract test: the options object handed to pi-ai (the wire this package owns) and the answer’s form coming back. The plan_review.done case is a regression pin on fields plan-pause.ts already ships without a handler-level assertion.

The cases (one small clean diff, describe.skipIf(!liveCredentialsPresent()), 180 s each):

Reviewer, asked for Level sent Asserted

vertex-anthropic/claude-fable-5-1, high

high

kind === "reviewed"; verdictOf(body) is CLEAN or FLAGS (n); the body’s first non-empty line is a verdict-only line; usage.output > 0; level === "high"; one call; options.reasoning === "high"; no maxTokens key

claude-fable-5-1, off

minimal (cannot stop thinking)

reviewed; level === "minimal"; options.reasoning === "minimal"

vertex-anthropic/claude-sonnet-4-6, xhigh

high (undeclared)

reviewed; level === "high"; options.reasoning === "high"

The diff is the same fixture the unit suites use (a two-line change with an SPDX header), so a FLAGS is possible but a verdict is not optional: the assertion is on the form, not on CLEAN.

The plan-review log fields (unit, not live): plan-review-pause.test.ts gains two cases through the real exit_plan_mode handler, and the harness extensions they need: the Scripted union gains an optional usage on { review } and a { review, stopReason } form; the fake registry’s find returns a reasoning-declaring model ({ id, reasoning: true }) so the clamp yields a level other than off; the bridge in harness() publishes thinkingLevel: () ⇒ "high". Case one: a { review: CLEAN, usage } step - plan_review.done carries wanted: "high", wantedSource: "session", level: "high", usage. Case two: two verdict-less { review } steps (the answer, then the nudge’s answer) - plan_review.done is unreviewed with reason naming the missing verdict and partial equal to the second body.

Scope

File Change

packages/pi-workflow/test/reflection-review.live.test.ts

new; the three live cases

packages/pi-workflow/test/plan-review-pause.test.ts

one case: the #192 log fields on plan_review.done

CHANGELOG.adoc

== Unreleased, === Added: the live suite (tests ship with the package’s release notes as every change does)

docs/modules/ROOT/pages/testing.adoc

the canonical page for the suites: the task test:live row names pi-workflow’s suite beside pi-modes' and pi-vertex’s

No source change. No version bump beyond what the next release carries.

Risks

Risk Direction Mitigation

A live case fails on a real answer shape (a model that ignores the form)

fail-closed (red test:live)

the assertion is on the verdict line’s presence, which the #192 nudge already covers; a red run here is a finding about #192, not noise

Cost: three fable/sonnet calls per run

silent

the root vitest.config.ts excludes */.live.test.ts unless PI_TEST_LIVE=1, which only task test:live (tools/task.mjs testLive) sets; pi-workflow’s vitest.config.ts merges that base, so validate never runs them

Credentials absent on a box

fail-open on the observation (nothing is checked)

describe.skipIf reports a skip, never a pass, as the sibling suites do

Delivery

  1. Branch test/reviewer-live; commit this plan (docs:), nav entry under Active.

  2. The live file and the plan-review case; task test:live for pi-workflow green here; validate green.

  3. CHANGELOG and testing.adoc; MR Closes #193; merge; one line on #193 with the SHA and the observed usage/level from the live run; plan Status → Done, nav → Archive.

Edit this page · latest