Skip to content

Tool error paths skip NewGitHubAPIErrorResponse, so rate-limit details are lost (list_releases, security advisories, search_issues and others) #4028

Backlog

Description

@basil-k-aji-dev

Several tools return a plain error when the GitHub API call fails, instead of going through ghErrors.NewGitHubAPIErrorResponse as docs/error-handling.md describes. Their siblings list_tags and list_branches use the helper.

Affected paths: list_releases and get_latest_release (pkg/github/repositories.go), the four security-advisory tools (pkg/github/security_advisories.go), search_pull_requests (pkg/github/search_utils.go), and search_issues and list_issue_types (pkg/github/issues.go).

Because the helper is skipped, the error never reaches the remote server's middleware, and users lose the rate-limit message. With a rate-limited response, list_releases returns failed to list releases: GET ...: 403 API rate limit exceeded [rate reset in 60m00s], while list_tags returns failed to list tags: GitHub API rate limit exceeded. Retry after 1h0m0s.

A table test using NewMockedHTTPClient with a 404 response fails for all nine tools and passes for list_tags. The fix is a one-line swap per site; eight existing subtests that assert the old handler error would need flipping.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions