From 0972762945b908f8363550684da3cc961ea0db7b Mon Sep 17 00:00:00 2001 From: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com> Date: Mon, 7 Sep 2026 11:58:29 +0530 Subject: [PATCH] fix(cli): honor skip_confirmation on @run.cli.entrypoint Entrypoint.skip_confirmation was stored but never forwarded to the generated CLI command, so @run.cli.entrypoint(skip_confirmation=True) still prompted 'Continue?' on every non-dryrun invocation (the --yes flag or run.skip_confirmation=True were required instead). _add_executor_command now seeds the command defaults with the entrypoint's skip_confirmation value. Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com> --- nemo_run/cli/api.py | 4 ++++ test/cli/test_api.py | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/nemo_run/cli/api.py b/nemo_run/cli/api.py index e05b921f..4d7ce553 100644 --- a/nemo_run/cli/api.py +++ b/nemo_run/cli/api.py @@ -1521,6 +1521,10 @@ def _add_executor_command( class CLITaskCommand(EntrypointCommand): _entrypoint = self + cmd_defaults = dict(cmd_defaults) if cmd_defaults else {} + if self.skip_confirmation: + cmd_defaults.setdefault("skip_confirmation", True) + return self.run_ctx_cls.cli_command( parent, self.name, diff --git a/test/cli/test_api.py b/test/cli/test_api.py index da359c12..7dc2b3c5 100644 --- a/test/cli/test_api.py +++ b/test/cli/test_api.py @@ -736,6 +736,32 @@ def test_parse_partial_function_call(self): assert partial.dummy.hidden == 100 assert partial.dummy.activation == "tanh" + @patch("typer.confirm", return_value=False) + @patch("nemo_run.dryrun_fn") + @patch("nemo_run.run") + def test_skip_confirmation_entrypoint_does_not_prompt( + self, mock_run, mock_dryrun_fn, mock_confirm, runner + ): + """@run.cli.entrypoint(skip_confirmation=True) must skip the confirmation prompt.""" + + @run.cli.entrypoint(namespace="test_skip_confirm", skip_confirmation=True) + def task(value: int = 1): + return value + + @run.cli.entrypoint(namespace="test_skip_confirm") + def other_task(value: int = 1): + return value + + app = typer.Typer() + other_task.cli_entrypoint.cli(app) + task.cli_entrypoint.cli(app) + + result = runner.invoke(app, ["task", "value=2"], env={"INCLUDE_WORKSPACE_FILE": "false"}) + + assert result.exit_code == 0, result.output + mock_confirm.assert_not_called() + mock_run.assert_called_once() + def test_with_factory(self, runner, app): # Test CLI execution with default factory result = runner.invoke(