Skip to content

Fix deployment page link id resolution#6365

Merged
joaomdmoura merged 1 commit into
mainfrom
codex/fix-deployment-page-id
Jun 27, 2026
Merged

Fix deployment page link id resolution#6365
joaomdmoura merged 1 commit into
mainfrom
codex/fix-deployment-page-id

Conversation

@joaomdmoura

@joaomdmoura joaomdmoura commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • stop using crew UUIDs as /crewai_plus/deployments/:id URL identifiers
  • resolve UUID-only create/deploy responses through the status endpoint to get the numeric deployment id
  • skip browser opening instead of opening a known-bad UUID URL when the numeric id cannot be resolved

Tests

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

Note

Low Risk
Scoped to CLI post-deploy browser URL building and identifier parsing; failures are swallowed without affecting deploy success.

Overview
Fixes broken deployment links after create/deploy when the API response only includes a crew UUID, not the numeric deployment id the /crewai_plus/deployments/:id route expects.

Identifier resolution no longer treats uuid as a fallback deployment id (including nested deployment.uuid). DeployCommand._deployment_page_url still builds a URL from deployment_id / id when present; otherwise it calls crew_status_by_uuid and uses the status payload’s id. If that lookup fails, the CLI does not open the browser with a UUID URL.

Reviewed by Cursor Bugbot for commit 19f4cd6. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • Bug Fixes
    • Improved deployment page URL resolution by relying on the correct identifier returned from status responses, ensuring the browser opens the right deployment page.
    • Prevents opening deployment links when status lookup fails, avoiding broken or incorrect URLs.
    • Tightened fallback behavior so unsupported identifiers (such as nested UUID-only values) no longer produce invalid deployment-page links.

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Deploy command URL resolution now distinguishes numeric deployment IDs from UUID-only payloads, extracts crew UUIDs from deployment/status responses, and falls back to a status lookup before opening the deployment page. Tests cover the new UUID-only and failure paths.

Changes

UUID-only deployment page resolution

Layer / File(s) Summary
UUID extraction keys
lib/cli/src/crewai_cli/deploy/main.py, lib/cli/tests/deploy/test_deploy_main.py
_DEPLOYMENT_FALLBACK_IDENTIFIER_KEYS now only includes id, and the deployment page test now expects deployment.uuid alone to return None.
Status-based page resolution
lib/cli/src/crewai_cli/deploy/main.py, lib/cli/tests/deploy/test_deploy_main.py
_open_deployment_page now calls _deployment_page_url, which can resolve a UUID-only response through crew_status_by_uuid; tests cover the successful lookup path and the failed lookup path.

Sequence Diagram(s)

sequenceDiagram
  participant DeployCommand
  participant plus_api_client
  participant browser

  DeployCommand->>plus_api_client: crew_status_by_uuid(crew_uuid)
  alt status lookup succeeds
    plus_api_client-->>DeployCommand: status_response
    DeployCommand->>DeployCommand: _deployment_identifier_from_status(status_response)
    DeployCommand->>browser: open(deployment_page_url)
  else status lookup fails
    plus_api_client-->>DeployCommand: failure / invalid payload
  end
Loading

Suggested reviewers

  • vinibrsl
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 45.45% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely matches the main change: fixing deployment page link ID resolution.
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.
✨ 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/fix-deployment-page-id

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

🧹 Nitpick comments (1)
lib/cli/src/crewai_cli/deploy/main.py (1)

261-278: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Confusing name collision with swapped argument order.

The instance method _deployment_page_url(self, json_response, base_url) shares its name with the module-level _deployment_page_url(base_url, json_response) but reverses the parameter order. The current call on Line 267 is correct, but this collision is fragile: a future edit that accidentally swaps the arguments (or prefixes the call with self.) would silently build a wrong URL or recurse. Consider renaming one of them (e.g., the module helper to _build_deployment_page_url) and aligning parameter order.

