Skip to content

docs: forbid agents from bypassing branch protection with admin rights - #6

Merged
kazo0 merged 1 commit into
masterfrom
docs/agent-hard-rules
Jul 27, 2026
Merged

docs: forbid agents from bypassing branch protection with admin rights#6
kazo0 merged 1 commit into
masterfrom
docs/agent-hard-rules

Conversation

@kazo0

@kazo0 kazo0 commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Adds a Hard rules section at the top of AGENTS.md.

Why

master is protected — PR required, 1 approving review, 4 required status checks — but enforce_admins is false. A plain git push origin master as the owner therefore succeeds, and GitHub only reports Bypassed rule violations after the fact. There is no --force and 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 a steve-ops workflow fix straight to master.

A rule phrased around --force would not have prevented it, so the wording targets the actual mechanism.

What it forbids without an explicit in-the-moment instruction

  • pushing directly to master or any release/* branch
  • gh pr merge --admin, or any merge skipping required reviews or checks
  • git push --force / --force-with-lease to protected branches
  • changing branch protection, rulesets, or enforce_admins to make a push possible

The 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

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
Copilot AI review requested due to automatic review settings July 25, 2026 13:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 master can still succeed for the owner, and treats it as forbidden for agents.

@kazo0
kazo0 merged commit 27bbd55 into master Jul 27, 2026
5 checks passed
@kazo0
kazo0 deleted the docs/agent-hard-rules branch July 27, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants