Open deployment page after CLI deploy#6343
Conversation
There was a problem hiding this comment.
Summary: This PR adds CLI behavior to construct and open a deployment page URL after successful deploy/create responses, with deployment identifiers URL-encoded before use.
Risk: Low risk. No exploitable security vulnerabilities were identified; the change does not alter authentication, authorization, server-side resource access, or data mutation paths, and the browser-opening behavior is limited to locally displayed deployment URLs.
📝 WalkthroughWalkthroughThe deploy CLI now builds a deployment show-page URL from response data and opens it after deployment output. Tests cover identifier selection, URL formatting, and browser open behavior. ChangesDeployment show-page opening
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
|
Caution Review failedAn error occurred during the review process. Please try again later. ✨ Finishing Touches🧪 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
🧹 Nitpick comments (1)
lib/cli/tests/deploy/test_deploy_main.py (1)
301-312: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a regression test for the browser-failure path.
This only locks in the happy path. Please add a case where opening the browser fails so the non-fatal warning behavior stays covered too.
🤖 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/cli/tests/deploy/test_deploy_main.py` around lines 301 - 312, Add a regression test covering the browser-open failure path in the deploy flow so the warning behavior stays protected. Extend the existing deploy tests around the deploy command handling in test_deploy_main and the browser launch call to simulate the browser open helper throwing an error, then assert the command still completes and emits the non-fatal warning message. Keep the existing happy-path assertions intact and add the new failure-case coverage next to the deploy main test that currently checks the deployment URL and mock_browser_open call.
🤖 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/cli/src/crewai_cli/deploy/main.py`:
- Around line 224-231: The deployment page launch in the deploy flow only
handles exceptions, but webbrowser.open can also fail by returning False without
raising. Update the deployment page opening logic in the deploy main flow to
check the return value from webbrowser.open and, when it is False, emit the same
fallback warning message used in the exception path. Keep the handling localized
around the existing deployment_url open call so the console warning is shown for
both failure modes.
---
Nitpick comments:
In `@lib/cli/tests/deploy/test_deploy_main.py`:
- Around line 301-312: Add a regression test covering the browser-open failure
path in the deploy flow so the warning behavior stays protected. Extend the
existing deploy tests around the deploy command handling in test_deploy_main and
the browser launch call to simulate the browser open helper throwing an error,
then assert the command still completes and emits the non-fatal warning message.
Keep the existing happy-path assertions intact and add the new failure-case
coverage next to the deploy main test that currently checks the deployment URL
and mock_browser_open call.
🪄 Autofix (Beta)
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: 276924cd-61bc-43bf-8d7e-23d725eacbed
📒 Files selected for processing (2)
lib/cli/src/crewai_cli/deploy/main.pylib/cli/tests/deploy/test_deploy_main.py
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes 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 baea507. Configure here.

Summary
Tests
Note
Low Risk
CLI-only UX after successful deploy/create; no auth, API, or deployment pipeline changes.
Overview
After a successful deploy or create, the CLI now prints the Enterprise deployment show URL and tries to open it in the default browser.
URLs are built from the Plus API
base_url(with fallback toDEFAULT_CREWAI_ENTERPRISE_URL) as{base}/crewai_plus/deployments/{id}, picking an identifier fromdeployment_id/deploymentId, then nested or top-levelid/uuid. Ifwebbrowser.openfails or returns false, the command still succeeds and shows a yellow warning.Unit tests cover URL precedence and browser-open success and failure paths on
_display_deployment_info.Reviewed by Cursor Bugbot for commit ff36dd8. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
New Features
Bug Fixes
Tests