🤖 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/src/crewai_cli/deploy/main.py` around lines 261 - 278, The deployment
URL helpers have a confusing name collision: the instance method
_deployment_page_url(self, json_response, base_url) and the module-level
_deployment_page_url(base_url, json_response) use opposite argument order, which
is easy to misuse later. Rename one of them, such as the module helper to
_build_deployment_page_url, and make the parameter order consistent at the call
site in the _deployment_page_url method so the logic remains unambiguous and
avoids accidental recursion or malformed URLs.
🤖 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.

Nitpick comments:
In `@lib/cli/src/crewai_cli/deploy/main.py`:
- Around line 261-278: The deployment URL helpers have a confusing name
collision: the instance method _deployment_page_url(self, json_response,
base_url) and the module-level _deployment_page_url(base_url, json_response) use
opposite argument order, which is easy to misuse later. Rename one of them, such
as the module helper to _build_deployment_page_url, and make the parameter order
consistent at the call site in the _deployment_page_url method so the logic
remains unambiguous and avoids accidental recursion or malformed URLs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 95f4a1f2-80fa-4b70-8dfc-94e04d0a9407

📥 Commits

Reviewing files that changed from the base of the PR and between e1ddb32 and ae7392f.

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

@alex-clawd alex-clawd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Clean fix — proper separation of crew UUID vs numeric deployment ID, graceful degradation when status lookup fails, good test coverage on both paths.

@joaomdmoura joaomdmoura force-pushed the codex/fix-deployment-page-id branch from ae7392f to 19f4cd6 Compare June 27, 2026 06:13

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

🧹 Nitpick comments (1)
lib/cli/src/crewai_cli/deploy/main.py (1)

242-259: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Method shares a name with the module-level helper, which is easy to misread.

The instance method _deployment_page_url and the module-level function _deployment_page_url have the same name with a swapped argument order. It works because the bare call on Line 248 resolves to the module global (class scope isn't visible in method bodies), but the collision plus the reversed (base_url, json_response) vs (json_response, base_url) signatures is a readability trap. Consider renaming one (e.g., _resolve_deployment_page_url) to make the delegation explicit.

🤖 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/src/crewai_cli/deploy/main.py` around lines 242 - 259, The instance
method and module-level helper share the same _deployment_page_url name, and the
swapped argument order makes the delegation hard to read. Rename one of them,
preferably the instance method in the Deploy CLI class, to something like
_resolve_deployment_page_url, and update the internal call so it is explicit
which helper is being used. Keep the module-level helper’s behavior unchanged,
but make the method-to-helper delegation in deploy/main.py unambiguous.
🤖 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.

Nitpick comments:
In `@lib/cli/src/crewai_cli/deploy/main.py`:
- Around line 242-259: The instance method and module-level helper share the
same _deployment_page_url name, and the swapped argument order makes the
delegation hard to read. Rename one of them, preferably the instance method in
the Deploy CLI class, to something like _resolve_deployment_page_url, and update
the internal call so it is explicit which helper is being used. Keep the
module-level helper’s behavior unchanged, but make the method-to-helper
delegation in deploy/main.py unambiguous.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2c1b3148-aed2-4829-8697-73b5eb350ef2

📥 Commits

Reviewing files that changed from the base of the PR and between ae7392f and 19f4cd6.

📒 Files selected for processing (2)
  • lib/cli/src/crewai_cli/deploy/main.py
  • lib/cli/tests/deploy/test_deploy_main.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • lib/cli/tests/deploy/test_deploy_main.py

@alex-clawd alex-clawd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Simplified nicely — direct uuid lookup instead of the helper abstraction. Clean and sufficient.

@joaomdmoura joaomdmoura merged commit 04adff1 into main Jun 27, 2026
56 checks passed
@joaomdmoura joaomdmoura deleted the codex/fix-deployment-page-id branch June 27, 2026 06:19
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