fix(cli): honor saved coordinator host - #898
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5daa4a2. Configure here.
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
|
This pull request has been automatically marked as stale because it has had no activity for 14 days. It will be closed in 14 days if no further activity occurs. If this is still relevant, please leave a comment or remove the stale label. |
|
Addressed the missing-config review finding in commit 3aab68d and merged current upstream main. |
Greptile SummaryOrganization and project commands now resolve their coordinator URL from saved login configuration when no connection flags are supplied, while retaining explicit-option and production fallbacks.
Confidence Score: 4/5The PR appears safe to merge after addressing the non-blocking configuration-error handling and required package version update. The intended saved-host precedence is implemented consistently, but invalid existing configuration can now escape from callbacks as a traceback, and the repository-required library version increment is absent. Files Needing Attention: libs/arcade-cli/arcade_cli/utils.py and pyproject.toml
|
| Filename | Overview |
|---|---|
| libs/arcade-cli/arcade_cli/utils.py | Adds centralized saved-URL resolution, but non-missing configuration errors can escape from command callbacks. |
| libs/arcade-cli/arcade_cli/org.py | Changes the organization callback to distinguish an omitted host and delegate coordinator resolution. |
| libs/arcade-cli/arcade_cli/project.py | Applies the same coordinator-resolution behavior to project commands. |
| libs/tests/cli/test_org_project.py | Covers saved coordinator URLs, explicit host precedence, and production fallback, but not invalid configuration files. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Organization or project callback] --> B{Any connection flag supplied?}
B -- Yes --> C[Build URL from explicit options and production host fallback]
B -- No --> D[Load saved configuration]
D --> E{Saved coordinator URL exists?}
E -- Yes --> F[Use saved coordinator URL]
E -- No or file missing --> G[Use production coordinator URL]
Reviews (1): Last reviewed commit: "Merge branch 'main' into agent/use-saved..." | Re-trigger Greptile
| saved_url = Config.load_from_file().coordinator_url | ||
| if saved_url: | ||
| return saved_url | ||
| except FileNotFoundError: | ||
| pass | ||
|
|
There was a problem hiding this comment.
Handle invalid saved configuration
If the saved credentials file is malformed, structurally invalid, or unreadable, Config.load_from_file() raises an exception other than FileNotFoundError; because this now runs in the application callback, organization and project commands terminate with a traceback before their existing user-facing configuration handling runs.
| def resolve_coordinator_url( | ||
| host: str | None, | ||
| port: int | None, | ||
| force_tls: bool, | ||
| force_no_tls: bool, | ||
| ) -> str: | ||
| """Resolve coordinator CLI options, falling back to the saved login host.""" | ||
| if host is None and port is None and not force_tls and not force_no_tls: | ||
| from arcade_core.config_model import Config | ||
|
|
||
| try: | ||
| saved_url = Config.load_from_file().coordinator_url | ||
| if saved_url: | ||
| return saved_url | ||
| except FileNotFoundError: | ||
| pass | ||
|
|
||
| from arcade_core.constants import PROD_COORDINATOR_HOST | ||
|
|
||
| return compute_base_url( | ||
| force_tls, | ||
| force_no_tls, | ||
| host or PROD_COORDINATOR_HOST, | ||
| port, | ||
| default_port=None, | ||
| ) |
There was a problem hiding this comment.
Version the CLI behavior change
This adds new arcade-cli behavior without increasing the version in pyproject.toml, so package consumers and release automation cannot distinguish the changed coordinator resolution behavior from the existing release.
Context Used: Guidelines for library versioning (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| force_no_tls: bool, | ||
| ) -> str: | ||
| """Resolve coordinator CLI options, falling back to the saved login host.""" | ||
| if host is None and port is None and not force_tls and not force_no_tls: |
There was a problem hiding this comment.
suggestion: Gate on if host is None.
Assume the saved coodinator_url is https://coordinator.tenant.example.com
Then,
| Command | Resolves to | |
|---|---|---|
arcade org list |
https://coordinator.tenant.example.com |
correct |
arcade org --host other.com list |
https://other.com |
correct |
arcade org --port 8443 list |
https://cloud.arcade.dev:8443 |
wrong host |
arcade org --tls list |
https://cloud.arcade.dev |
wrong host |
arcade org --no-tls list |
http://cloud.arcade.dev |
wrong host |

Summary
Organization and project commands now use the coordinator URL saved by
arcade loginwhen no connection flags are provided, matching the behavior of the rest of the CLI. Explicit host, port, and TLS flags continue to take precedence.Resolves: #896
Design decisions
The fallback is centralized in
resolve_coordinator_urlso both command groups share the same precedence rules. The visible--hostdefault remains the production coordinator for help output, whileNoneinternally distinguishes an omitted flag from an explicit override.Test plan
uv run pytest libs/tests/cli/test_org_project.py(3 passed)uv run ruff checkfor the changed Python filesuv run ruff format --checkfor the changed Python filesAuthor checklist
Before moving this PR from Draft to Ready for Review:
make checkandmake testare green locally; CI is expected to passNote
Low Risk
Localized CLI connection resolution with clear precedence rules and unit tests; no auth or server-side behavior changes.
Overview
arcade organdarcade projectnow use the coordinator URL from login config when you don't pass--host,--port, or TLS flags—instead of always targeting production.A shared
resolve_coordinator_urlhelper implements precedence: savedcoordinator_urlfrom config when all connection options are omitted; otherwisecompute_base_urlwith explicit flags (e.g.--hoststill overrides the saved URL).--hostdefaults toNoneinternally so "not passed" is distinguishable from an override, while help still shows the production host viashow_default.CLI tests cover saved URL usage, explicit host override, and production fallback when config is missing.
Reviewed by Cursor Bugbot for commit b04ae23. Bugbot is set up for automated code reviews on this repo. Configure here.