feat(devtools): bump Flow canary on release - #6830
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe release CLI now validates exact CrewAI pins and updates both Crew and Flow deployment test repositories during prerelease releases. The release documentation reflects the new order, and tests cover repository updates and pin validation. ChangesDeployment release automation
Sequence Diagram(s)sequenceDiagram
participant ReleaseWorkflow
participant DeploymentUpdater
participant CanaryRepository
participant RepositoryFiles
ReleaseWorkflow->>DeploymentUpdater: update all deployment canaries
DeploymentUpdater->>CanaryRepository: clone repository
CanaryRepository->>RepositoryFiles: inspect project and workflow dependencies
RepositoryFiles-->>DeploymentUpdater: return CrewAI requirements
DeploymentUpdater->>DeploymentUpdater: validate exact release pin
DeploymentUpdater->>CanaryRepository: update version and create PR
CanaryRepository-->>ReleaseWorkflow: return repository-specific result
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/devtools/src/crewai_devtools/cli.py`:
- Around line 1461-1469: Update _update_deployment_test_repo to validate that
pyproject.toml or the deployment workflows contain an exact crewai==<version>
pin after _pin_crewai_deps runs. If no expected pin is found, replace the
current warning-only else path with a failure that prevents successful
completion; preserve the existing write and success message when the pin is
updated.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 81dbb194-ac82-4579-9fa4-94fa2334be18
📒 Files selected for processing (3)
lib/devtools/README.mdlib/devtools/src/crewai_devtools/cli.pylib/devtools/tests/test_toml_updates.py
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/devtools/src/crewai_devtools/cli.py`:
- Around line 1441-1468: Update _validate_deployment_repo_crewai_pin and its
matching helper to inspect parsed pyproject.toml dependency fields and
executable workflow installation commands rather than arbitrary raw text.
Collect every effective CrewAI pin, reject any pin differing from version, and
require at least one valid pin; do not treat comments or unrelated commands such
as echo as effective dependencies. Add regression coverage for mixed old/new
pins and comment-only matches.
In `@lib/devtools/tests/test_toml_updates.py`:
- Around line 38-43: Summary: CrewAI pin validation must ignore comments and
unrelated text and verify active dependency or workflow entries. Add a
regression test in test_exact_crewai_pin_accepts_plain_and_extra_dependencies
(or nearby) covering a commented exact pin alongside an invalid active
requirement. Update _validate_deployment_repo_crewai_pin and its validation
helpers to parse actual TOML dependency entries and workflow run commands,
rather than accepting matches from raw content, while preserving support for
plain and extras-qualified exact pins.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f3131eff-107f-4d55-9940-26daa817075b
📒 Files selected for processing (2)
lib/devtools/src/crewai_devtools/cli.pylib/devtools/tests/test_toml_updates.py
…anary-flow-deployment-e2e-tests
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (4)
lib/devtools/tests/test_toml_updates.py (1)
71-86: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winIsolate the ignore behavior so the test can fail.
The pyproject dependency
crewai>=1.0already produces a mismatch. That mismatch alone satisfies themust all pin 2.0.0assertion. If_workflow_crewai_requirementsstarted to acceptecho "crewai==2.0.0", or if the commentedrun:line started to count, this test would still pass. The intended behavior is therefore not covered.Assert the ignore behavior without a competing mismatch: use a pyproject that declares no CrewAI dependency, then require the "No effective CrewAI dependency" error.
💚 Proposed test split
def test_deployment_repo_validation_ignores_comments_and_echo(tmp_path: Path) -> None: workflows = tmp_path / ".github" / "workflows" workflows.mkdir(parents=True) (workflows / "test.yml").write_text( 'run: echo "crewai==2.0.0"\n# run: pip install crewai==2.0.0\n' ) - with pytest.raises(RuntimeError, match=r"must all pin 2\.0\.0"): + with pytest.raises(RuntimeError, match="No effective CrewAI dependency"): _validate_deployment_repo_crewai_pin( tmp_path, - ( - "# documented pin: crewai==2.0.0\n" - '[project]\ndependencies = ["crewai>=1.0"]\n' - ), + '[project]\ndependencies = ["requests>=2"]\n', "2.0.0", ) + + +def test_deployment_repo_validation_ignores_pyproject_comment_pin( + tmp_path: Path, +) -> None: + with pytest.raises(RuntimeError, match=r"must all pin 2\.0\.0"): + _validate_deployment_repo_crewai_pin( + tmp_path, + ( + "# documented pin: crewai==2.0.0\n" + '[project]\ndependencies = ["crewai>=1.0"]\n' + ), + "2.0.0", + )🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/devtools/tests/test_toml_updates.py` around lines 71 - 86, Update test_deployment_repo_validation_ignores_comments_and_echo so the pyproject input declares no CrewAI dependency, removing the competing version mismatch. Expect the "No effective CrewAI dependency" RuntimeError instead, while retaining the workflow content containing the echoed and commented CrewAI requirements to directly verify _workflow_crewai_requirements ignores both.Source: Coding guidelines
lib/devtools/src/crewai_devtools/cli.py (3)
1528-1552: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueExtract the install-command prefixes into a module constant.
The
command_lengthstuple rebuilds four token slices for every token position, and all four comparisons run beforenext()selects one. A module-level table of prefixes makes the supported installers explicit and removes the per-token slice construction.♻️ Proposed refactor
+_INSTALL_COMMAND_PREFIXES: Final[tuple[tuple[str, ...], ...]] = ( + ("python", "-m", "pip", "install"), + ("python3", "-m", "pip", "install"), + ("uv", "pip", "install"), + ("uv", "add"), + ("pip", "install"), + ("pip3", "install"), +)- command_lengths = ( - (tokens[index : index + 3] == ["uv", "pip", "install"], 3), - (tokens[index : index + 2] == ["uv", "add"], 2), - ( - tokens[index : index + 2] - in (["pip", "install"], ["pip3", "install"]), - 2, - ), - ( - tokens[index : index + 4] - in ( - ["python", "-m", "pip", "install"], - ["python3", "-m", "pip", "install"], - ), - 4, - ), - ) - install_length = next( - (length for matched, length in command_lengths if matched), - 0, - ) + install_length = next( + ( + len(prefix) + for prefix in _INSTALL_COMMAND_PREFIXES + if tuple(tokens[index : index + len(prefix)]) == prefix + ), + 0, + )🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/devtools/src/crewai_devtools/cli.py` around lines 1528 - 1552, Extract the four supported install-command token prefixes and their lengths into a module-level constant, then update the loop around the install-command scanning logic to iterate over that table instead of rebuilding command_lengths and token slices at every index. Preserve the existing precedence and install_length behavior for uv, pip/pip3, and python/python3 invocations.
1450-1457: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDocument the three return states.
_crewai_requirement_pinreturnsNone,"", or a version string. The docstring omits theNonecase. Callers usepin is not Noneto decide whether the string is a CrewAI requirement, so the distinction is important.♻️ Proposed docstring update
def _crewai_requirement_pin(requirement: str) -> str | None: - """Return an exact CrewAI pin, or an empty string for a non-exact pin.""" + """Return the pinned CrewAI version for a requirement string. + + Args: + requirement: A single requirement specifier. + + Returns: + ``None`` when the requirement does not name CrewAI, ``""`` when the + requirement names CrewAI without an exact ``==`` pin, otherwise the + pinned version string. + """🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/devtools/src/crewai_devtools/cli.py` around lines 1450 - 1457, Update the _crewai_requirement_pin docstring to explicitly document all three return states: None for non-CrewAI requirements, an empty string for CrewAI requirements without an exact == pin, and the version string for exact pins. Preserve the existing return behavior and caller-facing distinction.Source: Coding guidelines
1478-1511: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoffUse a YAML parser before extracting workflow run commands.
_workflow_run_commandstreats raw lines as YAML. A map key indented deeper than a- run: |line is captured as part of the command, which can introduce false mismatches. Use a YAML reader and normalizejobs.*.steps[*].runvalues.PyYAMLis not currently acrewai-devtoolsdependency, so add it only if this parsing is desired.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/devtools/src/crewai_devtools/cli.py` around lines 1478 - 1511, Update _workflow_run_commands to parse content with a YAML reader before extracting commands, traversing jobs.*.steps[*].run values and normalizing scalar and block values into strings. Add PyYAML as a crewai-devtools dependency if required by the chosen parser, and remove the raw line-based extraction so nested mapping keys cannot become command text.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/devtools/src/crewai_devtools/cli.py`:
- Around line 1574-1576: Update the workflow iteration around
_workflow_crewai_requirements to process only regular files and read each file
with an explicit UTF-8 encoding. Preserve the existing .yml/.yaml filtering and
requirements extension behavior.
---
Nitpick comments:
In `@lib/devtools/src/crewai_devtools/cli.py`:
- Around line 1528-1552: Extract the four supported install-command token
prefixes and their lengths into a module-level constant, then update the loop
around the install-command scanning logic to iterate over that table instead of
rebuilding command_lengths and token slices at every index. Preserve the
existing precedence and install_length behavior for uv, pip/pip3, and
python/python3 invocations.
- Around line 1450-1457: Update the _crewai_requirement_pin docstring to
explicitly document all three return states: None for non-CrewAI requirements,
an empty string for CrewAI requirements without an exact == pin, and the version
string for exact pins. Preserve the existing return behavior and caller-facing
distinction.
- Around line 1478-1511: Update _workflow_run_commands to parse content with a
YAML reader before extracting commands, traversing jobs.*.steps[*].run values
and normalizing scalar and block values into strings. Add PyYAML as a
crewai-devtools dependency if required by the chosen parser, and remove the raw
line-based extraction so nested mapping keys cannot become command text.
In `@lib/devtools/tests/test_toml_updates.py`:
- Around line 71-86: Update
test_deployment_repo_validation_ignores_comments_and_echo so the pyproject input
declares no CrewAI dependency, removing the competing version mismatch. Expect
the "No effective CrewAI dependency" RuntimeError instead, while retaining the
workflow content containing the echoed and commented CrewAI requirements to
directly verify _workflow_crewai_requirements ignores both.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: cdbf8665-0356-4688-a046-642c30857e93
📒 Files selected for processing (2)
lib/devtools/src/crewai_devtools/cli.pylib/devtools/tests/test_toml_updates.py
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
lib/devtools/src/crewai_devtools/cli.py (1)
1630-1636: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winMake workflow pin updates accept plain
crewai==requirements.
_update_workflow_crewai_pinsonly looks forcrewai[...==patterns, while_validate_deployment_repo_crewai_pinaccepts plain exact requirements such asuv pip install "crewai==2.0.0". A workflow with a stale bare pin would be accepted by the validation grammar but not updated, causing the release to fail on the next validation pass. Update_repin_crewai_installso it can rewrite plain crewai exact pins while preserving extras and non-exact requirements.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/devtools/src/crewai_devtools/cli.py` around lines 1630 - 1636, Update _repin_crewai_install, used by _update_repo_workflows_crewai_pins, to recognize and rewrite bare exact crewai== requirements in addition to crewai requirements with extras. Preserve existing extra pins and leave non-exact requirements unchanged, keeping the rewritten version consistent with the requested version.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/devtools/src/crewai_devtools/cli.py`:
- Around line 1515-1522: Update _workflow_crewai_requirements to remove or
decode YAML scalar quoting from each workflow run command before passing it to
shlex, while preserving the embedded shell quoting needed to tokenize install
commands correctly. Add a regression test covering a quoted scalar run value
containing an exact crewai version pin, and verify the requirement is detected.
---
Outside diff comments:
In `@lib/devtools/src/crewai_devtools/cli.py`:
- Around line 1630-1636: Update _repin_crewai_install, used by
_update_repo_workflows_crewai_pins, to recognize and rewrite bare exact crewai==
requirements in addition to crewai requirements with extras. Preserve existing
extra pins and leave non-exact requirements unchanged, keeping the rewritten
version consistent with the requested version.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 7d526964-cc0d-446e-8095-c64614836808
📒 Files selected for processing (2)
lib/devtools/src/crewai_devtools/cli.pylib/devtools/tests/test_toml_updates.py
🚧 Files skipped from review as they are similar to previous changes (1)
- lib/devtools/tests/test_toml_updates.py
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit bb1b32f. Configure here.

What
crewAIInc/crew_deployment_testandcrewAIInc/flow_deployment_testWhy
The Flow release-validation deployment could remain pinned to an older CrewAI version even after a new OSS release was published. That made the enterprise E2E job compare the incoming release against a stale Flow deployment.
Impact
Both persistent canary sources will now be version-aligned with the OSS release before the enterprise release workflow redeploys and validates them.
Validation
uv run pytest lib/devtools/tests(39 passed)uv run ruff check lib/devtools/src/crewai_devtools/cli.py lib/devtools/tests/test_toml_updates.pyuv run ruff format --check lib/devtools/src/crewai_devtools/cli.py lib/devtools/tests/test_toml_updates.pyNote
Medium Risk
Touches the end-to-end release pipeline and external canary repos; mistakes could block releases or leave canaries misaligned, but there is no auth or production runtime code change.
Overview
Release automation now bumps both
crewAIInc/crew_deployment_testandcrewAIInc/flow_deployment_testto the exact OSS CrewAI version (PR + merge wait) before the enterprise release phase, so Flow validation deployments are not left on an older pin.The single-repo helper is generalized via
_update_deployment_test_repos, with post-bump validation that every effectivecrewairequirement inpyproject.tomland real install commands in workflowrunsteps (parsed with PyYAML + shlex) uses==on the target version. Mismatches or missing pins fail the step with clearer resume hints.README release steps and devtools tests cover the dual-canary flow and validation edge cases (quoted installs, multiline runs, non-exact pins, echo/comments).
Reviewed by Cursor Bugbot for commit bb1b32f. Bugbot is set up for automated code reviews on this repo. Configure here.