Wire review as an implement-workflow stage: after gates, before PR open #268

Closed
opened 2026-10-27 13:35:38 +00:00 by sam · 0 comments
Owner

Sequence matters. The review runs after gates pass -- there is no point reviewing code that does not build or test -- and before the PR is opened, because the point is to not spend the operator's attention on a PR that is not ready. The slot is between StageDiffCap() and StageOpenPR() in internal/domain/workflow/implement.go.

A surviving CONFIRMED finding must not open a PR. Per CLAUDE.md, a finding that survives blocks closing the work; it does not get waved through.

LIFECYCLE CORRECTION (2026-08-25): this bead previously said "parks the task as waiting_human", which names two different states in the actual machine (internal/taskstate/taskstate.go:44-59). docs/prds/adversarial-self-review.md section 4 decided this: use store.StatusParked, following StageDiffCap's existing precedent (steps.go:91-94) -- a stage-computed policy stop with a Detail explaining why, before PR open. Parked's available actions, retry and abandon, are the right shape: fix the flagged code and retry, or abandon/override a false positive. WaitingHuman's approve/reject actions have no referent here because there is no PR yet to approve or reject.

Blocking is workflow.ReviewBlocking (shipped in h019.2): Verdict == confirmed AND Level == error. A PLAUSIBLE finding never blocks, however severe its level claims to be.

FAIL-CLOSED (decided 2026-08-25): a review that fails to RUN is distinct from a review that ran and found nothing, and it must not open a PR. A sub-agent that errors, is truncated, or produces no conclusion yields ReviewStatusNotRun, for which Passed() is false and Blocking() is also false -- the contract deliberately refuses to guess, and this stage resolves it as park. Rationale: Repo.ReviewEnabled is opt-in, so an operator who turned the gate on wants the gate, and a provider outage silently degrading into "PR opened unreviewed" is what they were buying protection against. Accepted cost: a transient model error parks a task, and Parked's retry action is the remedy. The park Detail must say the review did not run, never that it passed.

Scope to the implement workflow first. Routing to tdd/bootstrap/feasibility is a later decision -- feasibility in particular produces a document rather than a diff, so "review the diff" may not even apply.

Also adds to internal/config: Models["reviewer"] (falling back to Models["builder"], no schema change) and Repo.ReviewEnabled bool (default false).

Acceptance Criteria

An implement task with a clean gate and no confirmed findings opens a PR as it does today; one with a surviving confirmed finding parks as store.StatusParked with findings recorded in Detail and opens no PR; a review that fails to run also parks, with a Detail that says so rather than implying a pass; a warn-level or plausible finding does not block; the stage is observable in the task's running(workflow:stage) status and emits task events despite the nested run being non-streaming; retry after operator action re-runs the stage; the stage is inert unless Repo.ReviewEnabled is true.

Acceptance criteria

An implement task with a clean gate and no confirmed findings opens a PR as it does today; one with a surviving confirmed finding parks as waiting_human with findings recorded and opens no PR; the stage is observable in the task's running(workflow:stage) status; retry after operator action re-runs the review.

Close reason

StageReview wired into the implement workflow between StageDiffCap and StageOpenPR. Fail-closed: not-run or a confirmed error-level finding parks (store.StatusParked) with findings in Detail; warn/plausible findings never block. Inert unless Repo.ReviewEnabled (new config field, default false); Models["reviewer"] falls back to Models["builder"]. task check clean, golangci-lint clean. Committed 8db8a17.


Imported from beads archie-core-h019.4 · GitHub #549 · type feature · priority P1 · created 2026-08-21 · closed 2026-08-31

Sequence matters. The review runs after gates pass -- there is no point reviewing code that does not build or test -- and before the PR is opened, because the point is to not spend the operator's attention on a PR that is not ready. The slot is between StageDiffCap() and StageOpenPR() in internal/domain/workflow/implement.go. A surviving CONFIRMED finding must not open a PR. Per CLAUDE.md, a finding that survives blocks closing the work; it does not get waved through. LIFECYCLE CORRECTION (2026-08-25): this bead previously said "parks the task as waiting_human", which names two different states in the actual machine (internal/taskstate/taskstate.go:44-59). docs/prds/adversarial-self-review.md section 4 decided this: use store.StatusParked, following StageDiffCap's existing precedent (steps.go:91-94) -- a stage-computed policy stop with a Detail explaining why, before PR open. Parked's available actions, retry and abandon, are the right shape: fix the flagged code and retry, or abandon/override a false positive. WaitingHuman's approve/reject actions have no referent here because there is no PR yet to approve or reject. Blocking is workflow.ReviewBlocking (shipped in h019.2): Verdict == confirmed AND Level == error. A PLAUSIBLE finding never blocks, however severe its level claims to be. FAIL-CLOSED (decided 2026-08-25): a review that fails to RUN is distinct from a review that ran and found nothing, and it must not open a PR. A sub-agent that errors, is truncated, or produces no conclusion yields ReviewStatusNotRun, for which Passed() is false and Blocking() is also false -- the contract deliberately refuses to guess, and this stage resolves it as park. Rationale: Repo.ReviewEnabled is opt-in, so an operator who turned the gate on wants the gate, and a provider outage silently degrading into "PR opened unreviewed" is what they were buying protection against. Accepted cost: a transient model error parks a task, and Parked's retry action is the remedy. The park Detail must say the review did not run, never that it passed. Scope to the implement workflow first. Routing to tdd/bootstrap/feasibility is a later decision -- feasibility in particular produces a document rather than a diff, so "review the diff" may not even apply. Also adds to internal/config: Models["reviewer"] (falling back to Models["builder"], no schema change) and Repo.ReviewEnabled bool (default false). ## Acceptance Criteria An implement task with a clean gate and no confirmed findings opens a PR as it does today; one with a surviving confirmed finding parks as store.StatusParked with findings recorded in Detail and opens no PR; a review that fails to run also parks, with a Detail that says so rather than implying a pass; a warn-level or plausible finding does not block; the stage is observable in the task's running(workflow:stage) status and emits task events despite the nested run being non-streaming; retry after operator action re-runs the stage; the stage is inert unless Repo.ReviewEnabled is true. ### Acceptance criteria An implement task with a clean gate and no confirmed findings opens a PR as it does today; one with a surviving confirmed finding parks as waiting_human with findings recorded and opens no PR; the stage is observable in the task's running(workflow:stage) status; retry after operator action re-runs the review. ### Close reason StageReview wired into the implement workflow between StageDiffCap and StageOpenPR. Fail-closed: not-run or a confirmed error-level finding parks (store.StatusParked) with findings in Detail; warn/plausible findings never block. Inert unless Repo.ReviewEnabled (new config field, default false); Models["reviewer"] falls back to Models["builder"]. task check clean, golangci-lint clean. Committed 8db8a17. --- _Imported from beads `archie-core-h019.4` · GitHub #549 · type feature · priority P1 · created 2026-08-21 · closed 2026-08-31_
sam added the highfeature labels 2026-10-27 13:35:38 +00:00
sam self-assigned this 2026-10-27 13:35:38 +00:00
sam closed this issue 2026-10-27 13:35:38 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#268