Skip to content

Fix check-for-reproducer never removing "Needs: Repro" once react-native-bot applied it - #58429

Open
bjjeong wants to merge 1 commit into
react:mainfrom
bjjeong:fix/check-for-reproducer-bot-label-lock
Open

Fix check-for-reproducer never removing "Needs: Repro" once react-native-bot applied it#58429
bjjeong wants to merge 1 commit into
react:mainfrom
bjjeong:fix/check-for-reproducer-bot-label-lock

Conversation

@bjjeong

@bjjeong bjjeong commented Sep 9, 2026

Copy link
Copy Markdown

Summary:

check-for-reproducer.yml runs checkForReproducer.js on every issue edit so that, once an author adds a reproducer, the Needs: Repro label is removed. In practice the label is never removed, because the guard that is meant to defer to maintainers locks the bot out of its own label.

hasMaintainerChangedLabel treats every labeled/unlabeled event on Needs: Repro as a maintainer decision unless actor.type === 'Bot'. That only excludes GitHub Apps (e.g. github-actions[bot]). react-native-bot — the account this workflow runs as via REACT_NATIVE_BOT_GITHUB_TOKEN — is a regular user account, so its timeline events have actor.type === 'User'. The bot's own initial "labeled Needs: Repro" event therefore satisfies actor.login !== author && label.name === 'Needs: Repro', the function returns true, and every subsequent run exits before looking for a reproducer.

Concrete example, #58427 (timeline via the REST API):

2026-09-09T17:07:59Z labeled   Needs: Repro           by react-native-bot    type=User
2026-09-09T17:12:17Z unlabeled Needs: Author Feedback by github-actions[bot] type=Bot
2026-09-09T17:12:18Z labeled   Needs: Attention       by github-actions[bot] type=Bot

The author edited a same-account GitHub repository link (created from react-native-community/reproducer-react-native) into the body; check-for-reproducer ran on each edit (runs 34381378212 and 34381697572, both green) and the label stayed. A sample of the 8 most recently updated open issues carrying Needs: Repro shows the same shape on all of them: the only Needs: Repro event is the bot's own labeled, with no removal ever recorded, and none of 12 recently closed Needs: Repro issues had the label removed by the bot either.

This PR makes hasMaintainerChangedLabel ignore events produced by react-native-bot in addition to GitHub Apps, so that only human label changes count as maintainer intervention. It adds a unit test for the script (there was none), covering: no reproducer → labels added; author repo link → label removed; bot-applied label + author edit → label removed (the regression); maintainer changed the label → no-op; unrelated label changes ignored; reproducer in a comment by its author.

Changelog:

[INTERNAL] [FIXED] - Let check-for-reproducer remove Needs: Repro after the author adds a reproducer (the bot's own label no longer counts as a maintainer decision)

Test Plan:

$ npx jest@29.7.0 --config '{"rootDir":".github/workflow-scripts","testRegex":"__tests__/checkForReproducer-test\\.js$","transform":{}}'
PASS .github/workflow-scripts/__tests__/checkForReproducer-test.js
  checkForReproducer
    ✓ adds "Needs: Repro" and "Needs: Author Feedback" when no reproducer is present
    ✓ removes "Needs: Repro" when the author links a repository they own
    ✓ removes "Needs: Repro" after the author edits in a reproducer, even though react-native-bot applied the label
    ✓ does nothing when a maintainer has changed the "Needs: Repro" label
    ✓ ignores label changes on other labels when deciding whether a maintainer intervened
    ✓ accepts a reproducer link posted in a comment by its own author

Tests:       6 passed, 6 total

With the script reverted to main, the three tests whose timeline contains the bot's own labeled Needs: Repro event fail (3 failed, 3 passed) because hasMaintainerChangedLabel returns true, confirming the test captures the regression. prettier --check (3.9.4, repo config) passes on both files.

@meta-cla

meta-cla Bot commented Sep 9, 2026

Copy link
Copy Markdown

Hi @bjjeong!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

…ive-bot applied it

hasMaintainerChangedLabel treats every "Needs: Repro" label event by a
non-Bot actor other than the author as a maintainer decision. react-native-bot,
the account check-for-reproducer.yml runs as, is a regular user account
(actor.type === 'User'), so the bot's own initial label satisfies that check
and every later run exits before looking for a reproducer. Authors who edit a
valid reproducer into the issue can therefore never get the label removed
(e.g. react#58427; all recently labeled issues show the same).

Ignore react-native-bot's own label events alongside GitHub App events so that
only human label changes count as maintainer intervention, and add a unit test
for the script covering the regression and the existing behaviours.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@bjjeong
bjjeong force-pushed the fix/check-for-reproducer-bot-label-lock branch from 3765192 to ea654cb Compare September 9, 2026 17:58
@meta-cla

meta-cla Bot commented Sep 9, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@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 Sep 9, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Sep 9, 2026
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. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant