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(autostart): remove a startup shortcut left beside the logon task (#664)
Ruben Lütke78a2f4883fd1
diff --git a/jarvis/autostart/windows.py b/jarvis/autostart/windows.pyindex 53f1ac2aa6..276a7eac5e 100644--- a/jarvis/autostart/windows.py+++ b/jarvis/autostart/windows.py@@ -544,6 +544,12 @@ class WindowsAutostart:info = self._task_probe()if info is not None:action_matches = self._task_matches(info, spec)+ # A startup shortcut left beside a matching task launches the app a+ # second time at login, and with whatever working folder it was+ # written from - possibly another checkout. That is not current:+ # reporting it as such made the boot reconcile skip install(), the+ # only place that removes the leftover, so it survived forever.+ leftover_shortcut = action_matches and info.enabled and self._shortcut_present()if not info.enabled:# A task can be switched off in Task Scheduler, by a group# policy or by a "startup optimizer" while its action still@@ -557,6 +563,12 @@ class WindowsAutostart:"does not start at login — re-enable instant start in ""Settings to switch it back on.")+ elif leftover_shortcut:+ detail = (+ "Autostart enabled via scheduled task, but a leftover startup "+ "shortcut would start Dodaios a second time; it is removed on "+ "the next start."+ )elif action_matches:detail = ("Autostart enabled via scheduled task — instant start at login."@@ -569,7 +581,7 @@ class WindowsAutostart:return AutostartStatus(supported=True,installed=True,- matches_spec=action_matches and info.enabled,+ matches_spec=action_matches and info.enabled and not leftover_shortcut,entry_path=self._task_entry_path(),detail=detail,)diff --git a/tests/unit/autostart/test_windows_task.py b/tests/unit/autostart/test_windows_task.pyindex 6394347960..01de5e5156 100644--- a/tests/unit/autostart/test_windows_task.py+++ b/tests/unit/autostart/test_windows_task.py@@ -374,6 +374,31 @@ def test_install_drops_a_leftover_shortcut_when_the_task_already_matches() -> Noassert calls == ["remove_shortcut"]+def test_a_leftover_shortcut_beside_a_matching_task_is_not_current() -> None:+ # The boot reconcile only calls install() for an entry that is not current.+ # Reporting task + leftover shortcut as current kept the shortcut forever,+ # and with it a second launch at login from the folder that wrote it.+ mgr, calls = _mk(task_info=_MATCHING_INFO, shortcut_present=True)+ st = mgr.status(_SPEC)+ assert st.installed is True+ assert st.matches_spec is False+ assert "leftover" in st.detail+ assert calls == []+++def test_reconcile_removes_a_leftover_shortcut_beside_a_matching_task(monkeypatch) -> None:+ import jarvis.autostart as autostart++ from .conftest import make_caps, make_cfg++ mgr, calls = _mk(task_info=_MATCHING_INFO, shortcut_present=True)+ monkeypatch.setattr(autostart, "make_autostart_manager", lambda caps: mgr)+ monkeypatch.setattr(autostart, "resolve_launch_spec", lambda cfg: _SPEC)+ result = autostart.reconcile_autostart(make_cfg(enabled=True), make_caps())+ assert calls == ["remove_shortcut"]+ assert result.matches_spec is True++def test_truncated_shortcut_readback_is_drift_not_a_match(monkeypatch) -> None:# Padding the missing fields with "" made a half-failed COM read compare# equal to a spec with no args/working dir — reporting a stale shortcut as