GitHub connector: add effective branch rules and policy-guarded merge
Open 💬 0 comments Opened Aug 5, 2026 by nikoisthebest
Summary
The GitHub connector exposes useful PR, status, workflow, review, thread, auto-merge, and expected-head merge operations, but it does not expose the effective branch policy that governs a merge. A client therefore cannot safely distinguish “no requirements configured” from “requirements unknown or not queried,” and an admin-authenticated direct merge may bypass policy.
Please add a server-side, fail-closed guarded merge surface so deterministic automation can merge without treating model text or caller booleans as policy evidence.
Requested operations
github_get_effective_branch_rules
Inputs:
repository_full_namebranch
Behavior:
- Read all active rules applying to the branch, including parent/repository rulesets and legacy branch protection.
- Complete pagination before returning success.
- Normalize required checks, required reviews, code-owner and last-push requirements, conversation resolution, merge-queue state, bypass applicability, and unknown rule types.
- Return bounded
query_complete, observation timestamps, and a deterministic snapshot digest. - Fail closed on partial, unknown, or contradictory policy.
github_policy_guarded_merge
Inputs:
repository_full_namepr_numberexpected_head_shaexpected_base_shaexpected_merge_tree_shamerge_methodpolicy_snapshot_digest
Behavior:
- Refresh PR identity, effective branch rules, required checks, reviews, review threads, mergeability, base/head SHAs, and prospective merge tree in one bounded server-side operation.
- Reject incomplete, unknown, stale, pending, skipped, conflicting, or changed state.
- Never use admin/force bypass; bypass must be fixed to false rather than caller-controlled.
- Enforce expected head and compare expected base and merge tree before delivery.
- Perform at most one merge attempt.
- Return a typed outcome suitable for read-only reconciliation after an unknown delivery result.
- Verify the resulting default-branch tree after success.
An exact-head auto-merge operation would also help, but it should expose expectedHeadOid and retain the same policy refresh and no-bypass requirements.
Acceptance criteria
- Empty check/review collections pass only when effective policy proves their required counts are zero.
- Unknown rule types fail closed.
- Head/base/tree/policy drift is rejected.
- Admin-authenticated callers cannot silently bypass rules.
- Responses are structured, bounded, and contain no credentials or unrelated repository content.
- The final merge result is verified against the exact expected tree.