fix(search): make ToolsetConfigError actionable and fix misleading docs#188
Conversation
The "Search is disabled" error pointed users at the right cause but
didn't show the exact fix. Updated all 4 raise sites to suggest
search={} or search={"method": "auto"} on the StackOneToolSet
constructor.
Also corrected 3 README examples and 3 docstring examples that called
StackOneToolSet() with no args before invoking search APIs — every
one of those would have raised the same error at runtime.
No behavior change; default remains search=None (disabled).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
No issues found across 2 files
Auto-approved: The changes are limited to improving error messages in toolset.py and fixing misleading documentation in README.md and docstrings, with no behavioral changes to business logic, APIs, or infrastructure.
Re-trigger cubic
There was a problem hiding this comment.
Pull request overview
Improves the developer experience around StackOne tool search by making the “search is disabled” failure mode more actionable and updating documentation examples to avoid runtime ToolsetConfigErrors when using search-enabled modes.
Changes:
- Updates
ToolsetConfigErrormessages at all search-gated call sites to explicitly show the constructor argument needed to enable search (search={}/search={"method": "auto"}). - Fixes
StackOneToolSetusage examples intoolset.pydocstrings forget_search_tool(),openai(mode="search_and_execute"), andpydantic_ai(mode="search_and_execute"). - Updates README snippets to reflect that search must be enabled on the constructor for search-related APIs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
stackone_ai/toolset.py |
Makes search-disabled errors more actionable; corrects docstring examples for search-enabled modes. |
README.md |
Updates search-related snippets to enable search on the constructor and clarifies usage. |
Comments suppressed due to low confidence (3)
stackone_ai/toolset.py:670
- Same as above: README section header is 'Search Tool' (singular), so the exception text should reference that exact heading.
if self._search_config is None:
raise ToolsetConfigError(
"Search is disabled. Pass search={} (or search={'method': 'auto'}) to "
"StackOneToolSet(...) to enable. See README 'Search Tools' for options."
)
stackone_ai/toolset.py:937
- Same heading mismatch: the README section is titled 'Search Tool', not 'Search Tools'.
if self._search_config is None:
raise ToolsetConfigError(
"Search is disabled. Pass search={} (or search={'method': 'auto'}) to "
"StackOneToolSet(...) to enable. See README 'Search Tools' for options."
)
stackone_ai/toolset.py:1091
- Same heading mismatch here: the README section is titled 'Search Tool' (singular).
if self._search_config is None:
raise ToolsetConfigError(
"Search is disabled. Pass search={} (or search={'method': 'auto'}) to "
"StackOneToolSet(...) to enable. See README 'Search Tools' for options."
)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Error message now references README section 'Search Tool' (singular), matching the actual heading at README.md:357. - Basic Usage snippet: add missing StackOneToolSet import, drop the unused fetch_tools line, and pass account_ids on the search call so the snippet runs as written. Addresses Copilot review on #188. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Auto-approved: These changes only improve error messages to be more actionable and fix misleading documentation examples—no runtime behavior is altered and the risk of breakage is negligible.
Re-trigger cubic
Summary
ToolsetConfigError"Search is disabled" message at all 4 raise sites to show the exact constructor arg needed (search={}orsearch={"method": "auto"})StackOneToolSet()with no args before invokingpydantic_ai(mode="search_and_execute"),get_search_tool(), orsearch_tools()— these would all raiseToolsetConfigErrorat runtimeopenai(),pydantic_ai(), andget_search_tool()docstring examples that showed the same misleading patternNo behavior change — default remains
search=None(disabled).Test plan
just lintpassesjust typassesexamples/search_tools.pyagainst a sandbox account to confirm the working path is unaffected🤖 Generated with Claude Code
Summary by cubic
Makes the "Search is disabled" error actionable and points to the correct README section. Fixes examples so search-enabled usage works out of the box. No behavior change; search remains opt-in.
ToolsetConfigErrorsites to suggestsearch={}orsearch={"method": "auto"}and reference README "Search Tool".StackOneToolSet(search={"method": "auto"})before usingpydantic_ai(mode="search_and_execute"),get_search_tool(), orsearch_tools(); fixed Basic Usage snippet (addedStackOneToolSetimport, removed unusedfetch_tools, and passedaccount_idsto the search call).Written for commit 1b7a8c6. Summary will update on new commits. Review in cubic