From 496a349779218ced7ff87a2e6440e8e2252c1144 Mon Sep 17 00:00:00 2001 From: "codegen-sh[bot]" <131295404+codegen-sh[bot]@users.noreply.github.com> Date: Sat, 22 Mar 2025 00:31:07 +0000 Subject: [PATCH 1/2] Fix GitHub search_issues error handling --- src/codegen/extensions/tools/github/search.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/codegen/extensions/tools/github/search.py b/src/codegen/extensions/tools/github/search.py index b83504937..65a2302bb 100644 --- a/src/codegen/extensions/tools/github/search.py +++ b/src/codegen/extensions/tools/github/search.py @@ -49,7 +49,18 @@ def search( # Search using PyGitHub's search_issues (which searches both issues and PRs) results = [] - for item in repo.search_issues(query)[:max_results]: + search_results = repo.search_issues(query) + + # Handle the case when no results are found + if search_results.totalCount == 0: + return SearchResultObservation( + status="success", + query=query, + results=[], + ) + + # Process the results + for item in search_results[:max_results]: result = { "title": item.title, "number": item.number, From 03b05c66efaff5f0499c23fb261000790b8ca10e Mon Sep 17 00:00:00 2001 From: "codegen-sh[bot]" <131295404+codegen-sh[bot]@users.noreply.github.com> Date: Sat, 22 Mar 2025 00:31:48 +0000 Subject: [PATCH 2/2] Automated pre-commit update --- src/codegen/extensions/tools/github/search.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/codegen/extensions/tools/github/search.py b/src/codegen/extensions/tools/github/search.py index 65a2302bb..2bdf53da1 100644 --- a/src/codegen/extensions/tools/github/search.py +++ b/src/codegen/extensions/tools/github/search.py @@ -50,7 +50,7 @@ def search( # Search using PyGitHub's search_issues (which searches both issues and PRs) results = [] search_results = repo.search_issues(query) - + # Handle the case when no results are found if search_results.totalCount == 0: return SearchResultObservation( @@ -58,7 +58,7 @@ def search( query=query, results=[], ) - + # Process the results for item in search_results[:max_results]: result = {