Skip to content

Allow ordinary pushes to a PR branch while its auto-merge is armed - #2028

Merged
BigSimmo merged 19 commits into
mainfrom
claude/pr-auto-merge-safety-tpxupu
Aug 17, 2026
Merged

Allow ordinary pushes to a PR branch while its auto-merge is armed#2028
BigSimmo merged 19 commits into
mainfrom
claude/pr-auto-merge-safety-tpxupu

Conversation

@BigSimmo

@BigSimmoBigSimmo commented Aug 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • Narrow scripts/guard-push.mjs's auto-merge guard from "block any push to a PR branch whose auto-merge is armed" to "block only a force-push (history rewrite) to that branch." An ordinary fast-forward commit/push is now allowed through (with a warning note): GitHub re-validates required checks against the new head before it will merge, so an additive push cannot make it merge something that was never validated. A force-push while armed is the genuinely unsafe case — it can discard the commit GitHub already validated or is mid-evaluating — so that still hard-blocks with no override, matching the guard's existing no-override design for this check.
  • Add isForcePushRange / forcePushedBranchNames helpers to scripts/guard-push.mjs (ancestry-based force-push detection, reusing the same fast-forward logic the drift/static guards already rely on) and update autoMergeVerdict / autoMergeGuard to take a force-push flag into account.
  • Update the policy prose in AGENTS.md (Run PR shortcut guardrails, PR bundling, and the anti-conflict/CI-speed section), .claude/skills/run-pr/SKILL.md, .claude/skills/handoff/SKILL.md, and .cursor/agents/pr-babysit.md to match: auto-merge state remains user-owned (automation still never disables/re-enables it), but ordinary pushes, review-thread fixes, and main-sync pushes are no longer described as "mutation-frozen" while auto-merge is armed — only a force-push or base/target change is.
  • Extend tests/guard-push.test.ts with coverage for the new fast-forward-vs-force-push verdict split and the isForcePushRange/forcePushedBranchNames helpers (using the existing git-fixture pattern already used for the drift-guard force-push test). The existing "manual auto-merge ownership policy" meta-test (which asserts every listed policy doc still says auto-merge state is user-owned and must not be disabled) still passes unchanged.

Verification

  • npm run verify:pr-local — full run, all stages completed, zero failures: Test Files 635 passed (635), Tests 6775 passed | 4 skipped (6779); summary line failed: (none), not reached: (none).
  • node scripts/run-vitest.mjs run --reporter=dot tests/guard-push.test.ts (targeted, before the full run) — Test Files 1 passed (1), Tests 33 passed (33).
  • npm run guard:push:self-test[guard-push] self-test passed.
  • npm run verify:ui — not run; no UI/routing/browser/styling behavior changed (this PR only touches git-push tooling and its docs).
  • npm run verify:release — not run; not a release/handoff-confidence request.

Risk and rollout

  • Risk: This loosens a pre-push safety guard on PR branches, so it is worth spelling out precisely what changed and what didn't. Still blocked, unconditionally, no override: disabling/re-enabling a PR's auto-merge from automation, and force-pushing (rewriting history) to a branch whose auto-merge is armed. Newly allowed: an ordinary fast-forward commit/push to such a branch. This mirrors how GitHub's own auto-merge feature is designed to work — it re-validates required checks against whatever the current head is before merging, so an additive push cannot cause it to merge unvalidated content. The remaining edge case (an actor without repo write permission pushing to such a branch) is unaffected: GitHub disables auto-merge itself in that case, independent of this guard.
  • Rollback: revert this PR (or SKIP_STATIC_GUARD-style env-var overrides are not applicable here since the auto-merge guard deliberately has none) to restore the previous "block any push while armed" behavior.
  • Provider or production effects: None. This only changes local git-push tooling (.githooks/pre-pushscripts/guard-push.mjs) and agent-facing policy docs; it does not touch GitHub Actions workflows, Supabase, OpenAI, or deployment configuration.

