Skip to content

[pytorchbot] bot manage "in progress" label - #8663

Open
liangel-02 wants to merge 1 commit into
mainfrom
bot_manage_in_progress_label
Open

[pytorchbot] bot manage "in progress" label#8663
liangel-02 wants to merge 1 commit into
mainfrom
bot_manage_in_progress_label

Conversation

@liangel-02

@liangel-02 liangel-02 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

do not let people add "in progress" label, remove this label if someone tries
this label should be managed by the bot only

@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
torchci Ignored Ignored Aug 27, 2026 8:21pm

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 27, 2026
@liangel-02 liangel-02 changed the title [pytorchbot] Manage in progress label automatically [pytorchbot] bot manage "in progress" label Aug 27, 2026
@liangel-02
liangel-02 requested a review from janeyx99 August 27, 2026 20:25
Comment thread torchci/lib/bot/pytorchBotHandler.ts
Comment thread torchci/test/labelCommands.test.ts

@janeyx99 janeyx99 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.

lgtm but someone from dev infra should confirm

@janeyx99
janeyx99 requested a review from izaitsevfb August 27, 2026 20:30

@izaitsevfb izaitsevfb 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.

lgtm

);
const invalidLabels = labelsToAdd.filter(
(l: string) => !repoLabels.has(l) && !BOT_MANAGED_PR_LABELS.has(l)
);

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.

please consider narrowing the scope here.


🟡 Scope the `@pytorchbot label` refusal the way the webhook removal is scoped — to pull requests in pytorch/pytorch. (ai-generated section)

The pull_request.labeled handler deletes in progress only when isPyTorchPyTorch(owner, repo) holds, so the policy it enforces is pytorch/pytorch-only. handleLabel applies BOT_MANAGED_PR_LABELS with no repo check and no pull-request check, and pytorchBot.ts wires the command handler up for every installation — so on any other repo the bot serves, and on issues as well as pull requests, @pytorchbot label "in progress" now answers "managed automatically by pytorch-bot and cannot be added manually" while the GitHub UI still lets anyone add the same label there. The new test in torchci/test/labelCommands.test.ts runs against zhouzhuojie/gha-ci-playground and the refusal fires. Matching the webhook takes two conditions rather than one, and both are already to hand in handleLabel: isPyTorchPyTorch(this.owner, this.repo), and is_pr_comment unless blocking the label on issues is intended.

})
);
return;
}

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.

flagging this as a minor race condition.


⚪ Consider deciding on who last applied the label rather than on who sent the event being handled. (ai-generated section)

The guard reads context.payload.sender, the account named in the event currently being processed. GitHub redelivers a webhook when the handler errors, and delivery order is not guaranteed, so a replayed human labeled event can run after pytorch-bot has legitimately applied the label — at which point the handler deletes the bot's own label and comments that it "cannot be added manually". getBotAppliedLabels, a few hundred lines up in the same file, already answers "who last labelled this?" from the issue timeline and is used for exactly that purpose on the draft-gated removals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants