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
{{ message }}
Repository navigation
fix(tools): preserve configured content_types in GithubSearchTool (#8888) - #8909
When GithubSearchTool is instantiated as a dynamic tool with custom content_types (e.g. content_types=['repo']), content_types was accepted in __init__ but not forwarded to super().__init__(**kwargs). As a result, the Pydantic field defaulted to ['code', 'repo', 'pr', 'issue'], causing subsequent searches to unexpectedly index PRs and issues.
Changes
Forward content_types into kwargs in GithubSearchTool.__init__ so Pydantic retains the configured value.
When github_repo is fixed at init, pass self.content_types instead of requiring both parameters to be explicitly truthy.
Added regression test asserting that a tool built with content_types=['repo'] passes ['repo'] to the adapter on add(repo=...).
Note
Low Risk
Narrow initialization fix in GithubSearchTool with a regression test; no auth or data-path changes beyond correct metadata for GitHub indexing.
Overview
Fixes a bug where GithubSearchTool ignored content_types passed at construction on dynamic tools (no fixed github_repo), so indexing still used the default mix of code, repo, PRs, and issues.
__init__ now puts content_types into kwargs before super().__init__, so the Pydantic field keeps the caller’s value. When a repo is fixed at init, add runs whenever github_repo is set and passes self.content_types instead of requiring both repo and an explicit content_types argument.
A regression test checks that a tool built with content_types=['repo'] sends ['repo'] in adapter metadata on add(repo=...).
Reviewed by Cursor Bugbot for commit c5e037b. Bugbot is set up for automated code reviews on this repo. Configure here.
PR summary: Fixes GithubSearchTool so a `content_types` list passed to the constructor is actually retained on the tool instead of falling back to the default set, and applies that configured value when a repository is fixed at init time, with a regression test.
Review summary
Reviewed the four changed lines in GithubSearchTool.__init__ and the added regression test. The change only forwards a caller-supplied content_types list into the Pydantic initializer and uses the instance's own value when a repo is pinned at construction. Traced the value end to end: it lands in the RAG adapter metadata and is consumed by GitHubLoader solely through in membership checks, so no untrusted value reaches a query, command, path, or URL. No authentication or validation control was removed, and the newly reachable add() call is driven by a developer-supplied constructor argument, not attacker input. No security issues found in this diff.
Review 1 on this PR · c5e037b · requested Nov 1 10:55 UTC when the PR was opened
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
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.
Fixes #8888
Summary
When
GithubSearchToolis instantiated as a dynamic tool with customcontent_types(e.g.content_types=['repo']),content_typeswas accepted in__init__but not forwarded tosuper().__init__(**kwargs). As a result, the Pydantic field defaulted to['code', 'repo', 'pr', 'issue'], causing subsequent searches to unexpectedly index PRs and issues.Changes
content_typesintokwargsinGithubSearchTool.__init__so Pydantic retains the configured value.github_repois fixed at init, passself.content_typesinstead of requiring both parameters to be explicitly truthy.content_types=['repo']passes['repo']to the adapter onadd(repo=...).Note
Low Risk
Narrow initialization fix in GithubSearchTool with a regression test; no auth or data-path changes beyond correct metadata for GitHub indexing.
Overview
Fixes a bug where
GithubSearchToolignoredcontent_typespassed at construction on dynamic tools (no fixedgithub_repo), so indexing still used the default mix of code, repo, PRs, and issues.__init__now putscontent_typesintokwargsbeforesuper().__init__, so the Pydantic field keeps the caller’s value. When a repo is fixed at init,addruns whenevergithub_repois set and passesself.content_typesinstead of requiring both repo and an explicitcontent_typesargument.A regression test checks that a tool built with
content_types=['repo']sends['repo']in adapter metadata onadd(repo=...).Reviewed by Cursor Bugbot for commit c5e037b. Bugbot is set up for automated code reviews on this repo. Configure here.