Conversation
…449) Extends the `gh-write-guard` PreToolUse hook with **Rule 4**: deny any git operation that would only succeed by bypassing an active branch rule - the gap behind the direct-push-to-develop incident this session, where an admin-bypass identity makes a plain `git push origin develop` silently land on a PR-gated branch. ## What it denies - **Direct update** to a branch whose live rules require a pull request (every `main`; code-style `develop`). A config-style `develop` has no such rule and stays allowed - decided by the live rules, no hardcoded repo list. - **Force** where `non_fast_forward`/`required_linear_history` is active. - **Delete** where `deletion` is active. - **Explicit-bypass flags**: `gh pr merge --admin`, `git commit/push --no-verify`. ## Behavior - The branch's rules come from `repos/{owner}/{repo}/rules/branches/{branch}` (visible even to a bypass actor). - **Fail-closed** on `main`/`master`/`develop` when the rules cannot be read; fail-open elsewhere (feature branches). - Each denial names the bypassed rule, the protocol path, and hands the exact command to the maintainer to run. - Injectable `rules_lookup`/`current_branch` keep `--selftest` deterministic and offline. ## Verification - `--selftest`: 44/44 (existing 21 write-footgun cases + 22 new Rule-4 cases: code/config develop, main, feature, HEAD/sha/bare/+refspec/delete refspecs, fail-closed vs fail-open, the explicit flags). - Live end-to-end against real branch rules: `develop`/`main` deny, this feature branch allow, `--admin`/`--no-verify` deny. Docs/tooling only - no release. Deploy to `~/.claude/hooks/` is held until this and the develop->main promotion both pass review. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
…450) Adds one paragraph to the GitHub Copilot Review Runbook's Bounded Retry Workflow. ## Why While driving #449 through 13 review rounds in an hour, Copilot throttled and posted its final re-review ~36 minutes after the request - beyond a 15-minute poll window. The poll timed out, and the Bounded Retry Workflow treated that as a *genuinely missing* review and escalated. It was not missing, only pending. ## Change Clarify that a slow review is **pending, not missing**: a poll timeout is evidence only that the review has not landed yet, so report `review still pending`, poll on a widening interval, and enter escalation only when the `requestReviews` mutation no-ops/errors or after a genuinely long confirmed-accepted wait - never on one fixed poll window elapsing. This complements the #444 head-coverage gate (which prevents concluding *clean* too early) by preventing the opposite error - concluding *unresponsive/blocked* too early. Docs only - no release. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Promotes two develop changes to main: a new Rule 4 in gh-write-guard.py that blocks git operations which would only succeed by bypassing active branch rules (plus explicit bypass flags), and a documentation update to the Copilot Review Runbook clarifying that slow reviews should be treated as pending with backoff polling.
Changes:
- Add Rule 4 branch-rule-bypass detection to
host-setup/agent-safety/gh-write-guard.py, including live branch-rules lookup and expanded deterministic self-tests. - Extend
.github/copilot-instructions.mdto advise poll-with-backoff behavior when Copilot reviews are slow/throttled.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| host-setup/agent-safety/gh-write-guard.py | Adds branch-rule-bypass protection (Rule 4) and expands parsing/self-test coverage for git push / bypass flags. |
| .github/copilot-instructions.md | Documents backoff polling guidance for slow Copilot reviews to avoid premature escalation. |
ptr727
added a commit
that referenced
this pull request
Jul 26, 2026
Promotes #452 - the agent write-safety kit README updated to document Rule 4 (branch-rule bypass + the unconditionally-denied verification-skipping flags), the fail-closed behavior on the protected-default branches, and an explicit Refreshing After an Upstream Change section (re-run the installer = the refresh mechanism #365 tracks). Docs only - no release. Restores develop==main after the guard/runbook promotion (#451). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.
Promotes two develop PRs to main:
gh-write-guard.py: deny any agent git operation that would only land by bypassing an active branch rule (direct push to a PR-gated branch, force where history is protected, delete where deletion is blocked, and the explicit-bypass flagsgh pr merge --admin/git commit|push --no-verify). Judged against the branch's live rules, so a code-style develop denies and a config-style develop allows with no hardcoded list. 71 self-test cases; 18 Copilot findings resolved across the review.Carried-file/spec changes, so downstream repos re-vendor
.github/copilot-instructions.md; the guard lives underhost-setup/(hub tooling). Docs/tooling only - no release.Deploy of the guard to
~/.claude/hooks/is held until this promotion passes review; the idempotent host installer + per-machine refresh tracking (#365) follow separately.🤖 Generated with Claude Code