Skip to content

trymerge: count only a label's own repeats in add_numbered_label - #202802

Closed
izaitsevfb wants to merge 2 commits into
mainfrom
iz/trymerge-numbered-label-exact
Closed

izaitsevfb wants to merge 2 commits into
mainfrom
iz/trymerge-numbered-label-exact

Conversation

@izaitsevfb

Copy link
Copy Markdown
Contributor

✴️ iz2: add_numbered_label("merged") counted every label containing "merged", so a PR carrying the unrelated mergedog label landed as mergedX1 instead of Merged (e.g. #202615, #202617; 90 PRs carry mergedX1). Anything that checks for Merged then reads these lands as closed unmerged. #98551 meant the numbering to count only the label's own repeats.

This change counts only labels equal to the base or fully matching <base>X<n>.

Matching stays case-sensitive on purpose. The repo labels are Merged and Reverted, which "merged" in "Merged" never matched, so re-merges have always kept plain Merged (no PR carries Merged + mergedX1 without mergedog, and none carries revertedX1). This keeps that behaviour; only PRs with a substring-matching label change.

Test plan: new TestAddNumberedLabel cases (mergedog, mergedX1foo/mergedx1, Merged, own repeats) fail on the old condition and pass with the fix. python -m unittest test_trymerge: 216 run, all pass except two git end-to-end tests that fail identically on unmodified main in my environment (tmp-dir cleanup OSError).

A substring match counted unrelated labels such as "mergedog", so those
PRs were labeled mergedX1 instead of Merged on land.
@izaitsevfb
izaitsevfb requested a review from a team as a code owner October 30, 2026 19:10
@pytorch-bot pytorch-bot Bot added the topic: not user facing topic category label Oct 30, 2026
@pytorch-bot

pytorch-bot Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

PR Status: Approved 🚀

Please fix all CI failures and trigger merge by commenting "@pytorchbot merge".

✅ AUTOMATED REVIEW - Ready for human review:

The PR changes GitHubPR.add_numbered_label in .github/scripts/trymerge.py so it
counts only labels equal to label_base or fully matching <label_base>X<n>.
Before, any label containing the base as a substring was counted (so an
unrelated label like `mergedog` turned `merged` into `mergedX1`), and the same
fix applies to the `reverted` path. Recommendation: Approve. Nothing blocks
approval.

Reviewed commit: 30422a1

Review run

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/202802

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (1 Unrelated Failure)

As of commit 30422a1 with merge base c393f2a (image):

🟡 GREEN LIGHT - PR requires human review:

  • Correctness
    • add_numbered_label in .github/scripts/trymerge.py now counts only label == label_base or a full <base>X<n> match; re is already imported
    • TestAddNumberedLabel in test_trymerge.py covers mergedog, mergedX1foo, Merged, and own-repeat cases
  • Socialization
    • The change alters which label the merge bot applies on land and revert for PRs that carry a substring-matching label (e.g. mergedog)
    • Merge/revert labels are read by tooling outside this repo, as the PR body itself notes for Merged, so the people who own that tooling should know this landed
  • Triviality
    • A behavior change in the mergebot land path (MERGE_COMPLETE_LABEL and reverted callers) is consequential enough that a human should sign off

reason: needs_socialization
Reviewed commit: 30422a1

Inference job

🐛 Report a wrong verdict

FLAKY - The following job failed but was likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@izaitsevfb
izaitsevfb requested a review from huydhn October 30, 2026 19:10
@pytorchgreenlight pytorchgreenlight Bot added the GL/human GreenLight marked as needing human review label Oct 30, 2026
@pytorchbot pytorchbot added the in progress PR is being worked on by the author, until the automated review accepts it label Oct 30, 2026
github-actions[bot]

This comment was marked as outdated.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review of 30422a1: nothing blocking; ready for human review.

The PR changes GitHubPR.add_numbered_label in .github/scripts/trymerge.py so it counts only labels equal to label_base or fully matching <label_base>X<n>. Before, any label containing the base as a substring was counted (so an unrelated label like mergedog turned merged into mergedX1), and the same fix applies to the reverted path. Recommendation: Approve. Nothing blocks approval.

This review is AI-generated and advisory. Each new automated review replaces the previous one.

@github-actions
github-actions Bot dismissed their stale review October 30, 2026 19:31

Withdrawn: the automated review of 30422a1 found nothing blocking.

@pytorch-bot pytorch-bot Bot added ready for review Automated review passed, ready for a final review by a maintainer. and removed in progress PR is being worked on by the author, until the automated review accepts it labels Oct 30, 2026

@huydhn huydhn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. This is a silly bug :)

@izaitsevfb

Copy link
Copy Markdown
Contributor Author

✴️ iz2:
@pytorchbot merge

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Nov 3, 2026
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

dominikjastrzebskix pushed a commit to dominikjastrzebskix/pytorch that referenced this pull request Nov 5, 2026
…orch#202802)

✴️ iz2: `add_numbered_label("merged")` counted every label containing "merged", so a PR carrying the unrelated `mergedog` label landed as `mergedX1` instead of `Merged` (e.g. pytorch#202615, pytorch#202617; 90 PRs carry `mergedX1`). Anything that checks for `Merged` then reads these lands as closed unmerged. pytorch#98551 meant the numbering to count only the label's own repeats.

This change counts only labels equal to the base or fully matching `<base>X<n>`.

Matching stays case-sensitive on purpose. The repo labels are `Merged` and `Reverted`, which `"merged" in "Merged"` never matched, so re-merges have always kept plain `Merged` (no PR carries `Merged` + `mergedX1` without `mergedog`, and none carries `revertedX1`). This keeps that behaviour; only PRs with a substring-matching label change.

Test plan: new `TestAddNumberedLabel` cases (`mergedog`, `mergedX1foo`/`mergedx1`, `Merged`, own repeats) fail on the old condition and pass with the fix. `python -m unittest test_trymerge`: 216 run, all pass except two git end-to-end tests that fail identically on unmodified main in my environment (tmp-dir cleanup `OSError`).
Pull Request resolved: pytorch#202802
Approved by: https://github.com/huydhn
dominikjastrzebskix pushed a commit to dominikjastrzebskix/pytorch that referenced this pull request Nov 9, 2026
…orch#202802)

✴️ iz2: `add_numbered_label("merged")` counted every label containing "merged", so a PR carrying the unrelated `mergedog` label landed as `mergedX1` instead of `Merged` (e.g. pytorch#202615, pytorch#202617; 90 PRs carry `mergedX1`). Anything that checks for `Merged` then reads these lands as closed unmerged. pytorch#98551 meant the numbering to count only the label's own repeats.

This change counts only labels equal to the base or fully matching `<base>X<n>`.

Matching stays case-sensitive on purpose. The repo labels are `Merged` and `Reverted`, which `"merged" in "Merged"` never matched, so re-merges have always kept plain `Merged` (no PR carries `Merged` + `mergedX1` without `mergedog`, and none carries `revertedX1`). This keeps that behaviour; only PRs with a substring-matching label change.

Test plan: new `TestAddNumberedLabel` cases (`mergedog`, `mergedX1foo`/`mergedx1`, `Merged`, own repeats) fail on the old condition and pass with the fix. `python -m unittest test_trymerge`: 216 run, all pass except two git end-to-end tests that fail identically on unmodified main in my environment (tmp-dir cleanup `OSError`).
Pull Request resolved: pytorch#202802
Approved by: https://github.com/huydhn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request GL/human GreenLight marked as needing human review Merged ready for review Automated review passed, ready for a final review by a maintainer. topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants