Plan: plan review round two by a second vendor, automatically

Closes: #70. Branch: feat/plan-review-round-two. Status: Done (2026-10-24) — round two runs after round one in the pause; the pane, the guidance and the docs carry it

Erratum (2026-10-24): the store’s tests live in packages/pi-modes/test/wiring-lifecycle.test.ts, through the real wiring that presents the pane, not a new test/plan-reviews.test.ts: storeReview is internal to plan-tools.ts.

Erratum (2026-10-24): "round one’s reviewer" is compared by model id through any provider (modelIdOf), not as the same provider/id string, so an Argon author on another provider ref still gets no round two.

Design

What happens today

exit_plan_mode is paused by pi-workflow’s tool_call hook (packages/pi-workflow/plan-pause.ts, pausePlanExit). The first call for a plan runs one cold read by chooseReviewer(author), which for plan mode’s Fable is Fable, tells pi-modes the outcome through the bridge (planReviewed), marks round one spent for that plan (roundOneSpent), and blocks the call with the review. The agent edits or not and calls again; that call passes through to pi-modes, whose approval pane (packages/pi-modes/review-pane.ts) shows the plan, the latest review and the choices.

The agency rule (packages/pi-guidance/guidance/global.md, "Plan review is bounded") says round two is the human’s, "through a different vendor’s model (the agent cannot call one)". #70 was parked until a non-Anthropic model reached the reviewer bar. The #429 fill put Gemini 4 Argon there: 93 % plan recall at medium and 96 % at its #434 floor, every cross-file defect, no false flags, against Fable’s 89 % and 75 % cross-file. Of the plan defects Fable missed, an Argon round would be expected to catch about 80 % (#70, 2026-10-24 comment). The operator’s decision (2026-10-24): round two is Argon, and it is automatic.

The change

Round two runs inside the same pause, right after round one, before the block returns. The human sees both verdicts in the pane on the next call. Nothing new is asked of the agent, and the agent cannot call round two by itself: the pause runs it.

Who reviews round two. A fixed second reviewer: vertex-gemini/gemini-4-argon, at the level wantedThinking gives it for a plan (its #434 floor, high). It runs only when it is a different model from round one’s reviewer. An Argon author is reviewed by Argon in round one and gets no round two: there is no other measured vendor. The second reviewer is planSecondReviewer in gadhs-pi-workflow.json (workflow-config.ts), default Argon, "none" to turn round two off, validated like commitReviewer (#432): provider/id or the word, anything else refused at session start.

When round two is skipped. Round two needs round one’s text to have been reviewed, and it reads the same plan. It is skipped, and the debug log says why, when:

  • round one was interrupted (the human pressed escape: the whole pause is theirs);

  • round one came back unreviewed (the plan goes to the attempt bound as today; a second vendor reviewing what the first could not read is not a second opinion);

  • the second reviewer is round one’s reviewer, or "none".

Round two’s own failure is not an attempt: conclude is called for round one only. An unreviewed round two is told to the pane as a second record with verdict: "UNREVIEWED" and no attempt count, so the human sees "round two did not happen (reason)" and decides on round one alone. The block text says the same.

Escape during round two. The turn’s signal reaches both reviews. Escape during round two ends it as interrupted. Round one’s result is kept and told; round two is told as UNREVIEWED with "interrupted". The claim and the spent round stand, because round one did happen.

What the block says. The block is conclusion.reason from conclude (reflection-cycle.ts), which is round one’s outcome.text, and that text ends in PLAN_RETRY_INSTRUCTION (plan-review.ts, formatPlanReflection). Round two cannot be appended after it. So reviewPlan builds the block itself: round one’s text with the instruction cut from its tail (plan-review.ts exports the instruction, and a withoutRetryInstruction(text) helper beside it), then a line Second opinion by <reviewer> (round two): <VERDICT> and round two’s body (or Second opinion by <reviewer>: did not happen (<reason>)), then the instruction once, at the end. When round two is skipped, the block is round one’s text as today. The instruction’s words are unchanged; "this review" reads as both.

Failure posture. Round one keeps its posture: unreviewed blocks and counts an attempt, interrupted releases the claim. Round two is fail-open on the second opinion only: when it does not happen, the human is told so in the pane and the block, and decides on round one alone. Nothing is approved by the pause either way; approval stays the human’s choice in the pane (#190). A round two that fails silently is the risk, and the pane line is the guard: a round: 2 record is told for every round two that was started, reviewed or not.

What the pane shows. PlanReviewRecord gains a required round: 1 | 2; the two packages change on one branch and ship together, so there is no fallback for a record without it. pi-modes keeps the latest record per round for the cwd (PlanState.lastPlanReview becomes lastPlanReviews: { one?, two? }), both matched against the presented draft for edited. The pane’s review region shows one line per round: Cold review: CLEAN — claude-fable-5-1, 21 s and Second opinion: FLAGS — gemini-4-argon, 31 s. The document region appends round two’s body under its own seam after round one’s. paneLayout spends rows in the order choices, review, seam, legend, bottom, then the viewport; round two’s line is bought right after round one’s (review becomes a count, 0 to 2), so a short terminal still shows the choices and drops round two’s line before round one’s. The phone ask’s body (approvalAsk) carries both lines.

The guidance. global.md’s "Plan review is bounded" bullet: round one is the cold read on `exit_plan_mode, round two is a second vendor’s read that runs right after it, the next call presents the plan to the human with both reviews beside it, the human decides, there is no round three. The parenthetical "(the agent cannot call one)" goes: the agent still cannot, the pause does.

What is not done. No == Review log section in the draft: nothing in this repository’s plans or guidance uses the template’s section, and the debug log (plan_review.done with round) and the pane already carry the record. The commit guard’s plan check (#190) is unchanged: approval is still the human’s bytes.

Why inside the pause, not the pane

The pause already holds the registry, the signal, the snapshot budget and the announce/settle presence; running round two there is one more readPlan call. The alternative, pi-modes running it from the pane, needs pi-workflow to publish a function across the package boundary (ADR-004 forbids a runtime import either way) and a second place that knows how a plan review is run. Automatic round two has no pane interaction, so the pause is the only place it belongs.

Scope

pi-workflow

  • workflow-config.ts: planSecondReviewer: string, default DEFAULT_PLAN_SECOND_REVIEWER = "vertex-gemini/gemini-4-argon", PLAN_SECOND_REVIEWER_NONE = "none", validated by the commitReviewer rule generalised (readModelOrWord(v, path, key, word)), in KNOWN_KEYS.

  • reflection-review.ts: planReviewers(configured, authoring): { first: string; second: string | undefined } beside commitReviewers: first = chooseReviewer(authoring); second is the configured model unless "none" or equal to first.

  • runtime-bridge.ts: PlanReviewRecord.round: 1 | 2.

  • plan-review.ts: export PLAN_RETRY_INSTRUCTION and withoutRetryInstruction(text).

  • plan-pause.ts: reviewPlan runs round one as today (conclude, roundOneSpent, tellPane with round: 1); then, when round one is reviewed and second is defined, readPlan with the second reviewer, logged as plan_review.done with round: 2, told with round: 2, and the block built as described. Skips logged as plan_review.round_two_skipped with a reason. Function bodies stay under 40 lines: roundTwo(…​) and blockWithSecondOpinion(…​) helpers.

  • Tests, test/plan-review-pause.test.ts (behaviour): round two runs after a reviewed round one and the pane gets two records in order, each with its round; the block carries round one, the second opinion, and the retry instruction once, last; round two is skipped after an interrupted and after an unreviewed round one, and when the author is Argon; "none" turns it off; an unreviewed round two is told with no attempt and spends none (the identical retry passes to the human); escape during round two keeps round one and tells round two as interrupted. test/workflow-config.test.ts: the key’s default, "none", a model, refusals. test/reflection-review.test.ts: planReviewers. The bridge record is a wire format between two packages (ADR-004): its contract test is test/plan-review-pause.test.ts’s check of the exact record shape told, with `round required, beside pi-modes' test/session-wiring.test.ts routing of the same shape.

pi-modes

  • plan-tools.ts: lastPlanReviews per round; matchingPlanReview returns both; recordReview stores by record.round, required; onSessionStart clears both; `approvalAsk’s body names both.

  • review-pane.ts: ReviewPaneInput.review becomes reviews: { one?: PlanReviewSummary; two?: PlanReviewSummary }; reviewLine(summary, round); planLayout buys a second review row when round two is present; documentLines appends round two’s seam and body; the FLAGS colour applies per line.

  • Tests, test/review-pane.test.ts (behaviour): two lines rendered in order with the right wording; the layout at a height that fits one review line shows the choices and round one’s line, and drops round two’s first; the document carries both bodies; a FLAGS round two colours its own line. test/session-wiring.test.ts already routes planReviewed to recordReview and gains the round field in its record; a new test/plan-reviews.test.ts pins the store: records kept per round, a draft edited since either review marked on that review, both cleared at session start.

pi-guidance

  • guidance/global.md: the bullet rewritten as above. No test pins its wording (checked: nothing under packages/*/test matches it).

Docs and notes

  • docs/modules/ROOT/pages/modes.adoc: "Who reviews" gains a plan paragraph (round one the author’s model, round two Argon, when it is skipped, what the pane shows); the pane section names the second line.

  • docs/modules/ROOT/pages/tuning.adoc: planSecondReviewer beside commitReviewer.

  • CHANGELOG.adoc == Unreleased, under Changed: one entry.

  • #70: deferred label off when it lands (the human’s, through glab).

Out of scope

  • A == Review log section in drafts.

  • Round two on commits (#432 made Argon round one there).

  • A third vendor, or a pane choice to run another round.

  • Changing the attempt bound or the ledger.

Review-Context

packages/pi-workflow/plan-pause.ts, packages/pi-workflow/runtime-bridge.ts, packages/pi-workflow/reflection-review.ts (commitReviewers, chooseReviewer, wantedThinking), packages/pi-workflow/workflow-config.ts, packages/pi-modes/plan-tools.ts, packages/pi-modes/review-pane.ts, packages/pi-guidance/guidance/global.md.

Edit this page · latest