crewAI icon indicating copy to clipboard operation
crewAI copied to clipboard

[BUG] create_crew() loop variable shadows provider parameter (refs #5270)

Open kpdagrt22 opened this issue 1 month ago • 2 comments

Description

In create_crew() (lib/cli/src/crewai_cli/create_crew.py:220), the loop for provider, env_keys in ENV_VARS.items() reuses the name of the provider: str | None parameter. After the loop, provider holds the last iterated key instead of the caller's value. No behavioral break today (later code uses selected_provider), but any future read of provider after the loop silently gets the wrong value.

Reproduced on main@738c8e19: AST walk of create_crew shows the for target provider colliding with the parameter name.

Predecessor #5270 reported the same bug but was closed as NOT_PLANNED by the stale bot (no-issue-activity); the bug is still present, so re-opening per the contributing guide (PRs need a linked open issue).

Proposed fix

Rename the loop variable to env_provider (2-line diff) plus an AST regression test asserting no loop target in create_crew is named provider. PR incoming.

Willingness to Contribute

Yes, PR incoming.


Note for maintainers: this issue was drafted with AI assistance — please apply the llm-generated label per CONTRIBUTING.md (I don't have triage permission to set labels myself).

kpdagrt22 avatar Oct 05 '26 12:10 kpdagrt22

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Nov 05 '26 12:11 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar Nov 11 '26 12:11 github-actions[bot]