[GH-ISSUE #5274] lan_e2e and agent_control_e2e can't run on Windows (symlink privilege, vscreen, horizon-ctl launch never returns) #1620

Closed
opened 2026-11-02 15:48:25 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @mariuslozo-boop on GitHub (Oct 31, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5274

Originally assigned to: @mariuslozo-boop on GitHub.

🤖 Filed by mariuslozo-boop's AI agent (Claude Code, Claude Opus 5.5), not by mariuslozo-boop personally.

python tools/lan_e2e.py --bin-dir target/fast --check <name> can't run on Windows (checked on Windows 11 with Python 3.12 and today's main). There are three separate blockers:

  1. The resources link needs symlink privilege. lan_e2e.Game.__init__ (and agent_control_e2e.scratch) link the prepared resources into the scratch home with os.symlink. Without Developer Mode or an administrator shell this fails with OSError: [WinError 1314] A required privilege is not held by the client. A directory junction needs no privilege and would do the same job.
  2. agent_control_e2e.game_env runs vscreen. It only skips the virtual screen on macOS, or on a machine without vscreen that has DISPLAY set. On Windows neither applies, so subprocess.run(['vscreen', 'up']) raises FileNotFoundError: [WinError 2]. Windows has no virtual screen, so like macOS it should use plain lab.game_env.
  3. horizon-ctl launch never returns when its output is captured. The harnesses run it with subprocess.run(..., capture_output=True). On Windows CreateProcessW (with bInheritHandles, as Rust's Command uses it) hands the child every inheritable handle of the parent, not only the three stdio handles it is given. horizon-ctl's own stdin/stdout/stderr are the caller's pipes, and they are inheritable, so the game keeps the write end of the caller's stdout pipe open for its whole life. run() then waits for EOF until the game quits. When the timeout fires, Python kills horizon-ctl and keeps waiting on the pipe, and an interrupted run leaves the game running. Measured: the game answers state while launch (timeout 150 s) still hasn't returned, and launch only returns once the game is quit. On Linux and macOS the child's fds 0-2 are replaced and the rest are close-on-exec, so this doesn't happen there. The same leak reaches a game started through horizon-ctl mcp (an MCP client's pipes).

Proposed fix (tooling only): a small lab.link_dir helper that falls back to a junction on Windows when the symlink is refused, used by both harnesses; Windows treated like macOS in game_env; and horizon-ctl clearing the inherit flag on its own standard handles before it spawns the game on Windows (Linux and macOS unchanged).

Originally created by @mariuslozo-boop on GitHub (Oct 31, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5274 Originally assigned to: @mariuslozo-boop on GitHub. > 🤖 Filed by mariuslozo-boop's AI agent (Claude Code, Claude Opus 5.5), not by mariuslozo-boop personally. `python tools/lan_e2e.py --bin-dir target/fast --check <name>` can't run on Windows (checked on Windows 11 with Python 3.12 and today's main). There are three separate blockers: 1. **The resources link needs symlink privilege.** `lan_e2e.Game.__init__` (and `agent_control_e2e.scratch`) link the prepared resources into the scratch home with `os.symlink`. Without Developer Mode or an administrator shell this fails with `OSError: [WinError 1314] A required privilege is not held by the client`. A directory junction needs no privilege and would do the same job. 2. **`agent_control_e2e.game_env` runs `vscreen`.** It only skips the virtual screen on macOS, or on a machine without `vscreen` that has `DISPLAY` set. On Windows neither applies, so `subprocess.run(['vscreen', 'up'])` raises `FileNotFoundError: [WinError 2]`. Windows has no virtual screen, so like macOS it should use plain `lab.game_env`. 3. **`horizon-ctl launch` never returns when its output is captured.** The harnesses run it with `subprocess.run(..., capture_output=True)`. On Windows `CreateProcessW` (with `bInheritHandles`, as Rust's `Command` uses it) hands the child every inheritable handle of the parent, not only the three stdio handles it is given. horizon-ctl's own stdin/stdout/stderr are the caller's pipes, and they are inheritable, so the game keeps the write end of the caller's stdout pipe open for its whole life. `run()` then waits for EOF until the game quits. When the timeout fires, Python kills horizon-ctl and keeps waiting on the pipe, and an interrupted run leaves the game running. Measured: the game answers `state` while `launch` (timeout 150 s) still hasn't returned, and `launch` only returns once the game is quit. On Linux and macOS the child's fds 0-2 are replaced and the rest are close-on-exec, so this doesn't happen there. The same leak reaches a game started through `horizon-ctl mcp` (an MCP client's pipes). Proposed fix (tooling only): a small `lab.link_dir` helper that falls back to a junction on Windows when the symlink is refused, used by both harnesses; Windows treated like macOS in `game_env`; and horizon-ctl clearing the inherit flag on its own standard handles before it spawns the game on Windows (Linux and macOS unchanged).
Author
Owner

@mariuslozo-boop commented on GitHub (Oct 31, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6546362517 --> @mariuslozo-boop commented on GitHub (Oct 31, 2026): 🤖 Agent: /claim
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#1620
No description provided.