feat(pr-bot): ai auto-merge bot with claude-code verification#496
Merged
Conversation
…e workflows trust-gate fails a required check when an untrusted author touches core. ci-label stamps ci: passing/failing on workflow_run completion. the ui-screenshot-gate auto-closes ui prs opened without before/after screenshots. auto-merge runs claude code verification on owner-labeled prs and arms native auto-merge for non-core changes only.
idempotent gh-api script creates the auto-merge / ci status labels, enables allow-auto-merge, and protects the target branch with the ci matrix + trust-gate + claude-verify required checks and code-owner review. owner runs it once after the workflows land.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
an owner-gated auto-merge bot. you label a PR
auto-merge, claude codeverifies the change actually works on that branch, and non-core PRs merge
themselves once every required check is green. core code is never merged by
automation — it always routes to your review.
the deterministic decisions live in
src/vouch/pr_bot.py(pure stdlib, nomodel dependency — the runtime stays model-free, same principle as
compile.py/llm_draft.py). the claude call is the claude-code githubaction running in the runner, not a python sdk import. everything the bot is
allowed to do is ANDed with hard guards, so the AI can only ever veto a
merge, never widen what merges.
pieces:
.github/CODEOWNERS— the review-gate core paths (proposals, lifecycle,storage, audit, models, capabilities, the three servers, cli, migrations,
pr_bot.pyitself, and.github/) require your review. a parity test keepsit in sync with
pr_bot.CORE_GLOBS.trust-gate.yml— a required check that fails when an untrusted author(anyone but you) touches core. reads metadata only, never runs PR code.
ci-label.yml— stampsci: passing/ci: failingonworkflow_runcompletion, so a green PR is visible at a glance.
ui-screenshot-gate.yml— UI PRs (web/,src/vouch/web/,webapp/) arereviewed by screenshot, not by running the app. a UI PR opened without
before/after screenshots is auto-closed with a comment. core wins over ui,
so a core+ui PR is never closed.
auto-merge.yml— on yourauto-mergelabel: claude code checks out thehead (authorized by the owner label), runs
make check+ smoke-tests forcodePRs or visually reviews the before/after screenshots foruiPRs,publishes a
claude-verifycheck on the head sha, and arms nativeauto-merge for non-core only.
scripts/setup_branch_protection.sh— idempotent one-time setup.security: the label is your authorization to execute the branch; open
contributors can't apply it and the workflow re-checks the sender. untrusted
strings go through
env:, PR bodies are fetched to files (never interpolated),and checkout uses
head.shanothead.ref. worst case under prompt injectionis a single green
claude-verifycheck — the merge still needs ci green and,for core, your codeowners approval.
to activate after merge: add the
ANTHROPIC_API_KEYrepo secret, then runbash scripts/setup_branch_protection.sh testwith an owner token (confirm theci check names still match
ci.yml). the claude-code-action input names shouldbe double-checked against its current readme.
design + plan captured locally (scratchpad);
make checkgreen.