Skip to content

Add raw client error annotation and annotate GetFileContents - #1570

Merged
mattdholloway merged 15 commits into
mainfrom
raw-client-error-annotation
Dec 19, 2025
Merged

Add raw client error annotation and annotate GetFileContents#1570
mattdholloway merged 15 commits into
mainfrom
raw-client-error-annotation

Conversation

@omgitsads

Copy link
Copy Markdown
Member

Annotate raw client errors in the context, to allow us to filter tool call failures in our metrics based on the error type.

@omgitsads
omgitsads requested a review from a team as a code ownerDecember 10, 2025 17:01
CopilotAI review requested due to automatic review settings December 10, 2025 17:01

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 GitHubRawAPIError type and associated error handling functions
  • Added raw error tracking to GitHubCtxErrors context structure
  • Updated GetFileContents to 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.

FileDescription
pkg/errors/error.goAdds GitHubRawAPIError type, context tracking, and NewGitHubRawAPIErrorResponse function for annotating raw API errors
pkg/github/repositories.goUpdates error handling in GetFileContents to use the new raw API error annotation

Comment threadpkg/errors/error.go
Comment threadpkg/errors/error.go
Comment threadpkg/errors/error.go
Comment threadpkg/errors/error.go
@mattdhollowaymattdholloway self-assigned this Dec 15, 2025

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment threadpkg/errors/error.go
mattdhollowayand others added 2 commits December 15, 2025 17:21
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment threadpkg/errors/error.go
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)

CopilotAIDec 17, 2025

Copy link

Choose a reason for hiding this comment

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

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())

Copilot uses AI. Check for mistakes.
@mattdholloway
mattdhollowayforce-pushed the raw-client-error-annotation branch from b4b4eaf to 349877fCompareDecember 17, 2025 16:12
@mattdholloway
mattdholloway merged commit b79d126 into mainDec 19, 2025
17 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@omgitsads@JoannaaKL@mattdholloway