Skip to content

Commit e25e86e

Browse files
rohita5lclaude
andauthored
Always --force when installing the mlflow CLI (#135)
Keying --force on a parsed existing version broke when an mlflow was on disk but its version couldn't be parsed: --force was dropped and uv errored "Executable already exists". --force installs fresh when absent and replaces in place when present, so it's safe unconditionally. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 3cfa6f5 commit e25e86e

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/ucode/agents/claude.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,10 +398,10 @@ def _ensure_mlflow_cli() -> bool:
398398
return False
399399

400400
print_note(f"{'Replacing' if current else 'Installing'} the mlflow CLI ({MLFLOW_CLI_SPEC})...")
401-
# --force replaces an existing (out-of-range) uv-managed mlflow in place.
402-
cmd = ["uv", "tool", "install", MLFLOW_CLI_SPEC]
403-
if current:
404-
cmd.append("--force")
401+
# Always --force: it installs fresh when absent and replaces in place when
402+
# present. Keying it on `current` broke when an mlflow existed but its
403+
# version couldn't be parsed — uv still errors "Executable already exists".
404+
cmd = ["uv", "tool", "install", "--force", MLFLOW_CLI_SPEC]
405405
try:
406406
subprocess.run(cmd, check=True, timeout=600)
407407
except (OSError, subprocess.CalledProcessError, subprocess.TimeoutExpired) as exc:

tests/test_tracing.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,9 @@ def test_installs_when_missing(self, monkeypatch):
650650
cmd = run.call_args[0][0]
651651
assert cmd[:3] == ["uv", "tool", "install"]
652652
assert claude.MLFLOW_CLI_SPEC in cmd
653-
assert "--force" not in cmd
653+
# Always --force so an unparseable-version mlflow on disk doesn't trip
654+
# uv's "Executable already exists" error.
655+
assert "--force" in cmd
654656

655657
def test_force_replaces_when_below_minimum(self, monkeypatch):
656658
monkeypatch.setattr(claude, "_installed_mlflow_version", lambda: (3, 4))

0 commit comments

Comments
 (0)