fix(cli): honor --provider flag in create_crew() and fix loop variable shadow#5721
Open
Beandon13 wants to merge 1 commit intocrewAIInc:mainfrom
Open
fix(cli): honor --provider flag in create_crew() and fix loop variable shadow#5721Beandon13 wants to merge 1 commit intocrewAIInc:mainfrom
Beandon13 wants to merge 1 commit intocrewAIInc:mainfrom
Conversation
…e shadow The for-loop `for provider, env_keys in ENV_VARS.items()` was shadowing the `provider` function parameter, and the rest of the function always called `select_provider()` interactively regardless of whether `--provider` was supplied on the CLI. Two changes: 1. Rename the loop variable to `env_provider` so the original `provider` parameter is no longer overwritten. 2. When `provider` is non-None (passed via --provider), skip the interactive provider-selection loop and use it directly as `selected_provider`. Closes crewAIInc#5270 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Author
|
Heads-up: this PR overlaps with open #5272 (and similarly-scoped closed #5401, #5274) on the loop-variable rename. The new behavior here on top of the rename is honoring the
Either way the rename overlap is acknowledged. |
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.
Summary
for provider, env_keys in ENV_VARS.items()loop was silently overwriting theproviderfunction parameter, making the--providerCLI flag a no-opselect_provider()prompt regardless of whether--provider openaiwas passedenv_provider(eliminating the shadow) and added an early-out path that uses the suppliedproviderdirectly when it is non-NoneCloses #5270
Testing