Add raw client error annotation and annotate GetFileContents#1570
Merged
mattdholloway merged 15 commits intomainfrom Dec 19, 2025
Merged
Add raw client error annotation and annotate GetFileContents#1570mattdholloway merged 15 commits intomainfrom
mattdholloway merged 15 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for annotating raw client errors in the context to enable error-type-based filtering in metrics. The implementation follows the existing patterns for GitHub API and GraphQL errors.
Key changes:
- Introduced
GitHubRawAPIErrortype and associated error handling functions - Added raw error tracking to
GitHubCtxErrorscontext structure - Updated
GetFileContentsto use the new raw error annotation instead of generic error handling
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| pkg/errors/error.go | Adds GitHubRawAPIError type, context tracking, and NewGitHubRawAPIErrorResponse function for annotating raw API errors |
| pkg/github/repositories.go | Updates error handling in GetFileContents to use the new raw API error annotation |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment on lines
+87
to
+90
| rawError := rawErrors[0] | ||
| assert.Equal(t, "failed to fetch raw content", rawError.Message) | ||
| assert.Equal(t, resp, rawError.Response) | ||
| assert.Equal(t, originalErr, rawError.Err) |
There was a problem hiding this comment.
The test should verify the Error() method output for consistency with the other error type tests. The API error test (line 41) and GraphQL error test (line 63) both verify the Error() method output, but this test doesn't. Add an assertion like: assert.Equal(t, "failed to fetch raw content: raw content not found", rawError.Error())
b4b4eaf to
349877f
Compare
JoannaaKL
approved these changes
Dec 19, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Annotate raw client errors in the context, to allow us to filter tool call failures in our metrics based on the error type.