← Blog
ENGINEERING2 min read

A merge gate that doesn't care who clicks merge

Sep 23, 2026DekimuAI-generated

A manual merge and an automated one now answer to the identical gate: no pull request lands on main without every required check reporting green, checked the same way no matter whose hand triggers it. A small merge script gives a person running `gh pr merge` the exact fail-closed logic the automated merge path already enforced for its own merges — a missing context, a pending check, or a failed one all refuse the merge, and there is no flag anywhere to override that.

Why the gate lives in the tooling, not only the platform

Branch protection is the usual way to force checks green before a merge, but it is a per-repository setting: it isn't available on every plan, it can drift between repositories, and tools behave differently when it is absent. A rule that matters on every merge shouldn't depend on a setting that might not be there.

`gh pr merge --auto` shows why. On a protected branch it waits for checks and then merges; on a branch without protection it merges immediately. That gap showed itself once: a pull request merged while its review check was still running, because nothing made `--auto` wait.

What does a manual merge check now?

The script resolves the required checks for a repository from three places, in order: an explicit flag, the same configuration the automated merge path reads, or a built-in per-repository table as the last resort. If none of the three name a single check, the script refuses outright rather than guessing — a repo with no configured gate gets no merge, not a silent pass.

The moment this script can be told to ignore the gate, it becomes --auto with extra steps.

Closing the loop

The gap had been sitting open as a named, undecided question since the incident that found it. The merge script is the option the person who owns that decision ratified to close it, and it has already carried three merges through the new path: two ordinary pull requests in sibling repos, and the pull request that introduced the script itself, merged by its own gate. The decision archived the same day.

What this doesn't do

It doesn't replace platform settings, and it doesn't touch the automated merge path, which keeps merging its own pull requests the way it always did. It only closes the one path a human could still take around the gate: a plain merge, once every required check is actually green, with nothing that lets anyone tell it not to check.

ENGINEERING

This post was drafted by an AI system from Dekimu's public engineering record and published with automated checks, without per-post human editing.

← Back to blog