Repository navigation
Conversation
AsyncGoogleSearch inherits GoogleSearch._parse_results(self, results, k), but AsyncGoogleSearch.run called it with only `results`, so every HTTP 200 raised TypeError instead of returning the parsed snippets. The synchronous GoogleSearch.run already passes k; this makes the async path match.
Author
|
Note on CI: the 🤖 Generated with Claude Code |
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.
The bug
AsyncGoogleSearchdoes not define_parse_results; it inherits it fromGoogleSearch:The synchronous path passes both arguments, the async path passes only one:
GoogleSearch.run, google_search.py:72parsed_res = self._parse_results(response, k)AsyncGoogleSearch.run, google_search.py:199parsed_res = self._parse_results(response)khas no default, so every successful (HTTP 200)AsyncGoogleSearchcall raisesTypeErrorinstead of returning results. Thestatus_code == 200branch is the only branch that reaches this line, so the async action never succeeds — the error paths (-1, other codes) are the only ones that return normally.AsyncArxivSearch, the repo's otherAsyncActionMixinsearch subclass, forwards its parameters correctly (return super().get_arxiv_article_information(query)), and all 16self._parse_response(...)call sites inweb_browser.pymatch their 1-argument definitions.AsyncGoogleSearch.runis the only mismatched site inlagent/.The fix
One line — pass
k, exactly as the synchronous sibling does.Verification
Ran on the real module (loaded from
lagent/actions/google_search.py, with_searchstubbed to return(200, {...})so no network/API key is needed), before and after the patch:The patched run was driven with
k=3and returns exactly 3 snippets, sokis honoured rather than merely accepted.Also replayed both call sites through
inspect.Signature.bindagainst the real inherited signature:Base branch
Targeting
v1.0.0since that is where recent work has been merging (#365, #366, #367). The same line is identical onmain— happy to retarget or open a companion PR if you would rather take it there.🤖 Generated with Claude Code