docs: forbid agents from bypassing branch protection with admin rights - #6
Merged
Conversation
master requires a PR, 1 review, and 4 status checks, but enforce_admins is false — so a plain `git push origin master` as the owner succeeds and only reports "Bypassed rule violations" afterwards. No --force, no prompt. An agent could do this without ever tripping a guardrail, so the prohibition has to be written down. Placed at the top of AGENTS.md as a hard rule, covering direct pushes, `gh pr merge --admin`, force-pushes to protected branches, and editing protection settings to make a push possible. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QuvnD4UizJeQGJSe4ME6rK
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the repository’s agent guidance by adding an explicit “Hard rules” section to AGENTS.md, clarifying that agents must not use owner/admin capabilities to bypass branch protection and must follow the normal PR-and-checks merge path.
Changes:
- Adds a top-level “Hard rules” section forbidding direct pushes/force pushes to protected branches and admin-bypass merges.
- Documents the specific “enforce_admins: false” scenario where a normal
git push origin mastercan still succeed for the owner, and treats it as forbidden for agents.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a Hard rules section at the top of
AGENTS.md.Why
masteris protected — PR required, 1 approving review, 4 required status checks — butenforce_adminsisfalse. A plaingit push origin masteras the owner therefore succeeds, and GitHub only reportsBypassed rule violationsafter the fact. There is no--forceand no prompt, so an agent can bypass protection without ever tripping a guardrail. That happened in this repo on 2026-07-25 when I pushed asteve-opsworkflow fix straight tomaster.A rule phrased around
--forcewould not have prevented it, so the wording targets the actual mechanism.What it forbids without an explicit in-the-moment instruction
masteror anyrelease/*branchgh pr merge --admin, or any merge skipping required reviews or checksgit push --force/--force-with-leaseto protected branchesenforce_adminsto make a push possibleThe required path is branch → PR → green checks → owner merges. If blocked, stop and report rather than route around it.
🤖 Generated with Claude Code
https://claude.ai/code/session_01QuvnD4UizJeQGJSe4ME6rK