Skip to content

fix(providers): declare bedrock + vertex extras and add provider import-error hints#588

Open
Rome-1 wants to merge 2 commits into
usestrix:mainfrom
Rome-1:fix/provider-optional-extras
Open

fix(providers): declare bedrock + vertex extras and add provider import-error hints#588
Rome-1 wants to merge 2 commits into
usestrix:mainfrom
Rome-1:fix/provider-optional-extras

Conversation

@Rome-1

@Rome-1 Rome-1 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Fixes #574
Fixes #573

The Bedrock and Vertex AI provider docs already instruct users to run pipx install "strix-agent[bedrock]" / strix-agent[vertex], but pyproject.toml never declared a [project.optional-dependencies] table — so those extras don't exist and the install silently omits boto3 / google-auth. Starting a scan then crashes at LLM warm-up with ImportError: Missing boto3 to call bedrock (#574) or No module named 'google' (#573). This PR adds bedrock = ["boto3>=1.28.0"] and vertex = ["google-auth>=2.0.0"] so the documented install commands actually pull the provider SDKs, adds the previously-missing ## Installation section to docs/llm-providers/bedrock.mdx (mirroring vertex.mdx), and introduces a pure _provider_import_hint() helper that maps a missing-provider ImportError back to the matching pip install "strix-agent[...]" hint in the warm-up error panel. The change is purely additive — no existing behavior is altered.

Testing

  • pytest tests/test_optional_deps.py tests/test_provider_hints.py — 6 passed. The first tomllib-parses pyproject.toml and asserts both extras pin google-auth / boto3; the second unit-tests _provider_import_hint (bedrock+boto3 and vertex+google-auth return a pip install hint; ConnectionError and openai/gpt-4 return None). Both files fail without the source change (KeyError on the missing extras table; ImportError importing the missing helper).
  • ruff check + ruff format --check — clean on all changed files.
  • pyupgrade --py312-plus — no rewrites.
  • bandit — clean on strix/interface/main.py (only B101 assert-in-tests notices in the test files).
  • Note: the repo's pinned pre-commit mypy hook crashes with an internal error on the bundled openai SDK on main as well, so mypy was not run as a gate here.
