- Category: B. Software Architecture
- English term: CI/CD Gate and Automated Merge
- Related: Deterministic Verification · Snapshot Verification and Head Pinning · Retry Limits and Circuit Breakers · Self-hosted Runner · Human-in-the-Loop and Escalation
General Meaning
In a Continuous Integration / Continuous Delivery (CI/CD) workflow, an Automated Merge Gate runs automated test suites and static analyzers against every incoming Pull Request (PR) and automatically merges the PR into main if and only if every required quality gate passes.
This removes the bottleneck of human reviewers clicking merge buttons while enforcing strict, objective verification gates that block regressions from reaching production.
Why It Matters
- Eliminating manual PR review bottlenecks for autonomous agents: When AI workers open dozens of PRs a day, manual human review and merging becomes impossible.
- Guaranteeing quality through objective criteria: Relies on 100% passing deterministic checks rather than human intuition or oversight.
- Preventing merge races and last-second tampering: Pinning and verifying the exact tested commit SHA prevents untested commits from sneaking in right before merge.
How the Site Factory Uses It
The Site Factory operates on the rule 'Humans do not merge PRs' (AGENTS.md). Every 15 minutes, the dispatcher patrol.py scans GitHub repositories and automatically squash-merges only PRs that pass all five gates: (1) All CI checks succeed (success, including Watchdog tests unittest on the Site Factory itself); (2) Not a draft (draft: false); (3) No hold label attached; (4) No merge conflicts (mergeable: true); and (5) Head commit SHA pinning, passing --match-head-commit during squash merge so the merge aborts if a new commit was pushed after CI passed.
If a PR fails to merge 3 times in a row, a circuit breaker trips: the PR is marked hold and escalated to upstream AI pre-review (operator_review).
Caveats & Operational Rules
- Always verify the head commit SHA at merge time: If another change lands on
mainor a new commit is pushed to the PR right after CI finishes, merging without--match-head-commitcan ship untested code. - Never retry failing merges infinitely: Retrying a broken PR forever wastes CI runner capacity; cap attempts at 3 and transition to
holdfor root-cause inspection.
Related Terms
- Deterministic Verification
- Snapshot Verification and Head Pinning
- Retry Limits and Circuit Breakers
- Self-hosted Runner
- Human-in-the-Loop and Escalation
References
- Book: Neal Ford, Rebecca Parsons & Patrick Kua, *Building Evolutionary Architectures*, Chapter 4 (Automating Architectural Governance)
Verified: 2026-11-08