You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: track HTTP status code errors in context for observability (#1630)
Add NewGitHubAPIStatusErrorResponse helper function to properly track
GitHub API errors when the API call succeeds but returns an unexpected
HTTP status code (e.g., 404, 422, 500).
Previously, these errors were returned via utils.NewToolResultError which
bypasses the context-based error tracking used by the remote server's
error_categorizer.go for observability metrics. This resulted in 100%
tool call success rates in observability even when errors occurred.
The fix adds a new helper function that:
1. Creates a synthetic error from the status code and response body
2. Records the error in context via NewGitHubAPIErrorResponse
3. Returns the MCP error result to the client
Updated all tool files to use the new pattern for status code errors:
- pullrequests.go: 12 fixes
- repositories.go: 18 fixes
- issues.go: 10 fixes
- notifications.go: 6 fixes
- projects.go: 5 fixes
- search.go: 3 fixes
- search_utils.go: 1 fix
- gists.go: 4 fixes
- code_scanning.go: 2 fixes
- dependabot.go: 2 fixes
- secret_scanning.go: 2 fixes
- security_advisories.go: 4 fixes
Total: ~69 error paths now properly tracked.
Note: Parameter validation errors (RequiredParam failures) and internal
I/O errors (io.ReadAll failures) intentionally continue to use
utils.NewToolResultError as they are not GitHub API errors.
0 commit comments