…rt hints (usestrix#574)

Declare [project.optional-dependencies] with vertex (google-auth) and
bedrock (boto3) extras so "strix-agent[vertex]" / "strix-agent[bedrock]"
install the provider SDKs. Add an Installation section to the Bedrock docs
mirroring Vertex, and a _provider_import_hint helper in warm_up_llm that
surfaces a pip-install hint when a provider dependency is missing.

Fixes usestrix#574, usestrix#573

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes the root cause of two reported crashes (#573, #574) by adding the previously missing [project.optional-dependencies] table to pyproject.toml, so pipx install "strix-agent[bedrock]" and strix-agent[vertex] now actually pull their provider SDKs. It also adds a _provider_import_hint() helper that maps a missing-provider ImportError back to the matching install command in the warm-up error panel, and fills in the missing ## Installation section in bedrock.mdx.

  • pyproject.toml: Adds bedrock = ["boto3>=1.28.0"] and vertex = ["google-auth>=2.0.0"] optional extras; lock file updated accordingly with full transitive closure.
  • strix/interface/main.py: Introduces _provider_import_hint() and wires it into the warm_up_llm error panel; raw_model is initialised before the try block so the model name is always available in the except handler.
  • Tests: Two new test files verify the extras are declared in pyproject.toml and exercise all matching branches of the hint helper.

Confidence Score: 4/5

The core fix is correct and additive; the only concern is a cosmetic mismatch between the runtime hint and the documented install method.

The pyproject.toml fix is straightforward and directly resolves the reported crashes. The _provider_import_hint helper is well-tested and purely additive. The hint strings say pip install while the docs consistently use pipx install — a user who installed via pipx would be pointed to the wrong tool when trying to fix the missing extra.

The two hint strings in strix/interface/main.py (lines 230 and 232) should be updated to match the pipx install command used in the documentation.

Important Files Changed

Filename Overview
pyproject.toml Adds the missing [project.optional-dependencies] table with correct bedrock (boto3>=1.28.0) and vertex (google-auth>=2.0.0) extras, resolving the root cause of the bugs.
strix/interface/main.py Adds _provider_import_hint() helper and wires it into the warm_up_llm error panel; hint strings say "pip install" while the docs consistently use "pipx install".
docs/llm-providers/bedrock.mdx Adds the previously missing Installation section, correctly mirroring the vertex.mdx pattern with the pipx install command.
tests/test_optional_deps.py New test file that parses pyproject.toml via tomllib and asserts both extras are present; straightforward and correct.
tests/test_provider_hints.py New test file covering all four hint-matching branches of _provider_import_hint(); covers both positive and negative cases cleanly.
uv.lock Lock file updated to include boto3, botocore, google-auth, and their transitive dependencies as expected for the new optional extras.
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
strix/interface/main.py:229-232
The install command in the hint says `pip install` but the docs (and the new `bedrock.mdx` Installation section) consistently tell users to use `pipx install "strix-agent[bedrock]"`. A user who installed via pipx cannot fix the missing extra with `pip install` — that would land the package in the wrong environment. The hint should mirror the documented install command, or at minimum use `pipx inject strix-agent` which is the canonical way to add extras to a pipx-managed tool.

```suggestion
    if "boto3" in message and model_name.startswith("bedrock/"):
        return 'Bedrock support is optional. Install it with: pipx install "strix-agent[bedrock]"'
    if "google" in message and "vertex" in model_name:
        return 'Vertex AI support is optional. Install it with: pipx install "strix-agent[vertex]"'
```

Reviews (1): Last reviewed commit: "feat: add bedrock + vertex optional extr..." | Re-trigger Greptile

Comment thread strix/interface/main.py Outdated
Comment on lines +229 to +232
if "boto3" in message and model_name.startswith("bedrock/"):
return 'Bedrock support is optional. Install it with: pip install "strix-agent[bedrock]"'
if "google" in message and "vertex" in model_name:
return 'Vertex AI support is optional. Install it with: pip install "strix-agent[vertex]"'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 The install command in the hint says pip install but the docs (and the new bedrock.mdx Installation section) consistently tell users to use pipx install "strix-agent[bedrock]". A user who installed via pipx cannot fix the missing extra with pip install — that would land the package in the wrong environment. The hint should mirror the documented install command, or at minimum use pipx inject strix-agent which is the canonical way to add extras to a pipx-managed tool.

Suggested change
if "boto3" in message and model_name.startswith("bedrock/"):
return 'Bedrock support is optional. Install it with: pip install "strix-agent[bedrock]"'
if "google" in message and "vertex" in model_name:
return 'Vertex AI support is optional. Install it with: pip install "strix-agent[vertex]"'
if "boto3" in message and model_name.startswith("bedrock/"):
return 'Bedrock support is optional. Install it with: pipx install "strix-agent[bedrock]"'
if "google" in message and "vertex" in model_name:
return 'Vertex AI support is optional. Install it with: pipx install "strix-agent[vertex]"'
Prompt To Fix With AI
This is a comment left during a code review.
Path: strix/interface/main.py
Line: 229-232

Comment:
The install command in the hint says `pip install` but the docs (and the new `bedrock.mdx` Installation section) consistently tell users to use `pipx install "strix-agent[bedrock]"`. A user who installed via pipx cannot fix the missing extra with `pip install` — that would land the package in the wrong environment. The hint should mirror the documented install command, or at minimum use `pipx inject strix-agent` which is the canonical way to add extras to a pipx-managed tool.

```suggestion
    if "boto3" in message and model_name.startswith("bedrock/"):
        return 'Bedrock support is optional. Install it with: pipx install "strix-agent[bedrock]"'
    if "google" in message and "vertex" in model_name:
        return 'Vertex AI support is optional. Install it with: pipx install "strix-agent[vertex]"'
```

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch — switched both hints to pipx install "strix-agent[bedrock]" / [vertex] to match the docs, and updated the test assertion. Pushed.

A pipx-installed strix can't add an extra with 'pip install' (wrong env);
mirror the documented 'pipx install "strix-agent[...]"' command. Addresses
Greptile review.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant