Skip to content

Commit d050f3f

Browse files
authored
fix(cli): don't print unqualified Setup complete when no default model was set (#1354)
_run_auto_mode already detects when model discovery finds nothing and prints a warning (No default model set), but the function still fell through to an unconditional green "Setup complete!" a few lines later if the platform health check passed. A user running `nemo setup --auto` against a working key but the wrong inference endpoint (or any other path that leaves the model registry empty) saw a clean success message despite the platform being non-functional for inference. Gate the final banner on whether a default model was actually set: show the existing green message only when one was, otherwise show "Setup complete with warnings" and point back at the warnings already printed above. The API key validation itself is intentionally fail-open on anything short of a definitive 401/403 rejection (see _validate_api_key's docstring); that's a deliberate design choice for tolerating ambiguous or unreachable providers, and this change doesn't touch it. It only fixes the final message not reflecting a degraded state the function already knew about. Applied identically to both copies of this function: the SDK's nemo_platform.cli.commands.setup and the separately-maintained nemo_platform_ext.cli.commands.setup (see packages/nemo_platform_ext/README.md). Fixes NMP-14. Signed-off-by: Yamini <ykagal@gmail.com>
1 parent 137a5e5 commit d050f3f

4 files changed

Lines changed: 68 additions & 4 deletions

File tree

  • packages/nemo_platform_ext
  • sdk/python/nemo-platform

packages/nemo_platform_ext/src/nemo_platform_ext/cli/commands/setup.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2356,10 +2356,14 @@ def _run_auto_mode(
23562356
headers=_platform_request_headers(cli_context),
23572357
)
23582358

2359-
if _verify_platform_health(base_url):
2359+
if not _verify_platform_health(base_url):
2360+
raise typer.Exit(1)
2361+
2362+
if default_model:
23602363
console.print(f"\n{CHECK} [green]Setup complete![/green]")
23612364
else:
2362-
raise typer.Exit(1)
2365+
console.print(f"\n{WARN} [yellow]Setup complete with warnings.[/yellow]")
2366+
console.print(" No default model was set; review the warnings above before using the platform.")
23632367

23642368

23652369
def _run_interactive_mode(

packages/nemo_platform_ext/tests/cli/commands/test_setup.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2279,6 +2279,34 @@ def test_fast_override_without_default_warns_and_is_not_saved(self):
22792279

22802280
save_pair.assert_not_called()
22812281
assert any("NEMO_FAST_MODEL is ignored" in call.args[0] for call in print_message.call_args_list)
2282+
printed = " ".join(str(c) for c in print_message.call_args_list)
2283+
assert "Setup complete with warnings" in printed
2284+
assert "[green]Setup complete![/green]" not in printed
2285+
2286+
def test_setup_complete_is_unqualified_when_default_model_is_set(self):
2287+
cli_context = MagicMock()
2288+
with (
2289+
patch.dict("os.environ", {}, clear=True),
2290+
patch(f"{SETUP_MOD}._auto_setup", return_value="openai"),
2291+
patch(f"{SETUP_MOD}._get_all_model_entity_ids", return_value=["default/a-model"]),
2292+
patch(f"{SETUP_MOD}._save_model_pair"),
2293+
patch(f"{SETUP_MOD}._maybe_install_skills"),
2294+
patch(f"{SETUP_MOD}._maybe_deploy_agent"),
2295+
patch(f"{SETUP_MOD}._verify_platform_health", return_value=True),
2296+
patch(f"{SETUP_MOD}.console.print") as print_message,
2297+
):
2298+
_run_auto_mode(
2299+
cli_context,
2300+
MagicMock(),
2301+
"default",
2302+
"http://localhost:8080",
2303+
install_skills=False,
2304+
deploy_agent=False,
2305+
)
2306+
2307+
printed = " ".join(str(c) for c in print_message.call_args_list)
2308+
assert "[green]Setup complete![/green]" in printed
2309+
assert "Setup complete with warnings" not in printed
22822310

22832311

22842312
# ---------------------------------------------------------------------------

sdk/python/nemo-platform/src/nemo_platform/cli/commands/setup.py

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/python/nemo-platform/tests/vendored/nemo_platform_ext/cli/commands/test_setup.py

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)