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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(windows): install the Desktop launcher — the entry Search can see
Harald637a419ba2b4
diff --git a/jarvis/setup/desktop_integration.py b/jarvis/setup/desktop_integration.pyindex 7e43fff757..48ef4db711 100644--- a/jarvis/setup/desktop_integration.py+++ b/jarvis/setup/desktop_integration.py@@ -209,9 +209,15 @@ def _windows_programs_dir() -> Path | None:return Path(appdata) / "Microsoft" / "Windows" / "Start Menu" / "Programs"+def _windows_desktop_dir() -> Path | None:+ profile = os.environ.get("USERPROFILE")+ return Path(profile) / "Desktop" if profile else None++def _remove_windows_desktop_integration(*,programs_dir: Path | None = None,+ desktop_dir: Path | None = None,registry_subkey: str = WINDOWS_UNINSTALL_SUBKEY,aumid: str = WINDOWS_APP_USER_MODEL_ID,) -> tuple[bool, tuple[str, ...]]:@@ -223,6 +229,13 @@ def _remove_windows_desktop_integration(shortcut.unlink(missing_ok=True)except OSError as exc:warnings.append(f"could not remove the Start-menu launcher: {exc}")+ # An uninstall that leaves an icon on the desktop has not uninstalled.+ desktop = desktop_dir or _windows_desktop_dir()+ if desktop is not None:+ try:+ (desktop / WINDOWS_SHORTCUT_FILE_NAME).unlink(missing_ok=True)+ except OSError as exc:+ warnings.append(f"could not remove the Desktop launcher: {exc}")if not _delete_windows_registry_key(registry_subkey):warnings.append("could not remove the Installed Apps registry entry")if not _delete_windows_registry_key(_windows_aumid_subkey(aumid)):@@ -260,6 +273,7 @@ def ensure_desktop_integration(platform: str | None = None,require_managed: bool = True,windows_programs_dir: Path | None = None,+ windows_desktop_dir: Path | None = None,windows_registry_subkey: str = WINDOWS_UNINSTALL_SUBKEY,windows_aumid: str = WINDOWS_APP_USER_MODEL_ID,macos_applications_dir: Path | None = None,@@ -284,6 +298,7 @@ def ensure_desktop_integration(if plat == "windows":try:from jarvis.ui.icon_utils import (+ ensure_desktop_shortcut,ensure_start_menu_shortcut,project_icon_path,register_windows_app_user_model_id,@@ -298,6 +313,18 @@ def ensure_desktop_integration(artifacts.append("start_menu_launcher")else:warnings.append("could not create the Start-menu launcher")+ # The Desktop entry is the one Windows Search can actually see: the+ # per-user Start Menu sits inside %APPDATA%, which the content index+ # excludes by default, so on a machine missing the Start-Menu+ # exception rule the app is unfindable by name without this.+ if ensure_desktop_shortcut(+ aumid=windows_aumid,+ icon_path=icon if icon.is_file() else None,+ desktop_dir=windows_desktop_dir,+ ):+ artifacts.append("desktop_launcher")+ else:+ warnings.append("could not create the Desktop launcher")if register_windows_app_user_model_id(windows_aumid,icon_path=icon if icon.is_file() else None,@@ -375,6 +402,7 @@ def remove_desktop_integration(*,platform: str | None = None,windows_programs_dir: Path | None = None,+ windows_desktop_dir: Path | None = None,windows_registry_subkey: str = WINDOWS_UNINSTALL_SUBKEY,windows_aumid: str = WINDOWS_APP_USER_MODEL_ID,macos_applications_dir: Path | None = None,@@ -388,12 +416,14 @@ def remove_desktop_integration(if plat == "windows":ok, found = _remove_windows_desktop_integration(programs_dir=windows_programs_dir,+ desktop_dir=windows_desktop_dir,registry_subkey=windows_registry_subkey,aumid=windows_aumid,)artifacts.extend(("start_menu_launcher",+ "desktop_launcher","installed_apps_registration","windows_app_identity",)diff --git a/jarvis/ui/icon_utils.py b/jarvis/ui/icon_utils.pyindex 21972221cb..7d5e2c3e84 100644--- a/jarvis/ui/icon_utils.py+++ b/jarvis/ui/icon_utils.py@@ -704,7 +704,6 @@ def ensure_start_menu_shortcut(return Falsetry:import pywintypes- from win32com.client import Dispatchfrom win32com.propsys import propsys, psconexcept Exception as exc: # noqa: BLE001logger.debug("pywin32 unavailable; Start-Menu shortcut not ensured: {}", exc)@@ -758,15 +757,31 @@ def ensure_start_menu_shortcut(except Exception as exc: # noqa: BLE001logger.debug("could not read existing shortcut AUMID, rewriting: {}", exc)+ if _write_branded_shortcut(lnk, target=pythonw, ico=ico, aumid=aumid,+ display_name=display_name):+ logger.debug("Start-Menu shortcut ensured: {}", lnk)+ return True+ return False+++def _write_branded_shortcut(+ lnk: Path, *, target: Path, ico: Path, aumid: str, display_name: str+) -> bool:+ """Write one AUMID-tagged .lnk pointing at ``target``. Never raises.++ Shared by the Start-Menu and Desktop entries so the two can never drift into+ different targets, icons or identities — which is exactly how a user ends up+ with one working launcher and one dead one.+ """try:- programs.mkdir(parents=True, exist_ok=True)+ import pywintypes+ from win32com.client import Dispatch+ from win32com.propsys import propsys, pscon++ lnk.parent.mkdir(parents=True, exist_ok=True)shell = Dispatch("WScript.Shell")sc = shell.CreateShortcut(str(lnk))- # Target the venv pythonw (which re-execs through the branded base copy in- # main()); the branded exe itself needs __PYVENV_LAUNCHER__ to find the- # venv, so it is not a valid direct shortcut target. IconLocation below- # still brands the pinned/Start-Menu icon itself.- sc.TargetPath = str(pythonw)+ sc.TargetPath = str(target)sc.Arguments = f"-m {_LAUNCHER_MODULE}"sc.WorkingDirectory = str(Path.home())if ico.is_file():@@ -776,16 +791,79 @@ def ensure_start_menu_shortcut(sc.Save()# Embed the AUMID so Windows matches the running window to this shortcut.rw_store = propsys.SHGetPropertyStoreFromParsingName(- str(lnk), None, 2, iid # GPS_READWRITE+ str(lnk), None, 2, pywintypes.IID(_IID_IPROPERTYSTORE) # GPS_READWRITE)rw_store.SetValue(pscon.PKEY_AppUserModel_ID, propsys.PROPVARIANTType(aumid))rw_store.Commit()_notify_shell_of_shortcut(lnk)- logger.debug("Start-Menu shortcut ensured: {}", lnk)return Trueexcept Exception as exc: # noqa: BLE001- logger.debug("Start-Menu shortcut could not be written: {}", exc)+ logger.debug("shortcut could not be written at {}: {}", lnk, exc)+ return False+++def _default_desktop_dir() -> Path | None:+ profile = os.environ.get("USERPROFILE")+ return Path(profile) / "Desktop" if profile else None+++def ensure_desktop_shortcut(+ *,+ aumid: str = APP_USER_MODEL_ID,+ display_name: str = APP_DISPLAY_NAME,+ icon_path: Path | None = None,+ desktop_dir: Path | None = None,+ create_if_missing: bool = True,+) -> bool:+ """Install/repair the Desktop launcher — the entry Windows Search can see.++ The Start-Menu entry alone is not enough on a real machine. Windows excludes+ ``%LOCALAPPDATA%``/``%APPDATA%`` from the content index by default, and the+ per-user Start Menu lives inside ``%APPDATA%`` — so on a box whose index+ lacks the Start-Menu exception rule, NOTHING there is searchable and typing+ the app's name finds nothing at all. The Desktop is indexed, which is why+ Discord and Obsidian were still findable on the machine that reported this+ (forensic 2026-08-16: their Desktop .lnk files were in the index; the+ Start-Menu folder had zero entries).++ So this is not decoration — for that user it is the only working search+ entry, and the icon they expected to see. Everything else (target, icon,+ AUMID) is identical to the Start-Menu entry via ``_write_branded_shortcut``.++ ``create_if_missing=False`` repairs an existing shortcut but never+ resurrects a deleted one — a user who threw the icon away keeps their empty+ desktop. The installer passes ``True``; incidental callers should not.+ """+ if sys.platform != "win32":+ return False+ desktop = desktop_dir or _default_desktop_dir()+ if desktop is None or not desktop.is_dir():return False+ target = _shortcut_launch_target()+ if target is None:+ return False+ ico = icon_path or project_icon_path()+ lnk = desktop / START_MENU_SHORTCUT_NAME++ if not lnk.is_file() and not create_if_missing:+ return False+ if not _interpreter_can_open_a_window():+ # Same rule as the Start-Menu entry: never aim it at an interpreter that+ # cannot open the window.+ return lnk.is_file()+ if lnk.is_file() and _shortcut_matches_install(+ lnk,+ expected_target=target,+ expected_icon=ico,+ expected_arguments=f"-m {_LAUNCHER_MODULE}",+ ):+ return True+ if _write_branded_shortcut(+ lnk, target=target, ico=ico, aumid=aumid, display_name=display_name+ ):+ logger.debug("Desktop shortcut ensured: {}", lnk)+ return True+ return Falsedef _notify_shell_of_shortcut(lnk: Path) -> None:diff --git a/tests/unit/setup/test_desktop_integration.py b/tests/unit/setup/test_desktop_integration.pyindex 0ebf4b09a7..7992e25216 100644--- a/tests/unit/setup/test_desktop_integration.py+++ b/tests/unit/setup/test_desktop_integration.py@@ -183,6 +183,9 @@ def test_windows_managed_install_is_visible_to_start_and_installed_apps(root = _managed_root(tmp_path)programs = tmp_path / "Programs"+ # A throwaway Desktop too — never write into the real one from a test.+ desktop = tmp_path / "Desktop"+ desktop.mkdir()subkey = rf"Software\PersonalJarvisTests\DesktopIntegration\{tmp_path.name}"aumid = f"PersonalJarvis.Test.DesktopIntegration.{tmp_path.name}"aumid_subkey = rf"Software\Classes\AppUserModelId\{aumid}"@@ -191,6 +194,7 @@ def test_windows_managed_install_is_visible_to_start_and_installed_apps(install_dir=root,platform="win32",windows_programs_dir=programs,+ windows_desktop_dir=desktop,windows_registry_subkey=subkey,windows_aumid=aumid,)@@ -198,10 +202,16 @@ def test_windows_managed_install_is_visible_to_start_and_installed_apps(assert report.ok is Trueassert set(report.artifacts) == {"start_menu_launcher",+ "desktop_launcher","installed_apps_registration","windows_app_identity",}assert (programs / "Personal Jarvis.lnk").is_file()+ # The Desktop entry is what Windows Search can actually see: the+ # per-user Start Menu lives under %APPDATA%, which the content index+ # excludes by default (forensic 2026-08-16 — the app was unfindable by+ # name on such a box while its Start-Menu .lnk sat right there).+ assert (desktop / "Personal Jarvis.lnk").is_file()with winreg.OpenKey(winreg.HKEY_CURRENT_USER, subkey) as key:assert winreg.QueryValueEx(key, "DisplayName")[0] == "Personal Jarvis"assert winreg.QueryValueEx(key, "InstallLocation")[0] == str(root)@@ -211,11 +221,14 @@ def test_windows_managed_install_is_visible_to_start_and_installed_apps(removed = di.remove_desktop_integration(platform="win32",windows_programs_dir=programs,+ windows_desktop_dir=desktop,windows_registry_subkey=subkey,windows_aumid=aumid,)assert removed.ok is Trueassert not (programs / "Personal Jarvis.lnk").exists()+ # An uninstall that leaves an icon on the desktop has not uninstalled.+ assert not (desktop / "Personal Jarvis.lnk").exists()with pytest.raises(FileNotFoundError):winreg.OpenKey(winreg.HKEY_CURRENT_USER, subkey)with pytest.raises(FileNotFoundError):diff --git a/tests/unit/ui/test_start_menu_shortcut_target.py b/tests/unit/ui/test_start_menu_shortcut_target.pyindex 558afe4692..431ee9f545 100644--- a/tests/unit/ui/test_start_menu_shortcut_target.py+++ b/tests/unit/ui/test_start_menu_shortcut_target.py@@ -199,6 +199,85 @@ class TestShortcutTargetsOurOwnExe:assert Path(sc.TargetPath).is_file(), "shortcut points at a missing exe"+@windows_only+class TestDesktopShortcutIsTheSearchableEntry:+ """The Desktop entry is the one Windows Search can actually see.++ Forensic 2026-08-16: Windows excludes ``%APPDATA%`` from the content index+ by default, and the per-user Start Menu lives inside it — that machine's+ Start-Menu folder had ZERO indexed entries, so typing the app's name found+ nothing. Discord and Obsidian stayed findable because each also has a+ Desktop .lnk, which IS indexed. Ours had none, and the user noticed the+ missing icon before the missing search hit.+ """++ def test_creates_the_entry(self, tmp_path: Path) -> None:+ assert icon_utils.ensure_desktop_shortcut(+ aumid=_TEST_AUMID, desktop_dir=tmp_path+ )+ lnk = tmp_path / icon_utils.START_MENU_SHORTCUT_NAME+ assert lnk.is_file()++ from win32com.client import Dispatch++ sc = Dispatch("WScript.Shell").CreateShortcut(str(lnk))+ assert Path(sc.TargetPath).is_file(), "desktop entry points at a missing exe"+ assert sc.Arguments.strip() == f"-m {icon_utils._LAUNCHER_MODULE}"++ def test_is_idempotent(self, tmp_path: Path) -> None:+ assert icon_utils.ensure_desktop_shortcut(+ aumid=_TEST_AUMID, desktop_dir=tmp_path+ )+ lnk = tmp_path / icon_utils.START_MENU_SHORTCUT_NAME+ first = lnk.stat().st_mtime_ns+ assert icon_utils.ensure_desktop_shortcut(+ aumid=_TEST_AUMID, desktop_dir=tmp_path+ )+ assert lnk.stat().st_mtime_ns == first, "a matching entry was rewritten"++ def test_does_not_resurrect_an_icon_the_user_deleted(self, tmp_path: Path) -> None:+ """Self-healing must not mean un-deletable — an empty desktop stays empty."""+ assert not icon_utils.ensure_desktop_shortcut(+ aumid=_TEST_AUMID, desktop_dir=tmp_path, create_if_missing=False+ )+ assert not (tmp_path / icon_utils.START_MENU_SHORTCUT_NAME).exists()++ def test_repairs_an_existing_entry_even_without_create(+ self, tmp_path: Path+ ) -> None:+ """A stale target IS repaired — that is a broken icon, not a deleted one."""+ lnk = tmp_path / icon_utils.START_MENU_SHORTCUT_NAME+ lnk.write_bytes(b"not really a shortcut")+ assert icon_utils.ensure_desktop_shortcut(+ aumid=_TEST_AUMID, desktop_dir=tmp_path, create_if_missing=False+ )+ from win32com.client import Dispatch++ sc = Dispatch("WScript.Shell").CreateShortcut(str(lnk))+ assert Path(sc.TargetPath).is_file()++ def test_missing_desktop_dir_is_not_an_error(self, tmp_path: Path) -> None:+ assert not icon_utils.ensure_desktop_shortcut(+ aumid=_TEST_AUMID, desktop_dir=tmp_path / "nope"+ )++ def test_window_less_interpreter_never_claims_it(+ self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch+ ) -> None:+ monkeypatch.setattr(icon_utils, "_interpreter_can_open_a_window", lambda: False)+ assert not icon_utils.ensure_desktop_shortcut(+ aumid=_TEST_AUMID, desktop_dir=tmp_path+ )+ assert not (tmp_path / icon_utils.START_MENU_SHORTCUT_NAME).exists()+++class TestDesktopShortcutOffWindows:+ def test_is_a_noop(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:+ monkeypatch.setattr(icon_utils.sys, "platform", "linux")+ assert icon_utils.ensure_desktop_shortcut(desktop_dir=tmp_path) is False+ assert not (tmp_path / icon_utils.START_MENU_SHORTCUT_NAME).exists()++class TestReexecLoopGuard:"""Launching THROUGH the branded exe must not re-exec through it again."""@@ -234,11 +313,21 @@ class TestShellIsToldAboutTheEntry:def test_writer_announces_the_entry(self) -> None:import inspect- src = inspect.getsource(icon_utils.ensure_start_menu_shortcut)+ src = inspect.getsource(icon_utils._write_branded_shortcut)assert "_notify_shell_of_shortcut(lnk)" in src# …after the property-store commit, which is the last write to the file.assert src.index("rw_store.Commit()") < src.index("_notify_shell_of_shortcut")+ def test_both_entries_go_through_the_same_writer(self) -> None:+ """Start-Menu and Desktop must never drift into different targets."""+ import inspect++ for fn in (+ icon_utils.ensure_start_menu_shortcut,+ icon_utils.ensure_desktop_shortcut,+ ):+ assert "_write_branded_shortcut(" in inspect.getsource(fn), fn.__name__+def test_is_a_noop_off_windows(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None: