Skip to content

task finish is refused by gh pr merge's client-side BLOCKED check even when the caller holds the ruleset bypass GitHub would honour #392

Closed

Description

@davison

What happened

gh codecrew task finish <ref> (v2.1.0) passed every gate in --dry-run ("bypass actor: not applicable") and then failed in the live run with gh pr merge's client-side refusal:

codecrew: gh pr: X Pull request radiusred/tradedesk-marketdata#88 is not mergeable: the base branch policy prohibits the merge.
To have the pull request merged after all the requirements have been met, add the `--auto` flag.
To use administrator privileges to immediately merge the pull request, add the `--admin` flag.

The PR was approved and its CI green; mergeStateStatus was BLOCKED because an org-level ruleset (require-lint) names a required status check ("Lint commit messages") that this repository has no workflow for. The caller was the implementer App, which is that ruleset's Integration bypass actor. gh pr merge never asked GitHub: it reads BLOCKED and refuses locally. Earlier the same day, for housekeeping PRs in the same state, gh api -X PUT repos/{owner}/{repo}/pulls/{n}/merge -f merge_method=rebase -f sha=… under the same App token merged cleanly — GitHub evaluated the bypass and allowed it.

So task finish has a gap between its own gates (which all passed, correctly) and the merge call it makes: the CLI's client-side policy check is stricter than GitHub's, and the only flags it offers past it are --admin (which the protocol forbids a crew identity) and --auto.

Proposed

  • task finish merges through the REST merge endpoint (or gh pr merge only when mergeStateStatus is CLEAN), so GitHub decides, and a ruleset bypass the caller legitimately holds is honoured. The dry run's "bypass actor" gate could also report when the caller holds a ruleset bypass that the merge will rely on, so it is visible in the record.
  • Separately, the gates could pre-empt the situation: when a required status check named by a branch policy has never reported on the PR, say so as a note: in task start/task finish --dry-run (sibling of A hub scaffolded by init cannot finish its first task (NO_CHECKS): say so at init, or scaffold a reporting workflow #391's NO_CHECKS point) — the right fix in our case was to add the missing workflow to the repo, and knowing earlier would have saved a round.

Observed 2026-10-09 on radiusred/tradedesk-marketdata#88 (task #87); the fix in the repo is chartered as a task to add the workflow.

Activity

  1. added
    bug
    on Oct 9, 2026
  2. davison commented on Oct 10, 2026

    @davison
    ContributorAuthor

    Adopted by #395 — this issue is delivered as that task, and gh codecrew task finish closes it when the task's pull request merges (SPEC §4). The PR needs no Closes line for it.

  3. radiusred-cody commented on Oct 10, 2026

    @radiusred-cody
    Contributor

    Closed by gh codecrew task finish 395: adopted by #395 and delivered by #405, merged as 16f1f0d.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions