Skip to content

fix(github-sdlc-planning): make query-pipeline's --admin retry reachable when only approval is missing - #327

Merged
zircote merged 1 commit into
mainfrom
fix/326-merge-settled-gate-approval-only
Jul 19, 2026
Merged

fix(github-sdlc-planning): make query-pipeline's --admin retry reachable when only approval is missing#327
zircote merged 1 commit into
mainfrom
fix/326-merge-settled-gate-approval-only

Conversation

@zircote

@zircote zircote commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Closes #326

Bug

mergeStage's JS guard short-circuited on dev.settle.settled !== true
before the merge agent (and #306's --admin-retry authorization) was ever
invoked. Per #305, check_pr_readiness correctly reports settled: false
when the ONLY blocker is a missing approval (checks green, threads
resolved, reviewDecision: REVIEW_REQUIRED — Copilot can only leave
COMMENTED, never APPROVED). That is exactly the condition #306's retry
exists to handle, but the guard treated it identically to any other
unsettled reason and returned the generic 'not settled — automerge skipped' string without ever reaching the agent — leaving --automerge
silently non-functional for the org's most common branch-protection shape.

Fix

  • SETTLE_SCHEMA gains a structured blockedOnApprovalOnly: boolean,
    derived deterministically by the settle-stage agent from its own
    check_pr_readiness read — never inferred from notes text after the
    fact.
  • mergeStage's JS guard now invokes the merge agent when either
    settled is true or blockedOnApprovalOnly is true; every other
    unsettled reason (failing/pending checks, unresolved threads,
    CHANGES_REQUESTED, open code-scanning alerts) still skips the agent
    entirely, unchanged.
  • The merge agent's own re-verification step mirrors the same
    distinction (state can change between stages), so it doesn't stop on a
    stale settled: true requirement that would otherwise reintroduce the
    same bug one level down.
  • SKILL.md updated to describe the new field and the merge-stage
    reachability it restores.

Tests

New query-pipeline-workflow-merge.test.ts executes the real,
currently-shipped workflow file body (same technique as the existing
gdlc#307 guard test) and proves:

  • the merge agent IS reached when settled: false + blockedOnApprovalOnly: true
  • the merge agent is still skipped when settled: false + blockedOnApprovalOnly: false
  • the merge agent is still reached when fully settled: true
  • automerge: false still skips the merge agent regardless of blockedOnApprovalOnly

Verified the new test fails against the pre-fix guard logic (reverted
locally, re-ran, restored) before finalizing, per the "bug fix isn't done
without a test that fails before and passes after" convention.

Gates run locally

  • npm run lint — clean
  • npm run typecheck — clean
  • npx vitest run — 603/603 passed (mcp-server package)
  • npm run build — clean
  • markdownlint-cli2 on the touched SKILL.md — clean

…ble when only approval is missing (#326)

mergeStage's JS guard short-circuited on `dev.settle.settled !== true` before
the merge agent (and #306's --admin-retry authorization) was ever invoked.
Per #305, check_pr_readiness correctly reports settled:false when the ONLY
blocker is a missing approval (checks green, threads resolved, reviewDecision
REVIEW_REQUIRED — Copilot can only COMMENT, never APPROVE). That is exactly
the condition #306's retry exists to handle, but the guard treated it the
same as any other unsettled reason and returned a generic "not settled —
automerge skipped" without ever reaching the agent.

settleStage now derives a structured `blockedOnApprovalOnly` field
deterministically from its own check_pr_readiness read, distinct from
string-matching notes after the fact. mergeStage's guard now invokes the
merge agent when either settled is true or blockedOnApprovalOnly is true,
and the merge agent's own re-verification step mirrors the same distinction
so it doesn't stop on stale state. All other unsettled reasons (failing or
pending checks, unresolved threads, CHANGES_REQUESTED, open code-scanning
alerts) still skip the merge agent entirely, unchanged.

Adds regression coverage executing the real workflow file body (same
technique as the existing gdlc#307 guard test) proving the merge agent is
reached for the approval-only case and still skipped for a genuine blocker.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a reachability bug in the github-sdlc-planning query-pipeline workflow where the merge-stage guard prevented the merge agent (and its --admin retry authorization) from running when the only remaining blocker was a missing approving review.

Changes:

  • Adds a structured blockedOnApprovalOnly boolean to the settle-stage output schema so the workflow can distinguish “approval-only blocked” from other unsettled states without string-matching notes.
  • Updates mergeStage to invoke the merge agent when either settled === true or blockedOnApprovalOnly === true, while preserving the existing skip behavior for all other unsettled reasons.
  • Adds a new unit test that executes the real shipped workflow body to prevent regressions in merge-stage reachability logic; updates SKILL.md documentation accordingly.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
plugins/github-sdlc-planning/skills/query-pipeline/SKILL.md Documents the new blockedOnApprovalOnly settle signal and the restored merge-stage behavior/authorization semantics.
plugins/github-sdlc-planning/skills/query-pipeline/scripts/query-pipeline.workflow.js Extends SETTLE_SCHEMA, updates settle-stage instructions, and fixes mergeStage guard + merge-agent re-verification semantics for approval-only blocks.
plugins/github-sdlc-planning/mcp-server/test/unit/query-pipeline-workflow-merge.test.ts Adds regression coverage proving the merge agent is reachable for the approval-only unsettled shape and still skipped for other unsettled cases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zircote
zircote merged commit 44d30fe into main Jul 19, 2026
36 checks passed
@zircote
zircote deleted the fix/326-merge-settled-gate-approval-only branch July 19, 2026 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

query-pipeline mergeStage's settled-gate makes #306's --admin retry unreachable whenever the blocker is exactly missing-approval

2 participants