Skip to content

fix(guardrails): fail block-unresolved-pr-merge closed when it cannot resolve the merge target #8598

Closed

Description

@kyle-sexton

Problem

block-unresolved-pr-merge (guardrails) fails open when it cannot resolve which pull request a gh pr merge targets. When the repository or PR number reaches the command through a shell variable or substitution, the hook prints that it "could not check this pull request ... so this merge will run unchecked" and lets the merge run. The unresolved-thread, change-request and failing-check gate is then skipped entirely.

A safety gate that any $R or $n bypasses lets a steered agent skip the thread and check gate at will.

Evidence (2026-10-20, overnight run)

  • A session merged a PR with the repository passed as a shell variable (-R $VAR shape). The hook could not resolve it and let the merge through unchecked. The session had verified threads, checks and statuses by hand just before, so nothing unsafe landed; the action is recorded in the overnight audit log.
  • Earlier the same night, a merge written inside a shell loop with the PR number as a loop variable ($n shape) produced the same "will run unchecked" notice.

Fix

An unresolvable target must fail closed: refuse the merge with a message telling the caller to write the repository and PR number literally (-R owner/repo <number>).

Acceptance criteria

  1. A gh pr merge whose repository or PR number the hook cannot resolve to a literal value is refused, and the refusal message names the literal form to use.
  2. Stay-quiet (must still pass through to the normal check): the literal form gh pr merge 123 -R melodic-software/x --squash --match-head-commit <sha>, plus the URL and branch-name target forms if the hook supports them today.
  3. Stay-loud (must be refused): -R $R, -R ${R}, a number from $(...), a number from backticks, and a bare gh pr merge with no resolvable target.
  4. Tests for criteria 2 and 3 land with the change, per the hook-precision convention (docs/conventions/hook-precision/README.md): each stay-loud case fails before the fix.

Notes

  • Merges that need a loop must write each command literally.
  • Security review: GitHub Security & Cost passes the PR before merge.
  • Priority: medium (Security & Cost).

Activity

  1. added
    needs-triage
    on Oct 20, 2026
  2. added
    status: confirmed
    and removed
    needs-triage
    on Oct 20, 2026
  3. added theissue type on Oct 20, 2026
  4. github-actions commented on Oct 20, 2026

    @github-actions
    Contributor

    Thanks for the report. Automated triage handed this issue to a maintainer.

    Proposed work class: work-class: scoped
    Basis: automated intake triage; a maintainer confirms or changes it.

    Automated triage. A maintainer reviews it.

  5. added
    needs-human
    on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-humanstatus: confirmed

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions