Repository navigation
Description
Context
PR #844 (shipped in v3.1.3) tried to gate the dashboard's Needs Attention list on "CMAP done, PR ready for human review". The check it used — b.blocked === 'PR review' — was a derivation that worked for protocols with an explicit pr gate (SPIR/ASPIR/PIR/AIR) but silently failed for BUGFIX (no pr gate, transitions straight to phase: verified after CMAP).
The underlying issue is that "CMAP complete for the PR-creating phase" has one true definition in porch's state machine but two different surface manifestations today, depending on whether the protocol's PR-creating phase carries a gate. Anyone consuming "is this PR ready for a human" has to know the protocol-specific derivation, and the only way to find out you got it wrong is to ship a regression (which we did).
This issue proposes making the signal canonical: porch writes an explicit pr_ready_for_human: true to status.yaml when it transitions out of the CMAP-emitting state for the PR-creating phase, regardless of whether the protocol uses a gate. Consumers (Needs Attention filter, VS Code extension, future dashboards) read one boolean.
A parallel bug ([linked issue for the B path]) covers the immediate filter-side patch in overview.ts as a fast fix; this issue tracks the canonical state-machine change.
Design questions for the spec/plan
These are the questions that motivate using PIR rather than BUGFIX/AIR — they want pre-PR review:
-
Field name and shape.
pr_ready_for_human: booleanis the narrowest framing. Broader alternatives:cmap_complete: boolean(covers any CMAP-emitting phase, not just PR phases) or a typed enumpr_state: 'no-pr' | 'cmap-running' | 'cmap-complete' | 'merged'. Each has different consumer implications. -
Per-phase vs single boolean. Some protocols have multiple CMAP-emitting phases (SPIR's
specify,plan,review). Do we set the flag only for the PR-creating phase, or maintain a per-phase map? The Needs Attention use case wants only "PR-creating phase done", so per-phase may be overkill — but other consumers might want richer state. -
Re-iter handling. When CMAP returns
REQUEST_CHANGESand porch enters the rebuttal cycle, doespr_ready_for_humango back to false until the next iteration's CMAP completes? (Yes — it should reflect current state, not "ever was complete.") -
Identification of the CMAP-emitting phase. Today the consultation block lives in the phase definition (e.g. BUGFIX's
prphase hasconsultation.on: 'review'). Does porch infer the PR-creating phase from the consultation block presence, or do we add an explicitis_pr_phase: truemarker to protocol.json? The former is cheaper and works retroactively; the latter is more explicit and lets a protocol have CMAP without it being PR-creating. -
Backward compat. Existing in-flight projects (status.yaml without the new field) need a fallback. The simplest: if the field is absent, fall back to the current derived logic (
blocked === 'PR review' || (phase === 'verified' && has_open_pr)). This lets us ship the canonical signal without forcing a migration on every running builder. -
Surface change in
OverviewBuilder. AddprReady: booleanderived from the new status.yaml field (with the v3.1.3 fallback). The Needs Attention filter consumes only this field.
Acceptance criteria
-
status.yamlgains apr_ready_for_human: booleanfield (or whichever shape the plan settles on). - Porch sets it to
truewhen transitioning out of the CMAP-emitting state for the PR-creating phase, for ALL protocols (SPIR, ASPIR, PIR, AIR, BUGFIX). - Porch sets it back to
false(or removes the field) when entering the rebuttal cycle onREQUEST_CHANGES. -
OverviewBuilder.prReadyis computed from this field with a fallback for legacy state files lacking the field. -
NeedsAttentionList.tsxgates onprReadyalone, no protocol-specific derivation. - Tests: each of the five protocols gets a porch-state test verifying the field's lifecycle.
- Migration note: in-flight projects on v3.1.x continue working (fallback to current derived logic until they reach the CMAP-done state under the new code).
References
- The regression that motivated this: PR Needs Attention surfaces PRs before CMAP reviews finish #844 / PR [Issue #846] Remove codev-wrapped agent-farm invocations #847 / issue porch: max_iterations enforcement is dead code (getMaxIterations has zero callers) #870-adjacent (Needs Attention shipped excluding BUGFIX PRs in v3.1.3)
- Existing derivation in
packages/dashboard/src/components/NeedsAttentionList.tsx:42-100 - Porch state machine:
packages/codev/src/commands/porch/next.ts - BUGFIX protocol (no
prgate):codev-skeleton/protocols/bugfix/protocol.json - AIR protocol (has
prgate):codev-skeleton/protocols/air/protocol.json
Activity
waleedkadous commentedon May 26, 2026
On it! Working on this with the PIR protocol (plan + dev-approval gates before PR).
waleedkadous commentedon May 26, 2026
On it! Working on a fix now.
[Bugfix #872] Fix: emit canonical pr_ready_for_human signal across al…
[Bugfix #872] Test: pr_ready_for_human lifecycle across all five prot…
[Bugfix #872] thread: situational-awareness log for the cohort
[Bugfix #872] iter-2: narrow isPrCreatingPhase + fix BUGFIX builder f…
[Bugfix #872] iter-2 tests: pin RESEARCH false-classification + reali…
[Bugfix #872] thread: iter-2 architect CMAP findings + resolution
Merge pull request #874 from cluesmith/builder/bugfix-872