-
Notifications
You must be signed in to change notification settings - Fork 374
[JENKINS-75704] Fix Copilot user null name/email handling #864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…pdate tests - Updated logic so that only the copilot user is allowed to bypass missing name and email checks in pull request processing. - All other users without name/email are marked as unknown and a log message is generated. - Added and updated tests to verify that copilot is accepted and handled as expected.
I see no evidence of such a change in the current patch; did you revert it? If so, please update the PR description accordingly. |
@@ -2572,17 +2572,22 @@ public void observe(GHPullRequest pr) { | |||
GHUser user = null; | |||
try { | |||
user = pr.getUser(); | |||
if (users.containsKey(user.getLogin())) { | |||
// looked up this user already |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may as well retain this comment in the else
clause
ContributorMetadataAction contributor = | ||
new ContributorMetadataAction(user.getLogin(), user.getName(), user.getEmail()); | ||
pullRequestContributorCache.put(number, contributor); | ||
// store the populated user record now that we have it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
} catch (FileNotFoundException e) { | ||
// If file not found for user, warn but keep going |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC this was just false.
Dear @jglick and @IvanGasant , Do you have an estimated timeline for merging this pull request and creating a new release? I'm particularly interested in this fix, as it's currently blocking some of our Jenkins CI/CD workflows when Copilot creates pull requests in our repositories. Thank you! |
Hey @IvanGasant , thanks a lot for your contribution! |
It's true that Jesse did approve the pull request but a few comments were not addressed, specifically about retaining the comments, for future reviewers. |
Thank you Adrien for your reply. |
It would be nice if @IvanGasant could manage the comments to merge this PR. |
Description
This PR improves the handling of pull requests and commits authored by GitHub IA, Copilot, who may not have a real GitHub account or may lack a defined name or email.
It prevents exceptions and ensures that these contributions are not discarded during indexing or processing.
Changes
Special handling for the "copilot" user:
"copilot"
, a syntheticContributorMetadataAction
is created with:"copilot"
"copilot@unknown.user"
Other users:
login
,name
, andemail
) with no fallback.If
user.getName()
oruser.getEmail()
arenull
, those fields will remainnull
as before.Unchanged logic for missing users:
Motivation
GitHub Copilot and other bots can appear as authors of commits and pull requests, but may not exist as real users in GitHub.
Without this special handling, such PRs would be discarded or cause exceptions, impacting the visibility and traceability of AI-generated or bot-generated contributions.
See JENKINS-75704 for further information.
Submitter checklist
No automated tests were added because this is a trivial change: it only handles null values or exceptions when fetching the GitHub user's name/email for logging purposes, defaulting to safe values if missing. It does not affect business logic or the core functionality of the plugin.
Reviewer checklist
Documentation changes
Users/aliases to notify