Notes

  • Requested directly by the repository owner as a "fast iteration, balanced with appropriate safety" tradeoff: keep pushing/committing to PR branches usable while auto-merge is armed, but keep the two operations that can actually lose or bypass validated work (force-push, disabling auto-merge) hard-blocked.

Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Ordinary fast-forward updates are now allowed for pull requests with auto-merge enabled.
    • Force-pushes and history rewrites remain blocked while auto-merge is active.
  • Bug Fixes

    • Improved safeguards to preserve user-controlled auto-merge settings.
    • Added clearer warnings for permitted updates and stronger protection against risky branch changes.
  • Documentation

    • Updated automation guidance and branch review records to reflect the revised push behavior.

Auto-merge state itself stays user-owned and automation still never
disables/re-enables it. But an ordinary fast-forward commit/push while
auto-merge is armed is safe -- GitHub re-validates required checks
against the new head before it merges, so an additive push cannot slip
an unvalidated commit past it. Narrow guard-push.mjs's auto-merge guard
from a hard block on any push to a hard block only on a force-push
(history rewrite) while armed, which is where the real risk (discarding
a commit GitHub already validated/is mid-evaluating) actually lives.
Update AGENTS.md and the run-pr/handoff/pr-babysit policy docs to match.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@supabase

supabaseBot commented Aug 17, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitaiBot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in:39 minutes

Limit details: You’ve used all 1 included review currently available under your plan. You completed 95 included PR reviews in the past 7 days; at that activity level, included reviews refill at 1 review per hour.

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 42b481b9-8279-4522-8b67-00bcf46f5a24

📥 Commits

Reviewing files that changed from the base of the PR and between b2860cf and d4d9176.

📒 Files selected for processing (1)
  • AGENTS.md

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b5f1f8fa-ff49-495a-842e-d9f3717739f2

📥 Commits

Reviewing files that changed from the base of the PR and between 92f7618 and b2860cf.

📒 Files selected for processing (7)
  • .claude/skills/handoff/SKILL.md
  • .claude/skills/run-pr/SKILL.md
  • .cursor/agents/pr-babysit.md
  • AGENTS.md
  • docs/branch-review-records/34da6f5a63ff446e67f42d58dd5935969b7425557ddb21aa01bcadd78378fec9.record.md
  • scripts/guard-push.mjs
  • tests/guard-push.test.ts

Included review availability: 0 reviews are currently available. Based on recent review activity, included reviews refill at 1 per hour.


📝 Walkthrough

Walkthrough

The push guard now permits fast-forward pushes with armed auto-merge, blocks armed force-pushes, and preserves auto-merge state. Tests and automation guidance reflect the updated policy.

Changes

Auto-merge push safety

Layer / File(s)Summary
Force-push detection and auto-merge verdicts
scripts/guard-push.mjs, tests/guard-push.test.ts
The guard detects force-updated branches, warns on armed fast-forward pushes, blocks armed force-pushes, and tests both paths.
Automation policy guidance
.claude/skills/..., .cursor/agents/pr-babysit.md, AGENTS.md, docs/branch-review-records/...
Operational guidance permits additive updates while auto-merge is armed and continues to prohibit auto-merge changes, force-pushes, history rewrites, and base or target changes.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk:⚪ Minimal · up to b2860

This change narrows the push guard to continue blocking force-pushes while allowing ordinary updates to auto-merge branches; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers:claude, cursoragent

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 66.67% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly and concisely describes the main change: allowing ordinary pushes while auto-merge remains armed.
Description check✅ PassedThe description covers the change, verification results, risks, rollback, effects, and reasons for skipped optional checks.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/pr-auto-merge-safety-tpxupu

Comment @coderabbitai help to get the list of available commands.

@gitguardian

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian idGitGuardian statusSecretCommitFilename
36221231TriggeredGeneric High Entropy Secretc5f3736tests/rag-adversarial-fixtures.test.tsView secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@BigSimmo
BigSimmo enabled auto-merge (squash) August 17, 2026 17:29
@BigSimmo
BigSimmo merged commit 084f637 into mainAug 17, 2026
24 of 25 checks passed
@BigSimmo
BigSimmo deleted the claude/pr-auto-merge-safety-tpxupu branch August 17, 2026 17:53
Sign up for freeto 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

@BigSimmo@claude