The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): accept Windows gateway hosts in the docker path translator
Austin Pickette74f2b8621c8
diff --git a/gateway/platforms/base.py b/gateway/platforms/base.pyindex 20bf54a0560..f6c6f293fbc 100644--- a/gateway/platforms/base.py+++ b/gateway/platforms/base.py@@ -970,8 +970,8 @@ def _parse_docker_volume_mounts() -> list[tuple[Path, Path]]:mounts: list[tuple[Path, Path]] = []for entry in parsed if isinstance(parsed, list) else ():spec = entry.strip() if isinstance(entry, str) else ""- # Prefer the first ':/' so absolute container paths are unambiguous.- sep = spec.find(":/")+ # First ':/' past any Windows drive colon (``C:/data:/workspace``) splits host from container.+ sep = spec.find(":/", 2 if re.match(r"[A-Za-z]:[/\\]", spec) else 0)if sep <= 0:continuecontainer_raw = spec[sep + 1:].split(":", 1)[0] # starts with /@@ -1086,7 +1086,7 @@ def _warn_unresolved_docker_media(candidate: Path, session_key: str, reason: strdef _translate_docker_container_media_path(candidate: Path, session_key: str = "") -> Optional[Path]:"""Container-absolute path -> host path via longest-prefix match over ``docker_volumes``, theauto-mounted cache dirs (``/root/.hermes/...``), persistent ``/workspace`` and ``/root``."""- if not candidate.is_absolute():+ if not candidate.as_posix().startswith("/"): # POSIX even on Windows gateways (not is_absolute)return None# In-process gateways (Desktop, `hermes serve`) may not have bridged terminal.* config into# TERMINAL_* env yet; the bridge is idempotent.diff --git a/tests/gateway/test_platform_base.py b/tests/gateway/test_platform_base.pyindex 8444302965a..a546df17cf8 100644--- a/tests/gateway/test_platform_base.py+++ b/tests/gateway/test_platform_base.py@@ -6,6 +6,8 @@ import timefrom types import SimpleNamespacefrom unittest.mock import patch+from pathlib import Path+import pytestfrom gateway.platforms.base import (@@ -906,6 +908,17 @@ class TestDockerContainerMediaPathTranslation:"/output/report.pdf") == str(media.resolve())+ def test_windows_drive_letter_host_mount_parses(self, monkeypatch):+ """``C:/data:/workspace`` must split on the container colon, not the drive."""+ import json++ from gateway.platforms import base++ monkeypatch.setenv("TERMINAL_DOCKER_VOLUMES", json.dumps(["C:/data:/workspace:ro"]))+ monkeypatch.setattr(base, "_resolve_path", lambda p, **_k: p)++ assert base._parse_docker_volume_mounts() == [(Path("C:/data"), Path("/workspace"))]+def test_longest_prefix_wins(self, tmp_path, monkeypatch):import json