Skip to content

Conversation

nil-is-all
Copy link
Contributor

Python script for Workflow automation for pending_user_response.yml based on the following:

  • If an issue or PR has 'needs-user-input' label, and it has been 30 days since the last comment, comment and tag the user asking them to take a look.
  • And 30 days after this comment from the workflow, if no response, close the issue with a comment stating the user did not respond and they can re-open if needed.
  • If the user responds, remove the 'needs-user-input' label.

Python script for Workflow automation for pending_user_response.yml based on the following:

- If an issue or PR has 'needs-user-input' label, and it has been 30 days since the last comment, comment and tag the user asking them to take a look.
- And 30 days after this comment from the workflow, if no response, close the issue with a comment stating the user did not respond and they can re-open if needed.
- If the user responds, remove the 'needs-user-input' label.
@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 2, 2025
Copy link

pytorch-bot bot commented Sep 2, 2025

🔗 Helpful Links

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

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

✅ You can merge normally! (4 Unrelated Failures)

As of commit d27291b with merge base 6d8583d (image):

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

Copy link

github-actions bot commented Sep 2, 2025

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Workflow automation for addressing issues/PRs pending user response.
- follows script in pending_user_response.py
Copy link
Contributor

@mergennachin mergennachin left a comment

Choose a reason for hiding this comment

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

  • The code removes the label when a user responds, but never adds it initially. There's no logic for when the need-user-input label gets applied in the first place.

  • The code could create multiple reminder comments if run multiple times, since it only checks if not auto_comments but doesn't prevent duplicate reminders. For example, you want to make explicitly check that it doesn't comment more than once in a week.

Comment on lines 43 to 49
if not auto_comments:
if last_comment and (now - last_comment.created_at).days >= DAYS_BEFORE_REMINDER:
# Tag the issue author or PR author
user = issue.user.login
# issue.create_comment(REMINDER_COMMENT.format(user))
print(f"[VALIDATION] Would remind {user} on issue/PR #{issue.number}")

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you could improve as follow to make it more robust:

if not auto_comments:

  • Find last comment from the relevant user
  • Only remind if the last user comment is old enough

# Case 2: Automation comment exists, but no user response after 30 more days
elif auto_comments:
last_auto = auto_comments[-1]
# Any user response after automation?
Copy link
Contributor

Choose a reason for hiding this comment

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

Check for ANY response after the last automation comment (not just from the original author)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Check for ANY response after the last automation comment (not just from the original author)

This condition could still include cases where the user has not responded yet, and would remove the 'need-user-input' label unnecessarily. By adding an author-specific comment, I am checking if the user is the one who has responded after the bot reminder.

@nil-is-all
Copy link
Contributor Author

nil-is-all commented Sep 3, 2025

Hi @mergennachin, thanks for the review. The duplicate comment issue is a valid concern, and will make changes accordingly to avoid it. I have some queries regarding the other aspects:

  • The code removes the label when a user responds, but never adds it initially. There's no logic for when the need-user-input label gets applied in the first place.

I feel the 'need-user-input' label should be added manually, since the best (and only) way to recognize if a discussion involves a user to get back is by reading the reviewer's comments. Many issues I came across had discussions where the last comment, even though made by a PyTorch Edge reviewer, was a discussion within the engineering team/partner team.

# repo = g.get_repo(REPO_NAME)

print("[VALIDATION] Would connect to Github and fetch repo:", REPO_NAME)
# issues = repo.get_issues(state='open', labels=[LABEL])
Copy link
Member

Choose a reason for hiding this comment

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

Can you re-enable the this API call in order to allow testing of fetching issues? We can still leave the actual commenting and labeling disabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Enabled these lines now.

Uncommented start of main() [lines 21-25 impacted]
@GregoryComer
Copy link
Member

  • The code removes the label when a user responds, but never adds it initially. There's no logic for when the need-user-input label gets applied in the first place.

On this point, my recommendation was to manually add the label, as it may be difficult to automatically infer when we are actually waiting on a user response. For example, if a maintainer mentions that something is being actively worked on, we wouldn't want to auto-label as pending user response and ping them for a comment to avoid closing. I'm open to changing the approach, though.

now = datetime.datetime.utcnow()

# Simulate issues for validation workflow
issues = [] # Replace with mock issues if needed
Copy link
Member

@GregoryComer GregoryComer Sep 9, 2025

Choose a reason for hiding this comment

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

Can you remove this line now that we're fetching the actual issues? Once that's ready and the lint job is passing, I think we can merge it to start dry-run testing in parallel with the ongoing discussion about the staling policy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, and added workflow dispatch. Lmk if it is good to merge


on:
schedule:
- cron: '0 8 * * 1' # runs every Monday at 8:00 UTC
Copy link
Member

@GregoryComer GregoryComer Sep 9, 2025

Choose a reason for hiding this comment

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

Can you also add on workflow dispatch to allow manual triggering? Here's an example: https://github.com/pytorch/executorch/blob/main/.github/workflows/trunk.yml#L11

@nil-is-all nil-is-all merged commit 323a9e8 into main Sep 12, 2025
116 of 120 checks passed
@nil-is-all nil-is-all deleted the nil-is-all-patch-1 branch September 12, 2025 18:12
StrycekSimon pushed a commit to nxp-upstream/executorch that referenced this pull request Sep 23, 2025
Python script for Workflow automation for pending_user_response.yml
based on the following:

- If an issue or PR has 'needs-user-input' label, and it has been 30
days since the last comment, comment and tag the user asking them to
take a look.
- And 30 days after this comment from the workflow, if no response,
close the issue with a comment stating the user did not respond and they
can re-open if needed.
- If the user responds, remove the 'needs-user-input' label.
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