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(voice): enable contained Codex transport on POSIX

Ruben Lütke7ba567932815
diff --git a/docs/codex-subscription-realtime-voice.md b/docs/codex-subscription-realtime-voice.md
index adbdfe39f3..f590d48d1e 100644
--- a/docs/codex-subscription-realtime-voice.md
+++ b/docs/codex-subscription-realtime-voice.md
@@ -96,8 +96,9 @@ entries are rejected.
At process launch Jarvis:
1. Requires the exact official Codex 0.146.0 native executable and verifies its
- SHA-256. The first experimental release is enabled on Windows only because
- its Job Object provides kernel-enforced kill-on-parent-exit containment.
+ SHA-256. Windows uses a kill-on-close Job Object. macOS and Linux launch the
+ native binary behind a process-group supervisor whose parent-owned lifeline
+ pipe kills the group if Jarvis crashes.
2. Forces file-backed auth and strips inherited OpenAI/API billing credentials,
proxy/provider variables, and keyring-session variables.
3. Supplies isolated temporary home, app-data, log, database, model-catalog,
@@ -126,11 +127,11 @@ the subscription voice card's Connect action. That launches a fresh interactive
ChatGPT login for this feature only. No API key is requested through chat or
voice.
-Windows supports the experimental subscription transport. macOS and Linux
-receive an explicit unavailable result until Jarvis has a verified
-kill-on-parent-exit supervisor for those systems; a hard crash must never leave
-an orphan Codex process holding the private profile indefinitely. This
-limitation does not affect API-backed realtime providers or standard voice.
+Windows, macOS, and Linux desktops support the experimental subscription
+transport on the approved architectures. Voice capture still follows the
+normal host audio capability gate, so a machine without usable audio degrades
+honestly. Unsupported architectures receive an explicit unavailable result
+without affecting API-backed realtime providers or standard voice.
## Upgrade policy
diff --git a/docs/os-parity.md b/docs/os-parity.md
index 058252526a..7e249cfd7f 100644
--- a/docs/os-parity.md
+++ b/docs/os-parity.md
@@ -24,6 +24,10 @@ host's Tk bootstrap root cannot steal them.
Windows (OLE/WebView2) and macOS (AppKit/WKWebView) sources. P-15 records the
remaining GTK source gap; reveal/open actions remain available on Linux.
+**Fix pass 2026-07-31:** P-28 fixed and removed. Codex subscription voice now
+uses a parent-lifeline process-group supervisor on macOS and Linux, while
+Windows retains kernel Job Object containment.
+
## Audit verdict summary
**No hard breakers found.** No feature crashes on macOS or headless Linux;
@@ -49,7 +53,6 @@ experiences today.
| # | Impact | Area | Gap | Evidence | Behavior off-Windows |
|---|---|---|---|---|---|
-| P-28 | Medium | Codex subscription voice | The pinned experimental Codex app-server transport requires kernel-enforced kill-on-parent-exit containment. Windows has a kill-on-close Job Object; macOS and Linux are gated until an equally reliable supervisor is implemented and crash-tested. | `jarvis/codex_app_server.py::_trusted_native_codex_binary`, `docs/codex-subscription-realtime-voice.md` | macOS and Linux show an explicit unavailable status for subscription voice. API Realtime, Pipeline voice, and the rest of Jarvis continue to work normally. |
| P-24 | Medium | Dictation shortcut | The global dictation/call shortcut needs `pynput` on Linux/X11, and `pynput` hard-requires `evdev` — which is published **source-only** (verified on PyPI 2026-07-28: evdev 1.9.3 ships an sdist and no wheels) and compiles against the kernel headers. Putting it in `[full]` would break the one advertised install path on a stock `python:3.11-slim`, so it is the opt-in `[desktop-linux]` extra instead. Wayland is a separate, unfixable-by-install case: the compositor owns global shortcuts by design (the XDG `GlobalShortcuts` portal lets the *compositor* assign the keys, and no wlroots compositor implements it at all) | `pyproject.toml` (`desktop-linux`), `jarvis/platform/probes.py::has_hotkey`, `jarvis/trigger/backends/noop.py::explain_unavailable` | X11 without the extra: no global shortcut, and the log/UI now names the actual cause and the exact `pip install` that fixes it (it used to blame Wayland unconditionally). Wayland: no global shortcut at all — bind a compositor shortcut to `jarvis api dictation start`. On both, dictation still works from the Jarvis Bar, the Dictation view and the CLI, and voice still works via the wake word |
| P-25 | Medium | Dictation insertion | Pasting the transcript into another application is blocked, silently, in three OS-specific situations: Windows UIPI when the foreground window is elevated and Jarvis is not (`SendInput` reports success and the input is discarded), macOS Secure Input while a password field is focused, and Wayland outright (no synthetic input). Detection exists for the first two; Wayland is refused up front | `jarvis/dictation/insert.py::describe_target`, `jarvis/platform/input_isolation.py::windows_foreground_window_is_elevated`, `macos_secure_input_enabled` | All three degrade to the SAME honest outcome instead of silence: the transcript is left on the clipboard, the result is reported as `clipboard_only`, and the bar plus the Dictation view say why and that Ctrl+V will paste it. macOS Secure Input detection is implemented but has not been verified on real hardware from this machine |
| P-02 | Low | Awareness | Idle detection has no Wayland backend (Windows GetLastInputInfo, macOS Quartz, Linux X11 `xprintidle` all exist since 2026-07-16); Wayland exposes no global idle time without portal support | `jarvis/awareness/watchers/idle.py` | Wayland: one honest log line, watcher does not start |
diff --git a/jarvis/codex_app_server.py b/jarvis/codex_app_server.py
index 53d48859d1..c23a253dc9 100644
--- a/jarvis/codex_app_server.py
+++ b/jarvis/codex_app_server.py
@@ -50,6 +50,9 @@ _SHUTDOWN_TIMEOUT_S: Final = 2.0
_DEFAULT_SDP_TIMEOUT_S: Final = 15.0
_DEFAULT_NOTIFICATION_QUEUE_SIZE: Final = 512
_SUPPORTED_CODEX_VERSION: Final = "codex-cli 0.146.0"
+_CHILD_LIFELINE_SCRIPT: Final = str(
+ Path(__file__).parent / "core" / "child_lifeline.py"
+)
# SHA-256 of the native executables in OpenAI's six official npm artifacts for
# @openai/codex 0.146.0. The app-server protocol used below is experimental;
@@ -791,16 +794,38 @@ def _sha256_file(path: Path) -> str:
return digest.hexdigest()
+def _codex_package_roots(launcher: Path) -> list[Path]:
+ """Return local npm package roots without invoking npm or trusting PATH order."""
+ search_dirs = [launcher.parent, *list(launcher.parents)[:8]]
+ for entry in os.environ.get("PATH", "").split(os.pathsep):
+ if entry.strip():
+ search_dirs.append(Path(entry))
+ try:
+ from jarvis.core.path_augment import candidate_dirs
+
+ search_dirs.extend(Path(entry) for entry in candidate_dirs())
+ except Exception: # noqa: BLE001 - optional discovery must stay fail-closed
+ log.debug("Codex package-root discovery could not read augmented paths", exc_info=True)
+
+ package_roots: list[Path] = []
+ for directory in search_dirs:
+ if directory.name == "codex" and directory.parent.name == "@openai":
+ package_roots.append(directory)
+ package_roots.extend(
+ (
+ directory / "node_modules" / "@openai" / "codex",
+ directory.parent / "node_modules" / "@openai" / "codex",
+ directory.parent / "lib" / "node_modules" / "@openai" / "codex",
+ )
+ )
+ return package_roots
+
+
def _trusted_native_codex_binary(resolved_binary: str, version: str | None) -> str:
if version != _SUPPORTED_CODEX_VERSION:
raise CodexSubscriptionUnavailable(
f"Subscription voice requires Codex CLI {_SUPPORTED_CODEX_VERSION}."
)
- if sys.platform != "win32":
- raise CodexSubscriptionContainmentUnavailable(
- "Experimental Codex subscription voice is unavailable on this platform "
- "until kill-on-parent-exit process containment is available."
- )
target = _TRUSTED_CODEX_TARGETS.get((sys.platform, _normalized_machine()))
if target is None:
raise CodexSubscriptionUnavailable(
@@ -814,13 +839,7 @@ def _trusted_native_codex_binary(resolved_binary: str, version: str | None) -> s
raise CodexSubscriptionUnavailable("The Codex CLI binary is unavailable.") from exc
candidates: list[Path] = [launcher]
- roots = [launcher.parent, *list(launcher.parents)[:8]]
- package_roots: list[Path] = []
- for root in roots:
- if root.name == "codex" and root.parent.name == "@openai":
- package_roots.append(root)
- package_roots.append(root / "node_modules" / "@openai" / "codex")
- for package_root in package_roots:
+ for package_root in _codex_package_roots(launcher):
candidates.extend(
(
package_root
@@ -1343,6 +1362,7 @@ class CodexAppServerClient:
self._child_environment: dict[str, str] = {}
self._process: asyncio.subprocess.Process | None = None
self._process_tree: ProcessTree | None = None
+ self._lifeline_write_fd: int | None = None
self._reader_task: asyncio.Task[None] | None = None
self._stderr_task: asyncio.Task[None] | None = None
self._start_lock = asyncio.Lock()
@@ -1899,10 +1919,8 @@ class CodexAppServerClient:
"stderr": asyncio.subprocess.PIPE,
"cwd": self._safe_thread_cwd(),
}
- if sys.platform != "win32":
- kwargs["start_new_session"] = True
- kwargs["pass_fds"] = _subscription_transport_pass_fds(self)
-
+ lifeline_read_fd: int | None = None
+ lifeline_write_fd: int | None = None
tree = make_process_tree("codex-app-server")
if not bool(getattr(tree, "supports_containment", False)):
tree.close()
@@ -1910,38 +1928,69 @@ class CodexAppServerClient:
"Codex app-server process-tree containment is unavailable."
)
try:
- process = await asyncio.create_subprocess_exec(
- *command,
- creationflags=_windows_creationflags(allow_breakaway=True),
- **kwargs,
- )
- except PermissionError:
if sys.platform != "win32":
- tree.close()
- raise
- log.warning(
- "Codex app-server breakaway was denied; retrying with no-window process flags"
- )
+ lifeline_read_fd, lifeline_write_fd = os.pipe()
+ os.set_inheritable(lifeline_read_fd, True)
+ os.set_inheritable(lifeline_write_fd, False)
+ command = [
+ sys.executable,
+ "-I",
+ _CHILD_LIFELINE_SCRIPT,
+ str(lifeline_read_fd),
+ "--",
+ *command,
+ ]
+ kwargs["start_new_session"] = True
+ kwargs["pass_fds"] = (
+ *_subscription_transport_pass_fds(self),
+ lifeline_read_fd,
+ )
+ except BaseException:
+ tree.close()
+ for descriptor in (lifeline_read_fd, lifeline_write_fd):
+ if descriptor is not None:
+ with suppress(OSError):
+ os.close(descriptor)
+ raise
+ try:
try:
+ process = await asyncio.create_subprocess_exec(
+ *command,
+ creationflags=_windows_creationflags(allow_breakaway=True),
+ **kwargs,
+ )
+ except PermissionError:
+ if sys.platform != "win32":
+ raise
+ log.warning(
+ "Codex app-server breakaway was denied; retrying with no-window "
+ "process flags"
+ )
process = await asyncio.create_subprocess_exec(
*command,
creationflags=_windows_creationflags(allow_breakaway=False),
**kwargs,
)
- except BaseException:
- tree.close()
- raise
except BaseException:
tree.close()
+ if lifeline_write_fd is not None:
+ with suppress(OSError):
+ os.close(lifeline_write_fd)
raise
+ finally:
+ if lifeline_read_fd is not None:
+ with suppress(OSError):
+ os.close(lifeline_read_fd)
self._process = process
self._process_tree = tree
+ self._lifeline_write_fd = lifeline_write_fd
try:
tree.assign(process.pid)
except Exception as exc: # noqa: BLE001 - containment is mandatory
self._process = None
self._process_tree = None
+ self._close_lifeline()
with suppress(ProcessLookupError, OSError):
process.kill()
with suppress(Exception):
@@ -1958,6 +2007,13 @@ class CodexAppServerClient:
)
log.info("Codex app-server process started; account verification pending")
+ def _close_lifeline(self) -> None:
+ descriptor = self._lifeline_write_fd
+ self._lifeline_write_fd = None
+ if descriptor is not None:
+ with suppress(OSError):
+ os.close(descriptor)
+
async def request(
self,
method: str,
@@ -2572,6 +2628,7 @@ class CodexAppServerClient:
process = self._process
if process is None:
self._ready = False
+ self._close_lifeline()
if self._profile_transport_reserved:
_release_subscription_transport(self)
self._profile_transport_reserved = False
@@ -2630,6 +2687,7 @@ class CodexAppServerClient:
await asyncio.wait_for(process.wait(), timeout=_SHUTDOWN_TIMEOUT_S)
if tree is not None:
tree.close()
+ self._close_lifeline()
if self._profile_transport_reserved:
_release_subscription_transport(self)
self._profile_transport_reserved = False
diff --git a/jarvis/core/child_lifeline.py b/jarvis/core/child_lifeline.py
new file mode 100644
index 0000000000..4c972f9ec5
--- /dev/null
+++ b/jarvis/core/child_lifeline.py
@@ -0,0 +1,73 @@
+"""Run one POSIX child tree with a parent-owned lifetime pipe.
+
+The parent keeps the write end open. If it crashes, the kernel closes that end,
+this supervisor observes EOF, and the entire process group is killed. Normal
+shutdown reaches the child through stdin and lets it exit before the supervisor.
+"""
+
+from __future__ import annotations
+
+import os
+import signal
+import subprocess
+import sys
+import threading
+from collections.abc import Sequence
+
+
+def _kill_process_group() -> None:
+ try:
+ os.killpg(os.getpgrp(), signal.SIGKILL)
+ except (AttributeError, OSError):
+ os._exit(137)
+
+
+def _watch_parent(lifeline_fd: int, completed: threading.Event) -> None:
+ try:
+ while os.read(lifeline_fd, 1):
+ pass
+ except OSError:
+ pass
+ if not completed.is_set():
+ _kill_process_group()
+
+
+def run(lifeline_fd: int, command: Sequence[str]) -> int:
+ """Run ``command`` and kill its process group if ``lifeline_fd`` reaches EOF."""
+ if lifeline_fd < 0 or not command:
+ return 2
+ completed = threading.Event()
+ watcher = threading.Thread(
+ target=_watch_parent,
+ args=(lifeline_fd, completed),
+ name="jarvis-parent-lifeline",
+ daemon=True,
+ )
+ watcher.start()
+ try:
+ child = subprocess.Popen(list(command), close_fds=True) # noqa: S603
+ return int(child.wait())
+ except (OSError, ValueError):
+ return 127
+ finally:
+ completed.set()
+ try:
+ os.close(lifeline_fd)
+ except OSError:
+ pass
+
+
+def main(argv: Sequence[str] | None = None) -> int:
+ """Parse the fixed internal ``FD -- command`` contract."""
+ args = list(sys.argv[1:] if argv is None else argv)
+ if len(args) < 3 or args[1] != "--":
+ return 2
+ try:
+ lifeline_fd = int(args[0])
+ except ValueError:
+ return 2
+ return run(lifeline_fd, args[2:])
+
+
+if __name__ == "__main__":
+ raise SystemExit(main())
diff --git a/tests/unit/codex_app_server/test_transport.py b/tests/unit/codex_app_server/test_transport.py
index ee58db8ac1..d47a025c0d 100644
--- a/tests/unit/codex_app_server/test_transport.py
+++ b/tests/unit/codex_app_server/test_transport.py
@@ -375,7 +375,7 @@ async def test_lazy_start_handshake_scrubs_api_billing_environment_and_reaps_tre
@pytest.mark.asyncio
-async def test_posix_child_inherits_the_profile_lock_descriptor(
+async def test_posix_child_runs_behind_parent_lifeline_and_inherits_profile_lock(
monkeypatch: pytest.MonkeyPatch,
) -> None:
monkeypatch.setattr(transport.sys, "platform", "linux")
@@ -384,8 +384,48 @@ async def test_posix_child_inherits_the_profile_lock_descriptor(
await client.ensure_started()
- assert harness.calls[0][1]["pass_fds"] == (91,)
+ argv, kwargs = harness.calls[0]
+ assert argv[0:2] == (sys.executable, "-I")
+ assert Path(argv[2]).name == "child_lifeline.py"
+ separator = argv.index("--")
+ assert argv[separator + 1 : separator + 6] == (
+ "codex-test",
+ "app-server",
+ "--strict-config",
+ "--enable",
+ "realtime_conversation",
+ )
+ assert kwargs["start_new_session"] is True
+ assert kwargs["pass_fds"][0] == 91
+ assert len(kwargs["pass_fds"]) == 2
+ assert client._lifeline_write_fd is not None
await client.close()
+ assert client._lifeline_write_fd is None
+
+
+async def test_posix_lifeline_setup_failure_closes_both_pipe_descriptors(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ monkeypatch.setattr(transport.sys, "platform", "linux")
+ harness = SpawnHarness(monkeypatch)
+ closed: list[int] = []
+ monkeypatch.setattr(transport.os, "pipe", lambda: (80, 81))
+ monkeypatch.setattr(transport.os, "set_inheritable", lambda *_args: None)
+ monkeypatch.setattr(transport.os, "close", closed.append)
+
+ def unavailable_lock(_client: CodexAppServerClient) -> tuple[int, ...]:
+ raise CodexSubscriptionUnavailable("profile lock unavailable")
+
+ monkeypatch.setattr(transport, "_subscription_transport_pass_fds", unavailable_lock)
+ client = CodexAppServerClient()
+
+ with pytest.raises(CodexSubscriptionUnavailable, match="profile lock unavailable"):
+ await client.ensure_started()
+
+ assert closed == [80, 81]
+ assert harness.calls == []
+ assert harness.all_trees[0].closed is True
@pytest.mark.asyncio
@@ -1611,21 +1651,92 @@ def test_native_codex_version_and_hash_are_both_required(
)
[email protected]("platform", ["darwin", "linux"])
-def test_subscription_transport_refuses_posix_without_parent_death_containment(
+def test_trusted_binary_discovery_recovers_from_a_windows_store_launcher(
monkeypatch: pytest.MonkeyPatch,
- platform: str,
+ tmp_path: Path,
) -> None:
- monkeypatch.setattr(transport.sys, "platform", platform)
+ launcher = tmp_path / "WindowsApps" / "codex.exe"
+ launcher.parent.mkdir()
+ launcher.write_bytes(b"store-alias")
+ npm_dir = tmp_path / "npm"
+ native = (
+ npm_dir
+ / "node_modules"
+ / "@openai"
+ / "codex"
+ / "node_modules"
+ / "@openai"
+ / "codex-win32-x64"
+ / "vendor"
+ / "x86_64-pc-windows-msvc"
+ / "bin"
+ / "codex.exe"
+ )
+ native.parent.mkdir(parents=True)
+ native.write_bytes(b"official-npm-binary")
+ monkeypatch.setattr(transport.sys, "platform", "win32")
+ monkeypatch.setattr(transport, "_normalized_machine", lambda: "x86_64")
+ monkeypatch.setenv("PATH", str(npm_dir))
+ monkeypatch.setattr("jarvis.core.path_augment.candidate_dirs", lambda: [])
+ monkeypatch.setattr(
+ transport,
+ "_sha256_file",
+ lambda path: "approved-hash" if path == native.resolve() else "wrong-hash",
+ )
+ monkeypatch.setattr(
+ transport,
+ "_TRUSTED_CODEX_TARGETS",
+ {
+ ("win32", "x86_64"): (
+ "win32-x64",
+ "x86_64-pc-windows-msvc",
+ "codex.exe",
+ "approved-hash",
+ )
+ },
+ )
- with pytest.raises(
- transport.CodexSubscriptionContainmentUnavailable,
- match="kill-on-parent-exit",
- ):
- transport._trusted_native_codex_binary(
- "/unused/codex",
- transport._SUPPORTED_CODEX_VERSION,
- )
+ assert transport._trusted_native_codex_binary(
+ str(launcher), transport._SUPPORTED_CODEX_VERSION
+ ) == str(native.resolve())
+
+
+ ("runtime_platform", "machine", "variant", "triple"),
+ [
+ ("darwin", "arm64", "darwin-arm64", "aarch64-apple-darwin"),
+ ("linux", "x86_64", "linux-x64", "x86_64-unknown-linux-musl"),
+ ],
+)
+def test_subscription_transport_accepts_approved_posix_binary(
+ monkeypatch: pytest.MonkeyPatch,
+ tmp_path: Path,
+ runtime_platform: str,
+ machine: str,
+ variant: str,
+ triple: str,
+) -> None:
+ binary = tmp_path / "codex"
+ binary.write_bytes(b"official-posix-binary")
+ monkeypatch.setattr(transport.sys, "platform", runtime_platform)
+ monkeypatch.setattr(transport, "_normalized_machine", lambda: machine)
+ monkeypatch.setattr(transport, "_sha256_file", lambda _path: "approved-hash")
+ monkeypatch.setattr(
+ transport,
+ "_TRUSTED_CODEX_TARGETS",
+ {
+ (runtime_platform, machine): (
+ variant,
+ triple,
+ "codex",
+ "approved-hash",
+ )
+ },
+ )
+
+ assert transport._trusted_native_codex_binary(
+ str(binary), transport._SUPPORTED_CODEX_VERSION
+ ) == str(binary.resolve())
def test_dedicated_profile_rejects_hardlinked_auth_file(
diff --git a/tests/unit/core/test_child_lifeline.py b/tests/unit/core/test_child_lifeline.py
new file mode 100644
index 0000000000..0a4c329961
--- /dev/null
+++ b/tests/unit/core/test_child_lifeline.py
@@ -0,0 +1,32 @@
+from __future__ import annotations
+
+import threading
+
+import jarvis.core.child_lifeline as lifeline
+
+
+def test_parent_eof_kills_the_supervised_process_group(monkeypatch) -> None:
+ killed: list[bool] = []
+ monkeypatch.setattr(lifeline.os, "read", lambda _fd, _size: b"")
+ monkeypatch.setattr(lifeline, "_kill_process_group", lambda: killed.append(True))
+
+ lifeline._watch_parent(7, threading.Event())
+
+ assert killed == [True]
+
+
+def test_normal_child_completion_disarms_parent_eof(monkeypatch) -> None:
+ killed: list[bool] = []
+ completed = threading.Event()
+ completed.set()
+ monkeypatch.setattr(lifeline.os, "read", lambda _fd, _size: b"")
+ monkeypatch.setattr(lifeline, "_kill_process_group", lambda: killed.append(True))
+
+ lifeline._watch_parent(7, completed)
+
+ assert killed == []
+
+
+def test_main_rejects_malformed_internal_contract() -> None:
+ assert lifeline.main([]) == 2
+ assert lifeline.main(["not-an-fd", "--", "codex"]) == 2