Repository navigation
feat(alpha): refuse merge on a stale base - #336
Open
tbhb-agent wants to merge 3 commits into
Open
tbhb-agent wants to merge 3 commits into
tbhb-agent wants to merge 3 commits into
Conversation
Generated-by: LLM effort=medium;harness=claude-code:2.1.322;model=anthropic:claude-sonnet-5-5;session=sha-256-64:24ed779d56b187de;started_at=2026-11-15T16:51:11Z;surface=cli
Generated-by: LLM effort=medium;harness=claude-code:2.1.322;model=anthropic:claude-sonnet-5-5;session=sha-256-64:24ed779d56b187de;started_at=2026-11-15T16:51:11Z;surface=cli
Generated-by: LLM effort=medium;harness=claude-code:2.1.322;model=anthropic:claude-sonnet-5-5;session=sha-256-64:24ed779d56b187de;started_at=2026-11-15T16:51:11Z;surface=cli
This branch has not been deployed
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.
Why
Pull requests that each pass CI can break main together when they change the same package. CI ran against the old base, and
alpha mergedidn't look at what main gained since.Behavior change
alpha mergefetches the base and the pull request head, then lists changed paths with localgit diff --name-status -M -zfrom the merge base to each side. The listing uses null-byte separators and includes rename and copy sources. If the base gained commits in a directory the pull request also changes, the command refuses, names the directories, and says to rerun CI against current main. If the base moved only in other directories, it warns on stderr and merges. The command stops when a git read fails, when the fetched head differs from the pull request's head, or when the pull request has an empty file list. It fetches the base again right before the merge call and refuses if the tip moved.Risk
The command doesn't check a push to the base after that last fetch, so the remaining window is the time between the fetch and
gh pr merge, a few seconds. GitHub's own merge checks and the head match cover that window. A pull request that touches a busy directory needs a CI rerun more often. The directory match is coarse, so a refusal can happen with no real conflict.Verification
pytestpasses the merge test file with 100% line and branch coverage forsquash_merge.py.ruff,pyreflyandcomplexipypass. CI runs the full Bazel suite.Opened-by: LLM effort=medium;harness=claude-code:2.1.322;model=anthropic:claude-sonnet-5-5;session=sha-256-64:24ed779d56b187de;surface=cli
Generated-by: LLM effort=medium;harness=claude-code:2.1.322;model=anthropic:claude-sonnet-5-5;session=sha-256-64:24ed779d56b187de;started_at=2026-11-15T16:51:11Z;surface=cli