Skip to content

[Bugfix #966] derivePrReady ignores merged → merged-but-gate-pending builder vanishes#980

Merged
waleedkadous merged 9 commits into
mainfrom
builder/bugfix-966
Jun 3, 2026
Merged

[Bugfix #966] derivePrReady ignores merged → merged-but-gate-pending builder vanishes#980
waleedkadous merged 9 commits into
mainfrom
builder/bugfix-966

Conversation

@waleedkadous
Copy link
Copy Markdown
Contributor

Summary

Fixes #966

A builder whose PR is merged but whose porch pr gate is still pending silently vanished from the dashboard's Needs Attention view — and from the whole Work surface.

Root Cause

derivePrReady in packages/codev/src/agent-farm/servers/overview.ts only checked the gate shape:

return parsed.gates['pr'] === 'pending' && !!parsed.gateRequestedAt['pr'];

It never considered that the PR had already merged, so a merged-but-gate-still-pending builder read as prReady: true. NeedsAttentionList.buildItems then suppressed the builder row (if (b.prReady) continue;) on the assumption the PR would surface via the open-PR (pendingPRs) path — but a merged PR lives in recentlyClosed, never pendingPRs, so no PR row was ever emitted. Neither path surfaced the builder → it disappeared permanently.

Fix

overview.ts only (the issue's prescribed fix — no NeedsAttentionList change needed):

  1. parseStatusYaml now parses a merged boolean from the last entry of status.yaml's pr_history. Last-entry semantics are deliberate: the most-recent PR is the one the current pr gate was requested for, so a SPIR/PIR checkpoint flow (an earlier merged PR + a later still-open PR awaiting review) correctly reads as not merged.
  2. derivePrReady now returns false once that PR is merged (... && !parsed.merged).

Once prReady is false, the builder is no longer suppressed; its still-pending pr gate surfaces it via the gate-row path (detectBlocked"PR review"). Verified end-to-end in a test.

Test Plan

  • Added regression tests (8) — all green:
    • parseStatusYaml: parses merged: true/false, defaults to false when pr_history absent, and reflects the last entry (checkpoint: earlier-merged + later-open → not merged; and later-entry-with-no-merged-key → not merged).
    • derivePrReady: merged + pending gate → false; not-merged + pending gate → true.
    • End-to-end repro of the Needs Attention: merged PR with still-pending pr gate vanishes (derivePrReady ignores merged) #966 shape: builder reads prReady: false and surfaces via detectBlocked → "PR review" (no longer vanishes).
  • Verified fix locally (porch check: build + full test suite pass)
  • Existing tests pass; tsc --noEmit clean

Note on the dependency bump

This branch also bumps better-sqlite3 ^12.5.0 → ^12.10.0 (separate commit). It's a prerequisite to run the test suite under node v26: 12.9.0 has no node-26 (ABI 147) prebuilt and falls back to a node-gyp compile that fails on a missing CLT pkg receipt; 12.10.0 ships a v147 prebuilt so pnpm install downloads it (no compile). Architect-authorized.

Out of scope (separate concern, per the issue)

Porch leaving the pr gate pending after recording merged: true (never advancing the gate / requesting verify-approval) is a porch state-machine inconsistency that deserves its own issue. This PR only fixes the surfacing false-positive.

…ding builder vanishes

A builder whose PR is merged but whose porch `pr` gate is still `pending`
silently disappeared from the dashboard Needs Attention view and the whole
Work surface. `derivePrReady` only checked the gate shape (pending +
requested_at), so a merged PR still read as `prReady: true`. NeedsAttentionList
then suppressed the builder row (expecting an open-PR row instead), but a merged
PR lives in recentlyClosed, never pendingPRs, so no PR row was ever emitted.

Fix (overview.ts):
- Parse the `merged` boolean from status.yaml's `pr_history` (last entry — the
  PR the current `pr` gate was requested for; last-entry semantics keep
  SPIR/PIR checkpoint multi-PR flows correct).
- `derivePrReady` now returns false once that PR is merged.

Once `prReady` is false the builder is no longer suppressed; its still-pending
`pr` gate surfaces it via the gate-row path (detectBlocked → "PR review"). No
NeedsAttentionList change required.

Adds 8 regression tests (parseStatusYaml merged parsing incl. last-entry
checkpoint case; derivePrReady merged→false; end-to-end repro of the #966 shape).
…prebuilt)

Prerequisite for running the test suite under node v26. better-sqlite3 12.9.0
ships no prebuilt for node 26 (NODE_MODULE_VERSION 147) and falls back to a
node-gyp compile that fails on this machine (missing CLT pkg receipt). 12.10.0
provides a v147 prebuilt, so `pnpm install` downloads it (no compile, no CLT) and
the full suite — including the new #966 regression tests — runs green.

Architect-authorized unblock.
@waleedkadous
Copy link
Copy Markdown
Contributor Author

CMAP Review (3-way) — all APPROVE

Model Verdict Confidence Key issues
Gemini ✅ APPROVE HIGH None
Codex ✅ APPROVE HIGH None
Claude ✅ APPROVE HIGH None

Consensus: Clean, focused fix in overview.ts; excellent regression coverage (incl. last-entry pr_history semantics protecting SPIR/PIR checkpoint flows and an end-to-end repro proving the builder surfaces via the gate row instead of vanishing). Full suite green; tsc clean.

One non-blocking note (Claude) — the end-to-end test comment named an external adopter's workspace. Addressed in 61333c38 (scrubbed per the project's adopter-anonymization policy).

@waleedkadous waleedkadous merged commit 4e5acb8 into main Jun 3, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Needs Attention: merged PR with still-pending pr gate vanishes (derivePrReady ignores merged)

1 participant