From bfbae5a7b3d1ded5e165ea5a263198d47f082b86 Mon Sep 17 00:00:00 2001 From: hamb1y Date: Sun, 28 Jun 2026 10:17:14 +0530 Subject: [PATCH] fix(cli): refresh oauth provider default models --- nanobot/cli/commands.py | 4 ++-- tests/cli/test_commands.py | 31 ++++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/nanobot/cli/commands.py b/nanobot/cli/commands.py index d471b746..b3da8b78 100644 --- a/nanobot/cli/commands.py +++ b/nanobot/cli/commands.py @@ -1745,8 +1745,8 @@ _PROVIDER_DISPLAY: dict[str, str] = { } _OAUTH_PROVIDER_DEFAULT_MODELS: dict[str, str] = { - "openai_codex": "openai-codex/gpt-5.1-codex", - "github_copilot": "github-copilot/gpt-4.1", + "openai_codex": "openai-codex/gpt-5.4-mini", + "github_copilot": "github-copilot/gpt-5.4-mini", } diff --git a/tests/cli/test_commands.py b/tests/cli/test_commands.py index 817ea38a..1a43316f 100644 --- a/tests/cli/test_commands.py +++ b/tests/cli/test_commands.py @@ -466,11 +466,40 @@ def test_provider_login_can_set_openai_codex_as_main_provider(tmp_path): saved = Config.model_validate(json.loads(config_path.read_text(encoding="utf-8"))) assert saved.agents.defaults.provider == "openai_codex" - assert saved.agents.defaults.model == "openai-codex/gpt-5.1-codex" + assert saved.agents.defaults.model == "openai-codex/gpt-5.4-mini" assert saved.agents.defaults.model_preset is None assert make_provider(saved).__class__.__name__ == "OpenAICodexProvider" +def test_provider_login_can_set_github_copilot_as_main_provider(tmp_path): + config_path = tmp_path / "config.json" + original = cli_commands._LOGIN_HANDLERS["github_copilot"] + cli_commands._LOGIN_HANDLERS["github_copilot"] = lambda: None + try: + result = runner.invoke( + app, + [ + "provider", + "login", + "github-copilot", + "--set-main", + "--config", + str(config_path), + ], + ) + finally: + cli_commands._LOGIN_HANDLERS["github_copilot"] = original + + assert result.exit_code == 0 + assert "Set github-copilot as the main provider" in result.stdout + + saved = Config.model_validate(json.loads(config_path.read_text(encoding="utf-8"))) + assert saved.agents.defaults.provider == "github_copilot" + assert saved.agents.defaults.model == "github-copilot/gpt-5.4-mini" + assert saved.agents.defaults.model_preset is None + assert make_provider(saved).__class__.__name__ == "GitHubCopilotProvider" + + def test_provider_login_model_implies_set_main_provider(tmp_path): config_path = tmp_path / "config.json" original = cli_commands._LOGIN_HANDLERS["github_copilot"]