diff --git a/src/agent_env/computers/disk/linux/launcher/launch b/src/agent_env/computers/disk/linux/launcher/launch index 23823708d..a9b66d1c3 100755 --- a/src/agent_env/computers/disk/linux/launcher/launch +++ b/src/agent_env/computers/disk/linux/launcher/launch @@ -118,14 +118,19 @@ for port in ${VM_PORTS:-}; do exit 2 fi forwards="$forwards,hostfwd=tcp:127.0.0.1:$behind-:$port" - socat "TCP-LISTEN:$port,fork,reuseaddr,backlog=1024" "TCP:127.0.0.1:$behind,connect-timeout=0.5,retry=600,interval=0.05" & - fronts+=("$!") done for port in ${VM_HOST_PORTS:-}; do if [[ "$taken " == *" $port "* ]]; then echo "launch: host port $port can't be forwarded: a guest port's proxy or its forward here takes it" >&2 exit 2 fi +done +for port in ${VM_PORTS:-}; do + socat "TCP-LISTEN:$port,fork,reuseaddr,backlog=1024" \ + "TCP:127.0.0.1:$((port + 10000)),connect-timeout=0.5,retry=600,interval=0.05" & + fronts+=("$!") +done +for port in ${VM_HOST_PORTS:-}; do forward "$port" & fronts+=("$!") done diff --git a/tst/unit/agents/claude_code/test_changelog.py b/tst/unit/agents/claude_code/test_changelog.py index 24922364c..047fede63 100644 --- a/tst/unit/agents/claude_code/test_changelog.py +++ b/tst/unit/agents/claude_code/test_changelog.py @@ -505,6 +505,8 @@ def test_the_default_roots_hold_the_workspace_and_the_clis_state(agent_dirs): def _changelog_client(monkeypatch, tmp_path) -> tuple[TestClient, a2a_server.ClaudeCodeChangelogAgent]: monkeypatch.setenv("A2A_PORT", "8000") monkeypatch.setattr(a2a_server, "changelog_dir", lambda environ: tmp_path / "changelog") + monkeypatch.setattr(a2a_server, "_changelog_roots", + lambda: [str(a2a_server.CLAUDE_STATE_DIR), str(a2a_server.WORKSPACE_DIR)]) agent = a2a_server.ClaudeCodeChangelogAgent() return TestClient(a2a_server.build_app(agent)), agent diff --git a/tst/unit/env/envs/test_disk_recipe.py b/tst/unit/env/envs/test_disk_recipe.py index cdd448c9e..c881695ad 100644 --- a/tst/unit/env/envs/test_disk_recipe.py +++ b/tst/unit/env/envs/test_disk_recipe.py @@ -255,7 +255,8 @@ def test_a_launcher_stopped_before_its_computer_starts_exits_as_one_stopped_afte @pytest.mark.parametrize("host_ports", ["18765", "28765"], ids=["a-guest-ports-proxy", "its-forward"]) -def test_the_launcher_refuses_a_host_port_a_guest_ports_proxy_or_forward_takes(launcher, host_ports): +def test_the_launcher_refuses_a_host_port_a_guest_ports_proxy_or_forward_takes_before_it_starts_a_proxy( + launcher, host_ports): launch, calls = launcher refused = launch(VM_PORTS="18765", VM_HOST_PORTS=host_ports) @@ -263,6 +264,7 @@ def test_the_launcher_refuses_a_host_port_a_guest_ports_proxy_or_forward_takes(l assert refused.wait(10) == 2 assert f"host port {host_ports} can't be forwarded: a guest port's proxy or its forward here takes it" in ( refused.stderr.read()) + assert not calls.exists() or "socat" not in calls.read_text() def test_launch_forward_serves_a_host_port_to_the_running_computer_as_the_boot_does(launcher): diff --git a/tst/unit/test_optional_extras_stay_optional.py b/tst/unit/test_optional_extras_stay_optional.py index 526ff3879..0ca3fd032 100644 --- a/tst/unit/test_optional_extras_stay_optional.py +++ b/tst/unit/test_optional_extras_stay_optional.py @@ -4,6 +4,7 @@ installs every extra, so installed state cannot show what an install without one would do.""" import ast +import functools import importlib.metadata import importlib.util import json @@ -114,7 +115,8 @@ def get_authorization_token(self): """ -def _closure(extras: frozenset[str]) -> set[str]: +@functools.cache +def _closure(extras: frozenset[str]) -> frozenset[str]: """The distributions installing this package with ``extras`` pulls in.""" seen: set[tuple[str, frozenset[str]]] = set() pending = [(SELF, extras)] @@ -132,7 +134,7 @@ def _closure(extras: frozenset[str]) -> set[str]: marker = requirement.marker if marker is None or any(marker.evaluate({"extra": e}) for e in wanted | {""}): pending.append((canonicalize_name(requirement.name), frozenset(requirement.extras))) - return {name for name, _ in seen} - {SELF} + return frozenset(name for name, _ in seen) - {SELF} def _only_in(extra: str) -> list[str]: