Skip to content

The agent that grows with you

fix(gateway): keep drive-letter docker volumes on Windows gateways

Austin Pickett0108ed7b86f6
diff --git a/gateway/platforms/base.py b/gateway/platforms/base.py
index f6c6f293fbc..7e2789708d1 100644
--- a/gateway/platforms/base.py
+++ b/gateway/platforms/base.py
@@ -979,9 +979,8 @@ def _parse_docker_volume_mounts() -> list[tuple[Path, Path]]:
host_expanded = os.path.expanduser(spec[:sep])
if not (host_expanded.startswith("/") or (len(host_expanded) > 1 and host_expanded[1] == ":")):
continue
- host_path, container_path = _resolve_path(Path(host_expanded)), Path(container_raw)
- if host_path is not None and container_path.is_absolute():
- mounts.append((host_path, container_path))
+ if (host_path := _resolve_path(Path(host_expanded))) is not None: # container_raw is POSIX on any OS
+ mounts.append((host_path, Path(container_raw)))
return mounts
diff --git a/tests/gateway/test_platform_base.py b/tests/gateway/test_platform_base.py
index a546df17cf8..9755aefe1be 100644
--- a/tests/gateway/test_platform_base.py
+++ b/tests/gateway/test_platform_base.py
@@ -871,6 +871,20 @@ class TestMediaDeliveryDefaultMode:
assert BasePlatformAdapter.validate_media_delivery_path(str(link)) is None
+def test_windows_drive_letter_host_mount_parses(monkeypatch):
+ """``C:/data:/workspace`` splits on the container colon, not the drive, and keeps the
+ POSIX container root on every gateway (``Path("/workspace").is_absolute()`` is False on
+ Windows). Unmarked so the Windows lanes run it."""
+ 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"))]
+
+
@pytest.mark.platforms("linux")
class TestDockerContainerMediaPathTranslation:
"""MEDIA:/workspace (and configured mounts) must resolve to host paths."""
@@ -908,17 +922,6 @@ 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