Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ucode/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2877,7 +2877,7 @@ def claude_cmd(
claude_agent.disable_smart_routing(load_state())
print_success("Claude Code smart routing disabled; ug routing hooks removed")
return
if enable_model_discovery or (model_location is not None and provider is None):
if enable_model_discovery or model_location is not None or provider is not None:
os.environ[claude_agent.GATEWAY_MODEL_DISCOVERY_ENV_VAR] = "1"
with _smart_routing_v2_flag(enable_smart_routing_flag):
with _disable_smart_routing_for_subcommand("claude", ctx):
Expand Down
9 changes: 9 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,15 @@ def test_claude_model_location_is_forwarded(self):
assert mock_launch.call_args.args[1].args == []
assert os.environ["ENABLE_CLAUDE_CODE_GATEWAY_MODEL_DISCOVERY"] == "1"

def test_claude_provider_enables_model_discovery(self):
with patch("ucode.cli._launch_tool") as mock_launch:
result = runner.invoke(app, ["claude", "--provider", "main.default.anthropic"])

assert result.exit_code == 0, result.output
assert mock_launch.call_args.kwargs["provider"] == "main.default.anthropic"
assert mock_launch.call_args.args[1].args == []
assert os.environ["ENABLE_CLAUDE_CODE_GATEWAY_MODEL_DISCOVERY"] == "1"

def test_codex_model_location_is_forwarded(self):
with patch("ucode.cli._launch_tool") as mock_launch:
result = runner.invoke(app, ["codex", "--model-location", "main.default"])
Expand Down
Loading