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(desktop): drop an inherited ELECTRON_RUN_AS_NODE so opened apps start

rubenluetke10-beep459a8bfff536
diff --git a/jarvis/core/process_utils.py b/jarvis/core/process_utils.py
index c00012d98d..ae17aee176 100644
--- a/jarvis/core/process_utils.py
+++ b/jarvis/core/process_utils.py
@@ -79,6 +79,27 @@ def ensure_standard_streams() -> None:
pass
+# Set by an Electron host (the Claude desktop app, VS Code, Cursor) for the
+# Node.js helpers it spawns. When the app is started or restarted from inside
+# such a host, the variable reaches this process and every child it starts:
+# an Electron program launched with it set runs as bare Node.js and exits, so
+# "Open in VS Code" / "Open in Cursor" and opening Slack, Discord or any other
+# Electron app silently did nothing (found 2026-10-05: ``Code.exe --version``
+# printed a Node version). Nothing in this Python process needs it.
+_INHERITED_ELECTRON_VARS = ("ELECTRON_RUN_AS_NODE",)
+
+
+def drop_inherited_electron_node_mode() -> None:
+ """Remove the Electron "run as Node" switch this process may have inherited.
+
+ Call once at startup, before any child process is spawned, so programs the
+ app opens (directly, via ``os.startfile`` or via ``open``/``xdg-open``)
+ start as themselves. Harmless on every OS when the variable is absent.
+ """
+ for name in _INHERITED_ELECTRON_VARS:
+ os.environ.pop(name, None)
+
+
def standard_error_is_visible() -> bool:
"""Can a human read what we write to ``sys.stderr``?
diff --git a/jarvis/ui/desktop_app.py b/jarvis/ui/desktop_app.py
index 5a17ad9987..e6b3412c3e 100644
--- a/jarvis/ui/desktop_app.py
+++ b/jarvis/ui/desktop_app.py
@@ -32,7 +32,7 @@ from filelock import FileLock, Timeout
from jarvis.core.config import DATA_DIR, JarvisConfig, load_config
from jarvis.core.instance import current_instance
-from jarvis.core.process_utils import ensure_standard_streams
+from jarvis.core.process_utils import drop_inherited_electron_node_mode, ensure_standard_streams
if TYPE_CHECKING:
from jarvis.ui.desktop_background import BackgroundStatus
@@ -50,6 +50,7 @@ _SPA_DOCUMENT_PROBE = "document.getElementById('root') !== null"
# Direct ``python -m jarvis.ui.desktop_app`` entry points bypass the launcher,
# so they need the same pythonw/PyInstaller stream repair here as well.
ensure_standard_streams()
+drop_inherited_electron_node_mode()
if sys.platform == "win32":
try:
diff --git a/jarvis/ui/web/launcher.py b/jarvis/ui/web/launcher.py
index fabd163c0a..174f856aa4 100644
--- a/jarvis/ui/web/launcher.py
+++ b/jarvis/ui/web/launcher.py
@@ -27,7 +27,10 @@ import time
from jarvis.core.branding import CONFIG_FILE_NAME
from jarvis.core.branding import PRODUCT_NAME as APP_DISPLAY_NAME
-from jarvis.core.process_utils import ensure_standard_streams
+from jarvis.core.process_utils import (
+ drop_inherited_electron_node_mode,
+ ensure_standard_streams,
+)
from jarvis.core.win32_dpi import ensure_dpi_awareness as _ensure_dpi_awareness
# Boot-profiling anchor (opt-in via JARVIS_BOOT_PROFILE=1). ``main()`` stamps the
@@ -42,6 +45,8 @@ _BOOT_PROFILE_T0: float | None = None
# streams. Uvicorn probes stdout while configuring its formatter, so repair the
# streams before any desktop/backend construction can begin.
ensure_standard_streams()
+# Programs this app opens must start as themselves, not as bare Node.js.
+drop_inherited_electron_node_mode()
# DPI awareness — claim PER_MONITOR_AWARE for the whole process BEFORE anything
# imports pywebview. Windows honours only the FIRST process-awareness claim, and
diff --git a/tests/unit/core/test_process_utils_electron_env.py b/tests/unit/core/test_process_utils_electron_env.py
new file mode 100644
index 0000000000..ede15048fb
--- /dev/null
+++ b/tests/unit/core/test_process_utils_electron_env.py
@@ -0,0 +1,32 @@
+"""An inherited Electron "run as Node" switch never reaches programs the app opens."""
+
+from __future__ import annotations
+
+import os
+import subprocess
+import sys
+
+import pytest
+
+from jarvis.core.process_utils import drop_inherited_electron_node_mode
+
+
+def test_drop_removes_the_switch_for_every_later_child(monkeypatch: pytest.MonkeyPatch) -> None:
+ monkeypatch.setenv("ELECTRON_RUN_AS_NODE", "1")
+ drop_inherited_electron_node_mode()
+ assert "ELECTRON_RUN_AS_NODE" not in os.environ
+ probe = "import os; print(os.environ.get('ELECTRON_RUN_AS_NODE', 'absent'))"
+ child = subprocess.run(
+ [sys.executable, "-c", probe],
+ capture_output=True,
+ text=True,
+ check=True,
+ )
+ assert child.stdout.strip() == "absent"
+
+
+def test_drop_is_harmless_when_the_switch_is_absent(monkeypatch: pytest.MonkeyPatch) -> None:
+ monkeypatch.delenv("ELECTRON_RUN_AS_NODE", raising=False)
+ monkeypatch.setenv("JARVIS_TEST_KEEP", "1")
+ drop_inherited_electron_node_mode()
+ assert os.environ["JARVIS_TEST_KEEP"] == "1"