Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
fix(cli): bind 0.0.0.0 on WSL so services reach the Windows host
trohitgc0dbd0f8f409
diff --git a/cli/commands/start.py b/cli/commands/start.pyindex c98e94c9..6c7fa4c8 100644--- a/cli/commands/start.py+++ b/cli/commands/start.py@@ -24,7 +24,6 @@ from cli._common import build_backend_spec, error_block, free_all_ports, prefligfrom cli.colors import consolefrom cli.platform_ import (IS_WINDOWS,- IS_WSL,platform_name,server_dir,server_venv,@@ -122,10 +121,13 @@ def _read_version(root: Path) -> str:def _build_specs(root: Path, cfg, *, temporal_running: bool) -> list[ServiceSpec]:- # Match the existing behaviour: production uses python:start- # (bind 127.0.0.1) on Windows/WSL, python:daemon (bind 0.0.0.0)- # on POSIX.- backend_host = "127.0.0.1" if (IS_WINDOWS or IS_WSL) else "0.0.0.0"+ # Bind host: ``MACHINA_BIND_HOST`` overrides the auto-pick (escape+ # hatch when the platform detection is wrong or the operator wants+ # a specific interface). Default — native Windows stays private on+ # 127.0.0.1; WSL + POSIX bind 0.0.0.0 so the service is reachable+ # both via in-VM ``localhost`` AND via the WSL VM IP from the+ # Windows host, regardless of WSL2's localhostForwarding state.+ backend_host = os.environ.get("MACHINA_BIND_HOST") or ("127.0.0.1" if IS_WINDOWS else "0.0.0.0")specs: list[ServiceSpec] = [ServiceSpec(diff --git a/cli/platform_.py b/cli/platform_.pyindex 946e1695..6ccd7dcc 100644--- a/cli/platform_.py+++ b/cli/platform_.py@@ -28,6 +28,7 @@ of the project agree on per-OS conventions.from __future__ import annotationsimport os+import platformimport sysfrom pathlib import Path@@ -35,7 +36,12 @@ from pathlib import PathIS_WINDOWS = sys.platform == "win32"IS_MACOS = sys.platform == "darwin"IS_LINUX = sys.platform.startswith("linux")-IS_WSL = IS_LINUX and ("WSL_DISTRO_NAME" in os.environ or "WSLENV" in os.environ)+# ``platform.release()`` returns the kernel version string. On WSL2 it+# always contains ``"microsoft"`` (e.g. ``5.15.167.4-microsoft-standard-WSL2``)+# regardless of whether ``WSL_DISTRO_NAME`` is exported into the current+# subprocess. Stdlib, kernel-level — survives daemonised / cron / systemd+# launches that strip WSL env vars.+IS_WSL = IS_LINUX and "microsoft" in platform.release().lower()IS_GIT_BASH = IS_WINDOWS and bool(os.environ.get("MSYSTEM") or "bash" in (os.environ.get("SHELL") or ""))