Skip to content

Open deployment page after CLI deploy#6343

Merged
joaomdmoura merged 5 commits into
mainfrom
codex/open-deployment-browser
Jun 26, 2026
Merged

Open deployment page after CLI deploy#6343
joaomdmoura merged 5 commits into
mainfrom
codex/open-deployment-browser

Conversation

@joaomdmoura

@joaomdmoura joaomdmoura commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • open the CrewAI deployment show page in the browser after successful CLI deploy/create responses
  • build the show-page URL from deployment_id/deploymentId/id, falling back to uuid
  • keep browser launch failures non-fatal and covered by deploy tests

Tests

  • uv run ruff check lib/cli/src/crewai_cli/deploy/main.py lib/cli/tests/deploy/test_deploy_main.py
  • uv run pytest lib/cli/tests/deploy/test_deploy_main.py

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 to DEFAULT_CREWAI_ENTERPRISE_URL) as {base}/crewai_plus/deployments/{id}, picking an identifier from deployment_id / deploymentId, then nested or top-level id / uuid. If webbrowser.open fails 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

    • Deployment output now includes a link to the deployment’s web page.
    • When a deployment is shown or created, the CLI can automatically open that page in your browser.
  • Bug Fixes

    • Improved deployment ID detection to support multiple response formats.
    • If the browser can’t be opened, the CLI now shows a warning instead of failing.
  • Tests

    • Added unit tests covering deployment page URL generation and browser-opening behavior.

@corridor-security corridor-security Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The 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.

Changes

Deployment show-page opening

Layer / File(s) Summary
URL helpers
lib/cli/src/crewai_cli/deploy/main.py
Adds quote and webbrowser, plus helpers that extract deployment identifiers from top-level and nested payload keys and format show-page URLs.
Browser open wiring
lib/cli/src/crewai_cli/deploy/main.py
Calls _open_deployment_page after deployment details and creation success, resolves the base URL from plus_api_client.base_url or the enterprise default, and prints a warning when browser opening fails.
Tests
lib/cli/tests/deploy/test_deploy_main.py
Adds tests for top-level and nested identifier URL generation, patches webbrowser.open in setup, and asserts deployment info output includes the show-page URL and open call.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 52.38% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: opening the deployment page after CLI deploy.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/open-deployment-browser

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/open-deployment-browser

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread lib/cli/src/crewai_cli/deploy/main.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
lib/cli/tests/deploy/test_deploy_main.py (1)

301-312: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add 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

📥 Commits

Reviewing files that changed from the base of the PR and between 5d4851e and 7032022.

📒 Files selected for processing (2)
  • lib/cli/src/crewai_cli/deploy/main.py
  • lib/cli/tests/deploy/test_deploy_main.py

Comment thread lib/cli/src/crewai_cli/deploy/main.py
@github-actions github-actions Bot added size/M and removed size/S labels Jun 26, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread lib/cli/src/crewai_cli/deploy/main.py
@joaomdmoura joaomdmoura merged commit e10c17f into main Jun 26, 2026
56 of 89 checks passed
@joaomdmoura joaomdmoura deleted the codex/open-deployment-browser branch June 26, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants