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(verse): skip the Linux preexec when spawning Verse on macOS (#1176)
Ruben Lütke146fec095463
diff --git a/dodaios/verse_host/supervisor.py b/dodaios/verse_host/supervisor.pyindex a0870a3b28..e1ccd6c2ea 100644--- a/dodaios/verse_host/supervisor.py+++ b/dodaios/verse_host/supervisor.py@@ -3,8 +3,10 @@* Lazy: launched on the first ``show``, never at app start.* Containment: a Windows job object with ``KILL_ON_JOB_CLOSE`` (the app'shandle closes when the app dies, and the job kills Verse); on Linux- ``prctl(PR_SET_PDEATHSIG, SIGKILL)`` plus its own process group. Verse is- only ever stopped by the PID this supervisor started.+ ``prctl(PR_SET_PDEATHSIG, SIGKILL)`` plus its own process group. macOS has+ no ``PR_SET_PDEATHSIG`` and no ``libc.so.6``; the Linux ``preexec_fn``+ raises there and ``subprocess`` aborts the spawn. Verse is only ever+ stopped by the PID this supervisor started.* Token: 256 bits, minted per launch, passed in ``DODAIOS_VERSE_TOKEN`` withthe bridge URL in ``DODAIOS_VERSE_BRIDGE``; never on the command line andnever logged.@@ -188,7 +190,11 @@ def _spawn_contained_sync(argv: list[str], env: dict[str, str], cwd: Path) -> Prexcept OSError:log.warning("verse supervisor: job object unavailable; Verse may outlive the app")else:- kwargs["preexec_fn"] = _linux_preexec # noqa: PLW1509 - prctl must run in the child+ # Linux only. On macOS this preexec loads libc.so.6 and calls prctl,+ # both missing. The raised exception becomes SubprocessError and the+ # spawn dies before Verse starts.+ if sys.platform == "linux":+ kwargs["preexec_fn"] = _linux_preexec # noqa: PLW1509 - prctl must run in the childpopen = subprocess.Popen(argv, **kwargs) # noqa: S603return PopenProcess(popen)diff --git a/tests/unit/verse_host/test_supervisor.py b/tests/unit/verse_host/test_supervisor.pyindex 6c7870e2ac..8f02c77fe4 100644--- a/tests/unit/verse_host/test_supervisor.py+++ b/tests/unit/verse_host/test_supervisor.py@@ -14,6 +14,7 @@ from typing import Anyimport psutilimport pytest+from dodaios.verse_host import supervisor as supervisor_modfrom dodaios.verse_host.bridge import TokenBox, mint_tokenfrom dodaios.verse_host.supervisor import BACKOFF_S, Supervisor, spawn_contained@@ -232,6 +233,33 @@ def test_killing_the_app_ends_verse_within_2s(tmp_path: Path) -> None:proc.kill()+def test_spawn_contained_keeps_linux_preexec_off_macos(+ monkeypatch: pytest.MonkeyPatch, tmp_path: Path+) -> None:+ """macOS has no prctl. The Linux preexec_fn raises and aborts the spawn."""+ seen: dict[str, object] = {}++ class _Popen:+ def __init__(self, argv: list[str], **kwargs: object) -> None:+ seen["argv"] = argv+ seen.update(kwargs)+ self.pid = 4242++ def poll(self) -> None:+ return None++ monkeypatch.setattr(supervisor_mod.subprocess, "Popen", _Popen)+ monkeypatch.setattr(supervisor_mod.sys, "platform", "darwin")+ proc = supervisor_mod._spawn_contained_sync(["verse"], {}, tmp_path)+ assert proc.pid == 4242+ assert "preexec_fn" not in seen++ seen.clear()+ monkeypatch.setattr(supervisor_mod.sys, "platform", "linux")+ supervisor_mod._spawn_contained_sync(["verse"], {}, tmp_path)+ assert seen.get("preexec_fn") is supervisor_mod._linux_preexec++async def test_real_spawn_keeps_token_off_the_command_line(tmp_path: Path) -> None:child = tmp_path / "dummy_verse.py"child.write_text(CHILD.replace("time.sleep(60)", "time.sleep(0.2)"))