tools: add github_pr_merge, wait for CI then land a PR - #157
Merged
Conversation
github_pr_create (#152) got a change as far as "a PR exists". Landing it always meant a human (or an agent driving `gh` by hand outside this codebase) polling `gh pr checks`, then running `gh pr merge` once green -- the exact pattern GitHub Copilot's "Agent Merge" and Codex's automatic pre-merge approval reviews both shipped this year, and exactly what a real dogfooding session did by hand for six PRs in a row before this tool existed. Approval-gated for the same reason github_pr_create is: merging is visible to everyone with repo access and cannot be un-merged. The approval prompt covers the whole conditional intent ("merge this once checks pass"), asked before the outcome is known -- the same shape as a human reviewer saying "LGTM, merge when CI is green". Verifies checks itself (`gh pr checks --watch --fail-fast`) rather than trusting the caller's own judgment, and refuses to call `gh pr merge` at all unless that reports success -- a CI failure's own output becomes the tool's error detail, so the failure can actually be diagnosed rather than just reported as "didn't merge". `pr` accepts anything `gh` itself accepts (number, URL, branch name). Wired into refactor_permission's allowlist and all_tools_for_mode, same as github_pr_create; added to smoke.lex's skip list (a smoke run must never trigger a real merge). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
github_pr_create(tools: add github_pr_create, lex-code's first approval-gated tool #152) got a change as far as "a PR exists". Landing it always meant pollinggh pr checksthengh pr mergeby hand — exactly what this session did manually for six PRs in a row tonight, and the same pattern GitHub Copilot's "Agent Merge" and Codex's automatic pre-merge approval reviews both shipped this year.github_pr_create: merging is visible and irreversible. The approval prompt covers the conditional intent ("merge once checks pass"), asked before the outcome is known.gh pr checks --watch --fail-fast) rather than trusting the caller — refuses to merge unless that reports success, and returns the checks failure output as the error detail so it can actually be diagnosed.praccepts anythingghitself accepts (number, URL, branch name).Test plan
lex check(full sweep),lex fmt --check,lex doc-sync --check,lex testall passrefactor_permission's allowlist,all_tools_for_mode, andsmoke.lex's skip list, mirroringgithub_pr_createexactly🤖 Generated with Claude Code