Fix: Handle bot users gracefully when metadata is unavailable #920
+55
−31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem Description
Repository scans fail completely with a FATAL error when a Pull Request is authored by a bot user (such as GitHub Copilot) whose user metadata is not accessible via the GitHub API.
Error Details
When scanning a repository with PRs from bot users, the scan aborts with:
Impact
Root Cause
In
GitHubSCMSource.java, theCacheUpdatingIterable.observe()method (line 2596) throws aWrappedExceptionwhen user metadata cannot be fetched:This behavior is problematic because:
/users/Copilotendpoint (returns 404)Changes Made
This PR implements tolerant error handling that uses default values when user metadata is unavailable:
Key Changes
Graceful degradation for user metadata:
user.getName()anduser.getEmail()FileNotFoundException(404), use default values: login as name,[email protected]as emailRemove unnecessary try-catch:
getTitle(),getBody(),getHtmlUrl()) which don't throw checked exceptionsMaintain backward compatibility:
Code Example
Benefits
Testing
Tested locally by:
Checklist
mvn clean package -DskipTests)Note: This fix addresses a critical production issue where bot-authored PRs prevent repository indexing and orphaned item cleanup, leading to significant disk space consumption.