Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(install): rebuild the venv when the selected Python major.minor changes

Ruben Lütke507b221d013f
diff --git a/install/install.sh b/install/install.sh
index e02bb69cc2..fd3ac69cef 100755
--- a/install/install.sh
+++ b/install/install.sh
@@ -534,6 +534,19 @@ phase '3/6' 'Python environment'
VENV_PATH="$INSTALL_DIR/.venv"
VENV_PYTHON="$VENV_PATH/bin/python"
+# Rebuild the venv when the selected interpreter's major.minor changed
+# (BUG-059 follow-up): the 3.13-first preference is useless for an EXISTING
+# install whose venv is pinned to 3.14 — a stale venv keeps the local-voice
+# wheel gap forever. Packages are reinstalled by the installer right after,
+# so dropping the env loses nothing.
+if [ -x "$VENV_PYTHON" ]; then
+ _venv_mm=$("$VENV_PYTHON" -c 'import sys; print("%d.%d" % sys.version_info[:2])' 2>/dev/null || printf 'unknown')
+ _sel_mm=$("$PYTHON_EXE" -c 'import sys; print("%d.%d" % sys.version_info[:2])' 2>/dev/null || printf 'selected')
+ if [ "$_venv_mm" != "$_sel_mm" ]; then
+ note "rebuilding the Python environment (Python $_venv_mm -> $_sel_mm)"
+ rm -rf "$VENV_PATH"
+ fi
+fi
if [ ! -x "$VENV_PYTHON" ]; then
"$PYTHON_EXE" -m venv "$VENV_PATH"
fi
diff --git a/tests/unit/install/test_install_sh_python_detection.py b/tests/unit/install/test_install_sh_python_detection.py
index b140fbeb8d..6458d633ba 100644
--- a/tests/unit/install/test_install_sh_python_detection.py
+++ b/tests/unit/install/test_install_sh_python_detection.py
@@ -225,3 +225,14 @@ def test_prefers_python_with_full_native_wheel_support() -> None:
line = next(ln for ln in src.splitlines() if "for candidate in" in ln)
for older in ("python3.13", "python3.12", "python3.11"):
assert line.index(older) < line.index("python3.14"), older
+
+
+def test_stale_venv_is_rebuilt_on_interpreter_version_change() -> None:
+ """BUG-059 follow-up: an existing install whose venv is pinned to a
+ Python without local-voice wheels (e.g. 3.14) must be rebuilt when the
+ finder now selects a different major.minor — otherwise the 3.13-first
+ preference never reaches existing installs."""
+ src = INSTALL_SH.read_text(encoding="utf-8")
+ assert "rebuilding the Python environment" in src
+ # The comparison must be version-based, not existence-based only.
+ assert 'if [ "$_venv_mm" != "$_sel_mm" ]' in src