Repository navigation
fix(agent/tools): surface github search error responses - #17064
Merged
yuzhichang merged 2 commits intoJul 20, 2026
Merged
Conversation
the github search api reports rate limits (403/429) and invalid queries
(422) through a "message" field with no "items". the github tool indexed
response["items"] directly, so those cases raised KeyError('items'),
which the retry loop reported to the model as the opaque
"GitHub error: 'items'".
guard the missing key and surface the api's actual message (with a clear
fallback) through the existing retry/_ERROR path instead. adds a
regression test covering the rate-limit response and the normal result path.
Contributor
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #17064 +/- ##
=======================================
Coverage 90.65% 90.65%
=======================================
Files 10 10
Lines 717 717
Branches 118 118
=======================================
Hits 650 650
Misses 39 39
Partials 28 28 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Summary
agent/tools/github.pyindexesresponse["items"]directly afterrequests.get(...).json(). the github search api returns{"message": ...}without anitemskey on realistic conditions — a rate limit (403/429; this tool sends no auth token, so the unauthenticated ~10 req/min search limit is easy to hit) or an invalid query (422). that raisedKeyError('items'), which the tool's retry loop then surfaced to the model as the opaque"GitHub error: 'items'"instead of the real reason.this guards the missing key and raises the api's actual
message(with a clear fallback) into the existing retry/_ERRORpath, so the model sees e.g."GitHub error: API rate limit exceeded ...". valid responses are unchanged.adds
test/unit_test/agent/tools/test_github_unit.pycovering the rate-limit response (asserts the real message is surfaced, noKeyError) and the normal result path.