The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: Android (Termux) Python reaches the unmanaged gateway start
Teknium00edb3fa7496
diff --git a/hermes_cli/gateway_runtime_service.py b/hermes_cli/gateway_runtime_service.pyindex da0e65098ab..60d70a07f93 100644--- a/hermes_cli/gateway_runtime_service.py+++ b/hermes_cli/gateway_runtime_service.py@@ -212,8 +212,16 @@ def _windows(home: Path, deadline: float) -> ExistingService | None:return None+def _no_supervisor(home: Path, deadline: float) -> None:+ """Android/Termux has no service manager (main refuses `gateway install/start` there and says+ "Run manually: hermes gateway"): an unmanaged detached start is its only owner. Python 3.13++ reports ``sys.platform == "android"``; older Termux interpreters report linux and reach the+ systemd probe, which finds no unit and lands on the same unmanaged start."""++def discover_existing_gateway_service(home: Path, *, deadline: float) -> ExistingService | None:- backend = {"linux": _systemd, "darwin": _launchd, "win32": _windows}.get(sys.platform)+ backend = {"linux": _systemd, "darwin": _launchd, "win32": _windows,+ "android": _no_supervisor}.get(sys.platform)if backend is None:raise RuntimeStartError("unsupported_supervisor_platform")try:diff --git a/tests/hermes_cli/test_gateway_runtime_service.py b/tests/hermes_cli/test_gateway_runtime_service.pyindex 61864c44374..06834e484cb 100644--- a/tests/hermes_cli/test_gateway_runtime_service.py+++ b/tests/hermes_cli/test_gateway_runtime_service.py@@ -296,3 +296,20 @@ def test_gateway_wrapper_requires_actual_python_entrypoint(outer, tmp_path):verify_gateway_argv(argv, tmp_path)else:verify_gateway_argv(argv, tmp_path)+++def test_android_python_reaches_the_unmanaged_start(tmp_path, monkeypatch):+ """Termux is supported and has no service manager; Python 3.13+ there reports+ sys.platform == "android". Ensure must start the gateway unmanaged, not refuse the platform."""+ from hermes_cli import gateway_runtime as runtime, gateway_runtime_service as service, gateway_runtime_start as start++ home = tmp_path / "profile"+ home.mkdir(mode=0o700)+ spawned = []+ monkeypatch.setattr(service.sys, "platform", "android")+ monkeypatch.setattr(service, "_run", lambda *a, **k: pytest.fail("no supervisor to query on Android"))+ monkeypatch.setattr(runtime, "discover_gateway_endpoint", lambda *a, **k: runtime.GatewayDiscovery("absent"))+ monkeypatch.setattr(start, "spawn_unmanaged_gateway", lambda target, **k: spawned.append(Path(target)))+ result = runtime.ensure_gateway_runtime(home, timeout=0.3)+ assert result.reason_code != "unsupported_supervisor_platform"+ assert spawned == [home.resolve()]