Fix #887: BUGFIX add pr gate (close v3.1.4 pr_ready timing gap)#888
Merged
Conversation
v3.1.4 PR #874 wired BUGFIX's pr_ready_for_human=true to the advanceProtocolPhase terminal-exit setter because BUGFIX had no `pr` gate. That set-point only fires when the builder calls `porch done` post-merge — by which point the human has already acted. BUGFIX PRs sat at `phase: pr, pr_ready_for_human: false` indefinitely, never surfacing in Needs Attention. This adds "gate": "pr" to BUGFIX's pr phase (same shape as AIR), so the canonical signal fires via the gate-request setter at the right moment — when CMAP completes and the PR is waiting for a reviewer. The BUGFIX-no-gate branches in advanceProtocolPhase, handleVerifyApproved, and isPrCreatingPhase are now redundant and removed; hasPrConsultation field dropped from ProtocolPhase. The derivePrReady BUGFIX fallback in overview.ts is intentionally left in place as graceful-degradation for in-flight v3.1.4 projects. Fixes #887
Contributor
Author
|
Approved. The diff is exactly what the issue scoped — gate added, Please merge with |
This was referenced May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
v3.1.4 (PR #874) added the canonical
pr_ready_for_humansignal but the BUGFIX-specific set-point was timing-wrong — it fired only when the builder callsporch donepost-merge, by which point the human has already acted. BUGFIX PRs sat atphase: pr, pr_ready_for_human: falseindefinitely and never surfaced in Needs Attention.This PR adds
"gate": "pr"to BUGFIX's pr phase (same shape as AIR) so the canonical signal fires via the gate-request setter — at the right moment, when CMAP finishes and the PR is waiting for a reviewer.Fixes #887
Root Cause
The setter design in #874 baked in a BUGFIX special case because BUGFIX had no
prgate. AIR's gate-request-time setter (index.ts:418) demonstrably gets the signal timing right; BUGFIX was wired to theadvanceProtocolPhaseterminal-exit setter (index.ts:453) instead, which only fires post-merge.Adding a
prgate to BUGFIX makes it semantically identical to AIR, so the gate-request setter handles it correctly.Fix
Protocol JSON (both copies, bumped to 1.2.0)
codev/protocols/bugfix/protocol.json+ skeleton — added"gate": "pr"to pr phasePorch code cleanup (BUGFIX-no-gate branches now redundant)
index.ts:advanceProtocolPhase— removed theadvancingFromPrPhasesnapshot and the two conditionalpr_ready_for_humansettersindex.tsdone() gate-request — simplifiedgate === 'pr' || isPrCreatingPhase(...)togate === 'pr'next.ts:handleVerifyApproved— same simplification, dropped the no-gate-advance pr-readiness logicnext.ts— removed the BUGFIX-specific terminal-state return (BUGFIX now follows AIR's merge-task path)protocol.ts:isPrCreatingPhase— collapsed tophase?.gate === 'pr'; JSDoc updatedprotocol.ts:normalizePhase— no longer computeshasPrConsultationtypes.ts:ProtocolPhase— removedhasPrConsultationfieldBuilder prompt
codev[-skeleton]/protocols/bugfix/prompts/pr.md— replaced "your work is done, architect takes over" with the new gate-driven flow: porch done → wait forporch approve <id> pr→ follow porch's emitted merge taskTests
pr-ready-872.test.ts— bumped BUGFIX fixture to v1.2.0 withgate: "pr"; rewrote BUGFIX cases to test the gate-request path (matching AIR); updated classifier describe block to reflect the single-marker invariant. RESEARCH false-classification regression tests preserved.next.test.ts— updated the BUGFIX-terminal-state test to assert the new merge-task emission and the approved-gate-on-terminal-state shape (was:gates: {}→ now:gates: { pr: approved })Docs
docs/releases/v3.1.4-jacobean.md— prepended a "Superseded by v3.1.5 (porch: BUGFIX should have a pr gate (closes the v3.1.4 pr_ready_for_human timing gap) #887)" callout to the section that introduced the BUGFIX-specific terminal-exit set-point. ThederivePrReadyBUGFIX-fallback inoverview.tsis left intact for graceful degradation of in-flight v3.1.4 BUGFIX builders (flagged for v3.2+ removal).Test Plan
pr-ready-872.test.tsBUGFIX cases now exercise the gate-request setter atindex.ts:486-493(the same path AIR uses)npx tscclean)derivePrReadyBUGFIX-fallback pathFlow After Fix
porch done <id>→ auto-requestsprgate, setspr_ready_for_human: true, PR surfaces in Needs Attentionporch approve <id> pr→ gate approved,pr_ready_for_human: falseporch done <id>→ advancespr→verified; the nextporch nextemits the merge taskThis matches AIR exactly.
Out of Scope
derivePrReadyBUGFIX-fallback inoverview.ts— left for graceful degradation of in-flight v3.1.4 projects (the issue body explicitly defers to v3.2+)codev/protocols/bugfix/protocol.mdlong-form workflow doc — not in the issue scope (still describes the manual "afx send LGTM merge it" flow that's redundant with the gate; can be updated in a follow-up)