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.

chore: auto-save WIP via Claude stop-hook safety net (2026-07-10 19:39)

Ruben Lütke09f3bf7c256a
diff --git a/desktop-ttu-latest.json b/desktop-ttu-latest.json
index 8792a72bd3..6909356f9a 100644
--- a/desktop-ttu-latest.json
+++ b/desktop-ttu-latest.json
@@ -3,31 +3,35 @@
"runs": 1,
"python": "C:\\Program Files\\Python311\\python.exe",
"vault_pages": 84,
- "median_wall_ms": 3016.0,
- "median_boot_ready_ms": 455.2,
- "median_bind_wall_ms": 2550.2,
- "median_voice_ready_wall_ms": 15128.7,
+ "median_wall_ms": 1435.6,
+ "median_boot_ready_ms": 172.5,
+ "median_bind_wall_ms": 1096.8,
+ "median_voice_ready_wall_ms": 8474.0,
"voice_ready_wall_ms_runs": [
- 15128.7
+ 8474.0
],
- "median_voice_usable_wall_ms": 17281.9,
+ "median_voice_usable_wall_ms": 9175.2,
"voice_usable_wall_ms_runs": [
- 17281.9
+ 9175.2
],
- "median_app_interactive_wall_ms": 17282.0,
+ "median_app_interactive_wall_ms": 8985.8,
"app_interactive_wall_ms_runs": [
- 17282.0
+ 8985.8
],
"wall_ms_runs": [
- 3016.0
+ 1435.6
],
"boot_ready_ms_runs": [
- 455.2
+ 172.5
],
"phase_medians_ms": {
- "db_app_interactive": 6536.4,
- "db_pre_webserver": 3840.4,
- "db_webserver_ctor": 4810.2
+ "db_app_interactive": 2159.9,
+ "db_pre_webserver": 3591.3,
+ "db_webserver_ctor": 2310.2,
+ "flight_recorder": 0.8,
+ "mission_stack": 51.6,
+ "screenshot_retention": 1.0,
+ "uvicorn_serve": 0.0
},
"anchor": "spawn -> /api/health responds 200 (= DesktopApp._wait_for_backend success = window creation point)",
"secondary_anchor": "median_bind_wall_ms = spawn -> BOOT_READY print (bootstrap bind; may precede a responsive health endpoint)",
diff --git a/install/install.ps1 b/install/install.ps1
index 3d7daf7f8a..24618fcb53 100644
--- a/install/install.ps1
+++ b/install/install.ps1
@@ -127,6 +127,18 @@ foreach ($candidate in @('python', 'py')) {
}
if (-not $pythonExe) {
Write-Err 'Python 3.11+ not found.'
+ # Honesty over a bare "not found": name any too-old interpreter we saw, so
+ # a user staring at a working `python --version` understands the verdict
+ # (3.8 reads "bigger" than 3.11 unless you know Python's version ordering).
+ $reported = @{}
+ foreach ($candidate in @('python', 'py')) {
+ $info = Test-Tool $candidate
+ if ($info.Found -and $info.Version -match 'Python\s+(\d+\.\d+\.\d+)' -and -not $reported[$Matches[1]]) {
+ $reported[$Matches[1]] = $true
+ Write-Note "Closest match: Python $($Matches[1]) (via '$candidate') - too old: Jarvis needs 3.11+,"
+ Write-Note 'and Python versions count 3.8 < 3.9 < 3.10 < 3.11.'
+ }
+ }
Write-Note 'Install it from https://www.python.org/downloads/ then re-run this command.'
Write-Note '(After install, open a NEW PowerShell window so PATH refreshes.)'
exit 1
diff --git a/install/install.sh b/install/install.sh
index b7ba086696..644d9835ee 100755
--- a/install/install.sh
+++ b/install/install.sh
@@ -64,31 +64,104 @@ EOF
# -------------------------------------------------------------- preflight
phase '1/6' 'Prerequisites'
+# --- python-detection begin -------------------------------------------------
+# Covered by tests/unit/install/test_install_sh_python_detection.py.
+#
+# A bare PATH lookup is NOT enough on macOS: in a `curl | bash` session the
+# profile files that put python.org / Homebrew interpreters on PATH are often
+# never sourced, and Homebrew's versioned [email protected] kegs are keg-only (never
+# linked onto PATH at all) — so we also probe the well-known install prefixes
+# directly. We additionally remember the first too-old interpreter we saw, so
+# a failure can say what WAS found: a field report read a bare "not found" as
+# a false negative because `python3 --version` printed 3.8.2 (which reads
+# "bigger" than 3.11 unless you know Python's version ordering).
+#
+# Escape hatches:
+# JARVIS_PYTHON explicit interpreter; authoritative when set
+# JARVIS_PYTHON_SEARCH_DIRS colon-separated dirs REPLACING the built-in
+# off-PATH probe list (used by the tests)
+PY_MIN_MINOR=11
+PYTHON_EXE=""
+FOUND_TOO_OLD=""
+
+_py_try() {
+ # Accept $1 if it runs and is Python >= 3.PY_MIN_MINOR: store its resolved
+ # path in PYTHON_EXE and return 0. Otherwise remember the first too-old
+ # version for the failure message and return 1.
+ _exe="$1"
+ _ver=$("$_exe" -c 'import sys; print("%d.%d.%d" % sys.version_info[:3])' 2>/dev/null) || return 1
+ case "$_ver" in ''|*[!0-9.]*) return 1 ;; esac
+ _major=${_ver%%.*}
+ _minor=${_ver#*.}; _minor=${_minor%%.*}
+ if [ "$_major" -gt 3 ] || { [ "$_major" -eq 3 ] && [ "$_minor" -ge "$PY_MIN_MINOR" ]; }; then
+ PYTHON_EXE=$(command -v "$_exe" 2>/dev/null || printf '%s' "$_exe")
+ return 0
+ fi
+ if [ -z "$FOUND_TOO_OLD" ]; then
+ _path=$(command -v "$_exe" 2>/dev/null || printf '%s' "$_exe")
+ FOUND_TOO_OLD="Python $_ver at $_path"
+ fi
+ return 1
+}
+
find_python() {
- for candidate in python3.13 python3.12 python3.11 python3 python; do
- if command -v "$candidate" >/dev/null 2>&1; then
- ver=$("$candidate" -c 'import sys; print("%d.%d" % sys.version_info[:2])' 2>/dev/null || echo "")
- if [ -n "$ver" ]; then
- major=${ver%.*}; minor=${ver#*.}
- if [ "$major" -gt 3 ] || { [ "$major" -eq 3 ] && [ "$minor" -ge 11 ]; }; then
- echo "$candidate"
- return 0
- fi
- fi
- fi
+ if [ -n "${JARVIS_PYTHON:-}" ]; then
+ # An explicit pin is authoritative: never silently substitute another
+ # interpreter for the one the user asked for.
+ _py_try "$JARVIS_PYTHON"
+ return $?
+ fi
+ for candidate in python3.14 python3.13 python3.12 python3.11 python3 python; do
+ command -v "$candidate" >/dev/null 2>&1 || continue
+ if _py_try "$candidate"; then return 0; fi
+ done
+ # Off-PATH probe: python.org framework installs and Homebrew prefixes
+ # (Apple Silicon + Intel), including keg-only [email protected] kegs. Unmatched
+ # globs stay literal and are filtered by the -x test; on Linux these
+ # directories simply don't exist and the loop is a no-op.
+ if [ -n "${JARVIS_PYTHON_SEARCH_DIRS:-}" ]; then
+ # Colon-split without `read` (the never-prompts guard bans that token).
+ _old_ifs=$IFS
+ IFS=':'
+ # shellcheck disable=SC2086 -- colon-splitting the override is the point
+ set -- $JARVIS_PYTHON_SEARCH_DIRS
+ IFS=$_old_ifs
+ _probe_dirs=("$@")
+ else
+ _probe_dirs=(
+ /opt/homebrew/bin
+ /usr/local/bin
+ /opt/homebrew/opt/python@3.*/bin
+ /usr/local/opt/python@3.*/bin
+ /Library/Frameworks/Python.framework/Versions/3.*/bin
+ )
+ fi
+ for _dir in "${_probe_dirs[@]:-}"; do
+ for _cand in "$_dir"/python3.1[1-9] "$_dir"/python3 "$_dir"/python; do
+ [ -x "$_cand" ] || continue
+ if _py_try "$_cand"; then return 0; fi
+ done
done
return 1
}
+# --- python-detection end ---------------------------------------------------
-if ! PYTHON_EXE=$(find_python); then
+if ! find_python; then
err 'Python 3.11+ not found.'
+ if [ -n "$FOUND_TOO_OLD" ]; then
+ note "Closest match: $FOUND_TOO_OLD - too old: Jarvis needs 3.11+,"
+ note 'and Python versions count 3.8 < 3.9 < 3.10 < 3.11.'
+ fi
note 'Install it from:'
- note ' - macOS: https://www.python.org/downloads/ or "brew install [email protected]"'
+ note ' - macOS: https://www.python.org/downloads/ or "brew install python"'
note ' - Linux: your distro package (apt install python3.12, dnf install python3.12, ...)'
+ note 'Then open a NEW terminal window and re-run this command.'
+ note 'Python installed somewhere unusual? Pin it explicitly:'
+ note ' curl -fsSL <this url> | JARVIS_PYTHON=/path/to/python3.12 bash'
exit 1
fi
PY_VER=$("$PYTHON_EXE" -c 'import sys; print("Python %d.%d.%d" % sys.version_info[:3])' 2>/dev/null || echo "$PYTHON_EXE")
-ok "$PY_VER"
+ok "$PY_VER ($PYTHON_EXE)"
if ! command -v git >/dev/null 2>&1; then
err 'git not found.'
diff --git a/tests/unit/install/test_install_sh_python_detection.py b/tests/unit/install/test_install_sh_python_detection.py
new file mode 100644
index 0000000000..0bd13ee2a0
--- /dev/null
+++ b/tests/unit/install/test_install_sh_python_detection.py
@@ -0,0 +1,216 @@
+"""install.sh Python detection — honest failures + off-PATH interpreters.
+
+Regression guard for the 2026-07-10 Mac field bug: the tester's machine only
+exposed the Apple system Python 3.8.2 as `python3`, and the installer said a
+bare "Python 3.11+ not found." — factually right, but it never reported what
+it DID find, so the failure read as a false negative ("but python3 works!").
+Worse, the finder only consulted PATH: on macOS a freshly installed
+python.org or Homebrew interpreter routinely lives OFF the PATH of a
+`curl | bash` session (and Homebrew's versioned [email protected] kegs are keg-only,
+so they never reach PATH at all) — a machine WITH a suitable Python could hit
+the same dead end.
+
+Contract under test (the marked block inside install/install.sh):
+ 1. A too-old interpreter is remembered and reported, not silently skipped.
+ 2. Well-known off-PATH install prefixes are probed (overridable via
+ JARVIS_PYTHON_SEARCH_DIRS for these tests).
+ 3. JARVIS_PYTHON pins one interpreter authoritatively — used when suitable,
+ an honest failure (never a silent substitute) when not.
+"""
+
+import os
+import shutil
+import subprocess
+from pathlib import Path
+
+import pytest
+
+REPO = Path(__file__).resolve().parents[3]
+INSTALL_SH = REPO / "install" / "install.sh"
+
+
+def _find_bash() -> str | None:
+ """A bash that understands host paths. On Windows that is Git Bash (found
+ next to git.exe) — NEVER the WSL bash.exe stubs in WindowsApps/System32,
+ which run in a separate filesystem namespace and cannot source our
+ tmp-path scripts."""
+ git = shutil.which("git")
+ if git:
+ for rel in ("../bin/bash.exe", "../../bin/bash.exe", "../usr/bin/bash.exe"):
+ cand = (Path(git).parent / rel).resolve()
+ if cand.exists():
+ return str(cand)
+ bash = shutil.which("bash")
+ if bash and not any(t in bash.lower() for t in ("windowsapps", "system32")):
+ return bash
+ return None
+
+
+BASH = _find_bash()
+
+BLOCK_BEGIN = "# --- python-detection begin"
+BLOCK_END = "# --- python-detection end"
+
+DRIVER = """#!/usr/bin/env bash
+set -u
+# Convert host-OS paths (possibly Windows-style) into the shell's own form
+# using only builtins, BEFORE we clamp PATH to the stub directory.
+if [ -n "${STUB_SEARCH_DIR:-}" ]; then
+ JARVIS_PYTHON_SEARCH_DIRS="$(cd "$STUB_SEARCH_DIR" && pwd)"
+else
+ JARVIS_PYTHON_SEARCH_DIRS='/jarvis-test-nonexistent'
+fi
+export JARVIS_PYTHON_SEARCH_DIRS
+if [ -n "${STUB_PIN_DIR:-}" ]; then
+ JARVIS_PYTHON="$(cd "$STUB_PIN_DIR" && pwd)/$STUB_PIN_NAME"
+ export JARVIS_PYTHON
+else
+ unset JARVIS_PYTHON
+fi
+PATH="$(cd "$STUB_PATH_DIR" && pwd)"
+export PATH
+hash -r
+source "$BLOCK_FILE"
+if find_python; then
+ printf 'FOUND|%s\\n' "$PYTHON_EXE"
+else
+ printf 'MISS|%s\\n' "$FOUND_TOO_OLD"
+fi
+"""
+
+
+def _sh_path(p: Path) -> str:
+ """Forward-slash form: Git Bash on Windows digests C:/... reliably,
+ while backslashed paths get mangled between env vars and builtins."""
+ return str(p).replace("\\", "/")
+
+
+def _block_text() -> str:
+ src = INSTALL_SH.read_text(encoding="utf-8")
+ assert BLOCK_BEGIN in src and BLOCK_END in src, (
+ "install.sh must keep the marked python-detection block these tests drive"
+ )
+ return src[src.index(BLOCK_BEGIN) : src.index(BLOCK_END)]
+
+
+def _make_stub(directory: Path, name: str, version: str) -> None:
+ stub = directory / name
+ stub.write_text(f'#!/bin/sh\necho "{version}"\n', encoding="utf-8", newline="\n")
+ stub.chmod(0o755)
+
+
+def _run_detection(
+ tmp_path: Path,
+ *,
+ path_stubs: dict[str, str],
+ search_stubs: dict[str, str] | None = None,
+ pin: tuple[str, str] | None = None,
+) -> str:
+ path_dir = tmp_path / "on-path"
+ path_dir.mkdir(exist_ok=True)
+ for name, version in path_stubs.items():
+ _make_stub(path_dir, name, version)
+
+ env = os.environ.copy()
+ env.pop("JARVIS_PYTHON", None)
+ env.pop("JARVIS_PYTHON_SEARCH_DIRS", None)
+ env["STUB_PATH_DIR"] = _sh_path(path_dir)
+
+ if search_stubs is not None:
+ search_dir = tmp_path / "off-path"
+ search_dir.mkdir(exist_ok=True)
+ for name, version in search_stubs.items():
+ _make_stub(search_dir, name, version)
+ env["STUB_SEARCH_DIR"] = _sh_path(search_dir)
+
+ if pin is not None:
+ pin_dir = tmp_path / "pinned"
+ pin_dir.mkdir(exist_ok=True)
+ pin_name, pin_version = pin
+ _make_stub(pin_dir, pin_name, pin_version)
+ env["STUB_PIN_DIR"] = _sh_path(pin_dir)
+ env["STUB_PIN_NAME"] = pin_name
+
+ block_file = tmp_path / "detection-block.sh"
+ block_file.write_text(_block_text(), encoding="utf-8", newline="\n")
+ env["BLOCK_FILE"] = _sh_path(block_file)
+
+ driver = tmp_path / "driver.sh"
+ driver.write_text(DRIVER, encoding="utf-8", newline="\n")
+
+ result = subprocess.run(
+ [BASH, str(driver)],
+ env=env,
+ capture_output=True,
+ text=True,
+ timeout=60,
+ )
+ assert result.returncode == 0, f"driver crashed: {result.stderr}"
+ return result.stdout.strip()
+
+
+needs_bash = pytest.mark.skipif(BASH is None, reason="bash not available")
+
+
+@needs_bash
+def test_too_old_interpreter_is_reported_not_silently_skipped(tmp_path) -> None:
+ """The exact Mac field case: only a 3.8 `python3` exists -> the failure
+ must name the version and path it found, so the error is self-explaining."""
+ out = _run_detection(tmp_path, path_stubs={"python3": "3.8.2"})
+ assert out.startswith("MISS|"), out
+ assert "3.8.2" in out
+ assert "python3" in out
+
+
+@needs_bash
+def test_off_path_interpreter_is_found(tmp_path) -> None:
+ """A suitable interpreter in a probed prefix must be found even when
+ nothing on PATH qualifies (python.org / Homebrew keg-only layout)."""
+ out = _run_detection(
+ tmp_path,
+ path_stubs={"python3": "3.8.2"},
+ search_stubs={"python3.12": "3.12.4"},
+ )
+ assert out.startswith("FOUND|"), out
+ assert out.endswith("/python3.12")
+
+
+@needs_bash
+def test_jarvis_python_pin_wins(tmp_path) -> None:
+ out = _run_detection(
+ tmp_path,
+ path_stubs={"python3": "3.8.2"},
+ pin=("my-python", "3.13.1"),
+ )
+ assert out.startswith("FOUND|"), out
+ assert out.endswith("/my-python")
+
+
+@needs_bash
+def test_too_old_pin_fails_honestly_instead_of_substituting(tmp_path) -> None:
+ """An explicit pin is authoritative: when it is too old the install must
+ fail and say so - never silently pick a different interpreter."""
+ out = _run_detection(
+ tmp_path,
+ path_stubs={"python3.12": "3.12.4"},
+ pin=("my-python", "3.9.7"),
+ )
+ assert out.startswith("MISS|"), out
+ assert "3.9.7" in out
+
+
+def test_candidate_list_keeps_up_with_python_releases() -> None:
+ """python3.14 shipped 2025-10; a finder frozen at 3.13 slowly rots."""
+ assert "python3.14" in INSTALL_SH.read_text(encoding="utf-8")
+
+
+def test_failure_message_advertises_the_pin_escape_hatch() -> None:
+ src = INSTALL_SH.read_text(encoding="utf-8")
+ assert "JARVIS_PYTHON=" in src
+
+
+def test_ps1_failure_reports_what_was_found() -> None:
+ """Windows parity for the honesty half of the fix: the PowerShell
+ bootstrap must also name the too-old interpreter it found."""
+ ps1 = (REPO / "install" / "install.ps1").read_text(encoding="utf-8")
+ assert "Closest match" in ps1