diff --git a/nanobot/cli/remote.py b/nanobot/cli/remote.py index 65a97e0c6..f9819521c 100644 --- a/nanobot/cli/remote.py +++ b/nanobot/cli/remote.py @@ -127,7 +127,9 @@ def pair( host = _default_host() or typer.prompt("Server public IP or hostname (shown in your cloud console)") typer.echo(f"\nAuthorize {invitation.label} to use nanobot on {ssh_user}@{host}?\nConfig: {config}\nServer fingerprint: {fingerprint(host_key)}") typer.echo("This grants full nanobot WebUI access, including configured tools and settings.\nA dedicated SSH key can only reach this nanobot port; no shell or other forwarding.\nAuthorization lasts 90 days. No existing keys, firewall rules or model settings change.") - typer.confirm("Authorize this computer?", abort=True, default=False) + if not typer.confirm("Authorize this computer?", default=False): + typer.echo("Cancelled. No device was authorized. Run the pairing command again when ready.") + return # Check the service is running before granting access; no credential is sent. import socket diff --git a/tests/cli/test_remote_pair_admin.py b/tests/cli/test_remote_pair_admin.py index 93e34aee6..fc25536b1 100644 --- a/tests/cli/test_remote_pair_admin.py +++ b/tests/cli/test_remote_pair_admin.py @@ -114,8 +114,9 @@ def test_readable_config_still_requires_device_authorization(protected): protected.metadata.side_effect = None protected.metadata.return_value = {"port": 8765} result = CliRunner().invoke(remote.app, protected.args + ["--host", "example.com"], input="n\n") - assert result.exit_code == 1 + assert result.exit_code == 0 assert "Authorize this computer?" in result.output + assert "Cancelled. No device was authorized" in result.output assert "Continue as server administrator?" not in result.output protected.run.assert_not_called() protected.authorize.assert_not_called()