From 1fa604f69463fecfa7e63d09bdbd294fc71c2705 Mon Sep 17 00:00:00 2001 From: l2and Date: Thu, 30 Jul 2026 17:33:27 -0700 Subject: [PATCH] fix(cli): address PR review warnings - Skip known cloud LANGSMITH_ENDPOINT values so SaaS users' tracing env var doesn't hijack the deploy host URL - Fix --image-uri help text to accurately describe build+push+deploy flow instead of claiming no build step - Validate existing deployment source before PATCHing with --image-uri to give a clear error on incompatible deployments - Move /api-host path strip before localhost check in _smith_dashboard_base_url so local self-hosted status URLs work - Fix test_constructor_strips_trailing_slash to use base_url property instead of removed httpx base_url - Apply ruff formatting --- libs/cli/langgraph_cli/deploy.py | 9 +++++---- libs/cli/tests/unit_tests/test_host_backend.py | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libs/cli/langgraph_cli/deploy.py b/libs/cli/langgraph_cli/deploy.py index de644f182..8c4765163 100644 --- a/libs/cli/langgraph_cli/deploy.py +++ b/libs/cli/langgraph_cli/deploy.py @@ -1371,7 +1371,10 @@ def _create_host_backend_client( langsmith_endpoint = env_vars.get("LANGSMITH_ENDPOINT") or os.environ.get( "LANGSMITH_ENDPOINT" ) - if langsmith_endpoint and langsmith_endpoint.rstrip("/") not in _cloud_endpoints: + if ( + langsmith_endpoint + and langsmith_endpoint.rstrip("/") not in _cloud_endpoints + ): from urllib.parse import urlparse as _urlparse _p = _urlparse(langsmith_endpoint) @@ -1818,9 +1821,7 @@ def _deploy_cmd( existing = _call_host_backend_with_optional_tenant( client, lambda c: c.get_deployment(deployment_id) ) - existing_source = ( - existing.get("source") if isinstance(existing, dict) else None - ) + existing_source = existing.get("source") if isinstance(existing, dict) else None if existing_source and existing_source != "external_docker": raise click.UsageError( f"Deployment {deployment_id} was created with source " diff --git a/libs/cli/tests/unit_tests/test_host_backend.py b/libs/cli/tests/unit_tests/test_host_backend.py index 85c2a93d5..2be709fdf 100644 --- a/libs/cli/tests/unit_tests/test_host_backend.py +++ b/libs/cli/tests/unit_tests/test_host_backend.py @@ -25,7 +25,7 @@ def client(mock_transport): def test_constructor_strips_trailing_slash(): c = HostBackendClient("https://api.example.com/", "key") - assert str(c._client.base_url) == "https://api.example.com" + assert c.base_url == "https://api.example.com" def test_constructor_empty_url_raises():