Skip to content

Your lightweight open-source personal agent.

fix: preserve uv pip update reinstall semantics

chengyongruc77ca16d91c7
diff --git a/nanobot/apps/cli/service.py b/nanobot/apps/cli/service.py
index 906e5f14a..eeaa040df 100644
--- a/nanobot/apps/cli/service.py
+++ b/nanobot/apps/cli/service.py
@@ -723,7 +723,7 @@ class CliAppManager:
if pip_available:
prefix.extend(["--upgrade", "--force-reinstall"])
else:
- prefix.append("--upgrade")
+ prefix.extend(["--upgrade", "--reinstall"])
return prefix + args
def _pip_uninstall_argv(
diff --git a/tests/cli_apps/test_service.py b/tests/cli_apps/test_service.py
index b6b58d919..269f5cfd5 100644
--- a/tests/cli_apps/test_service.py
+++ b/tests/cli_apps/test_service.py
@@ -815,6 +815,34 @@ def test_install_uses_uv_pip_when_pip_unavailable(
]
+def test_update_uses_uv_pip_reinstall_when_pip_unavailable(
+ tmp_path: Path,
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ manager = _manager(tmp_path)
+ monkeypatch.setattr(CliAppManager, "_pip_available", staticmethod(lambda: False))
+ monkeypatch.setattr(
+ "nanobot.apps.cli.service.shutil.which",
+ lambda command: "/usr/bin/uv" if command == "uv" else None,
+ )
+
+ argv = manager._pip_install_argv(
+ {"name": "gimp", "install_cmd": "pip install cli-anything-gimp"},
+ update=True,
+ )
+
+ assert argv == [
+ "uv",
+ "pip",
+ "install",
+ "--python",
+ sys.executable,
+ "--upgrade",
+ "--reinstall",
+ "cli-anything-gimp",
+ ]
+
+
def test_uninstall_uses_uv_pip_when_pip_unavailable(
tmp_path: Path,
monkeypatch: pytest.MonkeyPatch,