The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(cli): compare the resolved settings path when deciding whether the lite up and autoroute backups guard it
mateo-berri708381948b00
diff --git a/litellm/proxy/client/cli/commands/claude_settings.py b/litellm/proxy/client/cli/commands/claude_settings.pyindex 7e96d2a3a08..793728b0350 100644--- a/litellm/proxy/client/cli/commands/claude_settings.py+++ b/litellm/proxy/client/cli/commands/claude_settings.py@@ -66,7 +66,7 @@ def claude_settings_path(environ: Mapping[str, str]) -> Path:def settings_file_owners(settings_path: Path) -> tuple[SettingsFileOwner, ...]:"""The commands whose backups guard settings_path: `lite up` and `lite autoroute up` only ever manage the default file."""- return SETTINGS_FILE_OWNERS if settings_path == CLAUDE_SETTINGS_PATH else ()+ return SETTINGS_FILE_OWNERS if settings_path.resolve() == CLAUDE_SETTINGS_PATH.resolve() else ()def load_json_or_empty(path: Path) -> dict[str, JsonValue]:diff --git a/tests/test_litellm/proxy/client/cli/test_auth_commands.py b/tests/test_litellm/proxy/client/cli/test_auth_commands.pyindex 9c3c02a5e85..d3e6d8f66ef 100644--- a/tests/test_litellm/proxy/client/cli/test_auth_commands.py+++ b/tests/test_litellm/proxy/client/cli/test_auth_commands.py@@ -1477,6 +1477,21 @@ class TestLoginConfigClaude:assert "Run `lite down` first" in result.outputassert not default_settings_path.exists()+ def test_flag_refuses_while_lite_up_holds_the_default_file_reached_through_a_symlinked_config_dir(self, tmp_path):+ default_config_dir = tmp_path / "default-home" / ".claude"+ default_config_dir.mkdir(parents=True)+ alias = tmp_path / "claude-alias"+ alias.symlink_to(default_config_dir, target_is_directory=True)+ (tmp_path / "claude_settings_backup.json").write_text("{}")++ result, _settings_path, _backup_path = self._run_login(+ tmp_path, ["--config-claude"], config_dir_env={"CLAUDE_CONFIG_DIR": str(alias)}+ )++ assert result.exit_code != 0+ assert "`lite up` is currently managing" in result.output+ assert not (default_config_dir / "settings.json").exists()+def test_flag_writes_an_alternate_config_dir_even_while_lite_up_holds_the_default_file(self, tmp_path):(tmp_path / "claude_settings_backup.json").write_text("{}")