RFR: 2065: Update PR labels when new files are touched [v4]

Magnus Ihse Bursie ihse at openjdk.org
Fri Aug 29 07:52:29 UTC 2025


On Thu, 28 Aug 2025 23:04:05 GMT, Zhao Song <zsong at openjdk.org> wrote:

>> This patch is trying to make the pr bot be able to update PR labels when new files are touched.
>> The main idea is from Erik. For a new PR, the bot will run a labelerWorkItem to auto label the PR first, and the commit hash will be stored in a comment.
>> 
>> With this patch, here are some new behaviors of the bot:
>> (1) The user didn't issue manual label command before auto labeling, LabelerWorkItem will do the initial auto labeling and store the commit hash in the comment. 
>> (2) If the user issued manual label command before auto labeling, the initial auto labeling will be skipped, the bot would still post a comment and store the hash in the comment.
>> (3) The user pushes a new commit or few commits to a pr that already auto labeled, the bot will evaluate the diff between stored hash and current head, then add new labels or upgrading labels to group labels, in the end, update the stored hash in the comment.
>> (4) The user force pushes to the pr that already auto labeled, the bot will evaluate the diff between baseHash and current head.
>> (5) The user issues a command to add a label to the pr(or even the user add the label via the forge UI), the bot will check if the labels can be upgraded to group labels.
>> 
>> The side effect of this feature I can imagine is that a user thinks a file is not related to a component and removed it manually, but later, every time when he touches the file, the label will be added back.
>
> Zhao Song has updated the pull request incrementally with one additional commit since the last revision:
> 
>   review comment

I made some comments about this PR in the test bug https://github.com/openjdk/playground/pull/239#issuecomment-3236075737. I realized afterwards that this was kind of a stupid place to put it. :) So here it is again:

> @zhaosongzs A manual label command was issued before auto-labeling, so auto-labeling was skipped.

@zhaosongzs Oh, I'm not so sure about this... If the bots are slow or get stuck, people might give `/label` commands before the bots can do the auto labeling. I don't think that should block auto-labeling. But we could give a warning, showing the diff between the manual labeling and the autolabeling. And if there is no diff, then we can just be quiet, since that might just have been someone getting tired of waiting for the bots. Otherwise we can say like "Manual labels set `build`, `core-libs`. Automatic labelling would not have set `build`, but is keeping it due to manual label. Automatical labelling added `client-libs`, `panama`." (but slightly better phrased).

And also, just to be super clear, giving manual `/label` commands at some point, should not block the automatic label update when new files are added.

-------------

PR Comment: https://git.openjdk.org/skara/pull/1735#issuecomment-3236084200


More information about the skara-dev mailing list