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): leave a manual re-launch command when auto-launch silently fails

Personal Jarvis Maintainerc6ae52643773
diff --git a/install/installer.py b/install/installer.py
index 994285e3f2..1f257f3b03 100644
--- a/install/installer.py
+++ b/install/installer.py
@@ -694,6 +694,25 @@ def _rescan_venv_site_packages() -> None:
importlib.invalidate_caches()
+def _relaunch_command(*, headless: bool) -> str:
+ """The exact command a user can type to (re-)open the app by hand.
+
+ A detached ``Popen`` — and macOS LaunchServices ``open`` — reports success
+ the instant the child is spawned, even when no window ever surfaces (a
+ first-launch Gatekeeper/permission prompt stealing focus, the bundle
+ launching into the background, a display-less session). So the launch outro
+ must never *claim* it opened; it always leaves this fallback behind, one
+ honest line per OS. Mirrors the "Start again" rows in step_summary.
+ """
+ if headless or is_headless_linux():
+ return f'{venv_python()} -m jarvis.ui.web.launcher --headless'
+ if sys.platform == "win32":
+ return str(repo_root() / "run.bat")
+ if sys.platform == "darwin":
+ return f'open -a "{MACOS_APP_NAME}"'
+ return f"{venv_python()} -m jarvis.ui.web.launcher"
+
+
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"]
@@ -731,8 +750,10 @@ def step_launch(*, headless: bool, dry_run: bool) -> None:
# └ closes the connected journey the Stage-1 shell opened with ┌.
console.print(f"[muted]└[/] [brand]Launching {msg}[/] [muted]— the app takes over from here…[/]")
+ hint = _relaunch_command(headless=headless)
if dry_run:
- console.print(f"[muted]│ (dry-run) {' '.join(cmd)}[/]")
+ console.print(f"[muted] (dry-run) {' '.join(cmd)}[/]")
+ console.print(f"[muted] If it doesn't open, run:[/] [brand]{hint}[/]")
return
# We deliberately do not wait for the App — the installer returns control
@@ -741,8 +762,15 @@ def step_launch(*, headless: bool, dry_run: bool) -> None:
subprocess.Popen(cmd, cwd=repo_root(), close_fds=True)
except OSError as exc:
console.print(f"[bad]│ Could not launch: {exc}[/]")
+ console.print(f"[muted] Open it by hand:[/] [brand]{hint}[/]")
sys.exit(4)
+ # A spawned Popen (and LaunchServices) reports success even when nothing ever
+ # surfaces on screen. Never claim it opened without leaving the manual
+ # command behind — this is the line the user needs when the window never
+ # appears (macOS first-launch permission prompt, background launch, …).
+ console.print(f"[muted] If it doesn't open, run:[/] [brand]{hint}[/]")
+
def step_summary(*, no_launch: bool, update: bool, headless: bool) -> None:
"""The finale: a clack-style note box HANGING off the journey gutter.
diff --git a/tests/unit/install/test_installer_flow.py b/tests/unit/install/test_installer_flow.py
index 4781b3ebe9..028a8627aa 100644
--- a/tests/unit/install/test_installer_flow.py
+++ b/tests/unit/install/test_installer_flow.py
@@ -139,7 +139,7 @@ def test_full_profile_failure_stops_desktop_install(monkeypatch) -> None:
)
-def test_macos_launch_enters_through_application_bundle(monkeypatch, tmp_path) -> None:
+def test_macos_launch_enters_through_application_bundle(monkeypatch, tmp_path, capsys) -> None:
launched: dict[str, object] = {}
bundle = tmp_path / "Personal Jarvis.app"
monkeypatch.setattr(installer.sys, "platform", "darwin")
@@ -162,6 +162,30 @@ def test_macos_launch_enters_through_application_bundle(monkeypatch, tmp_path) -
installer.step_launch(headless=False, dry_run=False)
assert launched["cmd"] == ["/usr/bin/open", "-a", str(bundle)]
+ # A spawned Popen reports success even when no window ever surfaces, so the
+ # outro must always leave a manual re-launch command behind (the bug the user
+ # hit: outro said "Launching…" but nothing opened, with no recovery path).
+ out = capsys.readouterr().out
+ assert "If it doesn't open, run:" in out
+ assert 'open -a "Personal Jarvis"' in out
+
+
+def test_launch_fallback_hint_is_shown_on_every_desktop_os(monkeypatch, capsys) -> None:
+ """The manual re-launch line appears on Windows and Linux too, not just mac."""
+ monkeypatch.setattr(installer.subprocess, "Popen", lambda cmd, **kwargs: None)
+
+ monkeypatch.setattr(installer.sys, "platform", "win32")
+ installer.step_launch(headless=False, dry_run=False)
+ win_out = capsys.readouterr().out
+ assert "If it doesn't open, run:" in win_out
+ assert "run.bat" in win_out
+
+ monkeypatch.setattr(installer.sys, "platform", "linux")
+ monkeypatch.setenv("DISPLAY", ":99")
+ installer.step_launch(headless=False, dry_run=False)
+ linux_out = capsys.readouterr().out
+ assert "If it doesn't open, run:" in linux_out
+ assert "jarvis.ui.web.launcher" in linux_out
def test_linux_gui_gets_full_profile_and_app_menu_registration(