Fix duplicate tagpr PRs when CalVer advances between runs#326
Draft
Fix duplicate tagpr PRs when CalVer advances between runs#326
Conversation
When using Calendar Versioning, if a new tag is created between tagpr runs (e.g., after a PR is merged and tagged), the next run sees a different currVer, constructs a new rcBranch name, and can't find the existing PR by branch lookup. This caused a new PR to be created, leaving the old one open as a duplicate. Fix: After the branch-specific PR lookup returns nothing, do a broader search for any open tagpr PRs on other branches targeting the same base branch. Collect their labels and close them before creating the new PR. Co-authored-by: Songmu <177122+Songmu@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix duplicated calver issue in tagpr
Fix duplicate tagpr PRs when CalVer advances between runs
Mar 13, 2026
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.
With CalVer, when a tagpr PR is merged and tagged, a subsequent run sees an updated
currVer, constructs a newrcBranch(e.g.,tagpr-from-v2026.309.1), and finds no existing PR on that branch — so it creates a new one instead of recognizing the old one as stale. Result: two open tagpr PRs for the same day.Root cause
The existing PR lookup is branch-exact:
Changes
tagpr.go— stale PR detection: When the branch-specific lookup returns no PR, do a secondary search for any open tagpr PR (identified viaisTagPR) targeting the same base branch on a different head branch. Collects labels from the stale PR to carry forward.tagpr.go— stale PR cleanup: Before creating the new PR, close all detected stale tagpr PRs. Close errors are logged but non-fatal — the new PR creation proceeds regardless.This ensures at most one tagpr PR is open at a time, regardless of how many times
currVeradvances between runs.💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.