Prevent automerge from racing ahead of comment-driven iterations#339
Merged
nicobistolfi merged 2 commits intomainfrom Mar 30, 2026
Conversation
When an assignee posts a follow-up @vigilanteai iteration request and vigilante:automerge is added immediately after, the PR maintenance path could merge the PR before the iteration was processed. This introduces an explicit pending-iteration gate in tryAutoSquashMerge that: 1. Blocks automerge when IterationInProgress is set on the session. 2. Fetches issue comments and checks for unclaimed iteration comments before allowing the merge to proceed. The gate covers both the window after a qualifying comment is observed but before the iteration session starts, and the active iteration window. Once the iteration completes and no further comments are pending, automerge proceeds normally. Closes #338
7 tasks
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
tryAutoSquashMergethat blocks automerge when a session hasIterationInProgressset or when there are unclaimed@vigilanteaiiteration comments on the issue.iterationBlocksAutomergemethod fetches issue comments before each merge attempt and uses the existingFindIterationCommentfunction with the session's monotonic claim cursor to detect pending iteration requests.vigilante:iteratingis set.Test plan
TestScanOnceAutomergeBlockedByPendingIterationComment— verifies automerge is blocked when an unclaimed iteration comment existsTestScanOnceAutomergeBlockedByIterationInProgress— verifies automerge is blocked whenIterationInProgressis trueTestScanOnceAutomergeProceedsWithNoIterationComments— verifies automerge proceeds normally with no iteration commentsTestScanOnceAutomergeProceedsWhenIterationAlreadyClaimed— verifies automerge proceeds when the iteration comment has already been claimedgo test ./...)Closes #338