Skip to content

fix(search): make ToolsetConfigError actionable and fix misleading docs#188

Merged
CameronCarlin merged 2 commits into
mainfrom
fix/search-disabled-error-and-docs
May 22, 2026
Merged

fix(search): make ToolsetConfigError actionable and fix misleading docs#188
CameronCarlin merged 2 commits into
mainfrom
fix/search-disabled-error-and-docs

Conversation

@CameronCarlin
Copy link
Copy Markdown
Contributor

@CameronCarlin CameronCarlin commented May 22, 2026

Summary

  • Rewrite the ToolsetConfigError "Search is disabled" message at all 4 raise sites to show the exact constructor arg needed (search={} or search={"method": "auto"})
  • Fix 3 README snippets that called StackOneToolSet() with no args before invoking pydantic_ai(mode="search_and_execute"), get_search_tool(), or search_tools() — these would all raise ToolsetConfigError at runtime
  • Fix openai(), pydantic_ai(), and get_search_tool() docstring examples that showed the same misleading pattern

No behavior change — default remains search=None (disabled).

Test plan

  • just lint passes
  • just ty passes
  • Run examples/search_tools.py against a sandbox account to confirm the working path is unaffected
  • Manually trigger the error to verify the new message renders cleanly

🤖 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.

  • Bug Fixes
    • Updated all four ToolsetConfigError sites to suggest search={} or search={"method": "auto"} and reference README "Search Tool".
    • Corrected README and docstring examples: construct StackOneToolSet(search={"method": "auto"}) before using pydantic_ai(mode="search_and_execute"), get_search_tool(), or search_tools(); fixed Basic Usage snippet (added StackOneToolSet import, removed unused fetch_tools, and passed account_ids to the search call).

Written for commit 1b7a8c6. Summary will update on new commits. Review in cubic

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>
Copilot AI review requested due to automatic review settings May 22, 2026 09:01
cubic-dev-ai[bot]
cubic-dev-ai Bot previously approved these changes May 22, 2026
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ToolsetConfigError messages at all search-gated call sites to explicitly show the constructor argument needed to enable search (search={} / search={"method": "auto"}).
  • Fixes StackOneToolSet usage examples in toolset.py docstrings for get_search_tool(), openai(mode="search_and_execute"), and pydantic_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.

Comment thread README.md
Comment thread stackone_ai/toolset.py
- 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>
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@CameronCarlin CameronCarlin merged commit d332c27 into main May 22, 2026
16 checks passed
@CameronCarlin CameronCarlin deleted the fix/search-disabled-error-and-docs branch May 22, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants