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): fresh macOS install no longer crashes at launch (BUG-066)

Joana Lütke0d263b226de9
diff --git a/docs/BUGS.md b/docs/BUGS.md
index 451c4ede21..80c73a0874 100644
--- a/docs/BUGS.md
+++ b/docs/BUGS.md
@@ -5511,3 +5511,29 @@ granted. Before hosting such a library off the main thread, read its native
call path; if it needs main-queue services the process cannot provide, build
the narrow native path in-repo (Quartz-only, keycode-level) instead of
wrapping the crash in try/except that can never catch a SIGILL.
+
+---
+
+## BUG-066: fresh macOS install crashed at the final launch step — editable .pth invisible to the already-running installer (MEDIUM, FIXED 2026-07-17)
+
+**Symptom.** A fully successful fresh install (all six phases green, bundle
+registered) ended in `ModuleNotFoundError: No module named 'jarvis'` from
+`step_launch` (`install/installer.py`). Update runs never hit it.
+
+**Root cause.** The installer process starts before phase 4 runs
+`pip install -e .`. Editable installs are wired through a `.pth` finder hook
+that the interpreter only processes at STARTUP, so the long-running installer
+process could not `import jarvis` in-process on a fresh install. On update
+runs the hook already existed at startup — which is why the crash was
+fresh-install-only and invisible on every developer machine.
+
+**Fix (2026-07-17).** `_rescan_venv_site_packages()` (`site.addsitedir` on
+the venv's purelib + `importlib.invalidate_caches`) runs before the darwin
+launch imports; if the import still fails the launch degrades to
+`/usr/bin/open -a "Personal Jarvis"` (LaunchServices by name — BUG-060
+conform) instead of failing a completed install. Guard:
+`tests/unit/install/test_installer_update_contract.py::test_macos_launch_survives_missing_editable_import`.
+
+**Class rule.** A long-running installer process must never assume it can
+import what it just installed — re-scan site-packages first, and never let a
+post-install nicety (auto-launch) turn a completed install into a failure.
diff --git a/install/installer.py b/install/installer.py
index 9090430431..e7b32b457a 100644
--- a/install/installer.py
+++ b/install/installer.py
@@ -638,6 +638,24 @@ def _resolved_admin_port() -> int:
return 47821
+def _rescan_venv_site_packages() -> None:
+ """Make packages installed by THIS run importable in THIS process.
+
+ The installer process starts before phase 4 runs ``pip install -e .``, and
+ editable installs work through a ``.pth`` finder hook that the interpreter
+ only processes at startup — so a fresh install could never ``import
+ jarvis`` in-process (update runs could, the hook already existed at
+ startup, which is why only fresh installs crashed at launch).
+ ``site.addsitedir`` re-processes the venv's ``.pth`` files now.
+ """
+ import importlib
+ import site
+ import sysconfig
+
+ site.addsitedir(sysconfig.get_paths()["purelib"])
+ importlib.invalidate_caches()
+
+
def step_launch(*, headless: bool, dry_run: bool) -> None:
if headless or is_headless_linux():
cmd = [str(venv_python()), "-m", "jarvis.ui.web.launcher", "--headless"]
@@ -646,21 +664,29 @@ def step_launch(*, headless: bool, dry_run: bool) -> None:
cmd = [str(repo_root() / "run.bat")]
msg = "the Desktop App"
elif sys.platform == "darwin":
- from jarvis.setup.macos_app_bundle import (
- macos_app_bundle_is_launchable,
- macos_app_bundle_path,
- macos_launch_services_command,
- )
-
- bundle = macos_app_bundle_path()
- if not macos_app_bundle_is_launchable(bundle):
- console.print(
- "[bad]│ Could not launch: the installed macOS app bundle is missing "
- "or invalid.[/]"
+ try:
+ _rescan_venv_site_packages()
+ from jarvis.setup.macos_app_bundle import (
+ macos_app_bundle_is_launchable,
+ macos_app_bundle_path,
+ macos_launch_services_command,
)
- sys.exit(4)
- cmd = macos_launch_services_command(bundle)
- msg = "the Desktop App"
+ except Exception: # noqa: BLE001 — a hint-import must never fail the install
+ # The install itself is complete; launch through LaunchServices
+ # by app name instead of failing the whole run. Ported from the Mac
+ # line (BUG-066 there; the local register merged it as BUG-078).
+ cmd = ["/usr/bin/open", "-a", "Personal Jarvis"]
+ msg = "the Desktop App"
+ else:
+ bundle = macos_app_bundle_path()
+ if not macos_app_bundle_is_launchable(bundle):
+ console.print(
+ "[bad]│ Could not launch: the installed macOS app bundle is missing "
+ "or invalid.[/]"
+ )
+ sys.exit(4)
+ cmd = macos_launch_services_command(bundle)
+ msg = "the Desktop App"
else:
cmd = [str(venv_python()), "-m", "jarvis.ui.web.launcher"]
msg = "the Desktop App"
diff --git a/tests/unit/install/test_installer_update_contract.py b/tests/unit/install/test_installer_update_contract.py
index 6f87e1c0d5..34c8c8da78 100644
--- a/tests/unit/install/test_installer_update_contract.py
+++ b/tests/unit/install/test_installer_update_contract.py
@@ -191,3 +191,30 @@ def test_desktop_registration_success_still_writes_full_log(
).read_text(encoding="utf-8")
assert '{"ok": true, "attempted": true}' in text
assert "probe chatter" in text
+
+
+def test_macos_launch_survives_missing_editable_import(
+ monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str]
+) -> None:
+ """BUG-066: on a FRESH install the installer process predates the editable
+ install, so ``import jarvis`` fails in-process (.pth hooks only load at
+ interpreter startup). step_launch must fall back to launching by app name
+ instead of crashing after a fully successful install."""
+ monkeypatch.setattr(installer.sys, "platform", "darwin")
+ monkeypatch.setattr(installer, "is_headless_linux", lambda: False)
+ # Force the in-process import to fail even though the dev venv has jarvis.
+ import builtins
+
+ real_import = builtins.__import__
+
+ def _no_jarvis(name, *args, **kwargs):
+ if name.startswith("jarvis"):
+ raise ModuleNotFoundError("No module named 'jarvis'")
+ return real_import(name, *args, **kwargs)
+
+ monkeypatch.setattr(builtins, "__import__", _no_jarvis)
+
+ installer.step_launch(headless=False, dry_run=True)
+
+ out = capsys.readouterr().out
+ assert "/usr/bin/open -a Personal Jarvis" in out