From e11471cda092a0c26e90ac486fa22f35287aa49e Mon Sep 17 00:00:00 2001 From: "minimax-m3.1-flash" Date: Tue, 27 Oct 2026 04:38:22 +0500 Subject: [PATCH] Run the LAN harness headless HORIZON_E2E_HEADLESS launches the games with --offscreen --no-pause, so the suite runs on a machine with no focused window: without it the games pause on the focus loss and wait_ready never completes. macOS keeps its offscreen launch. Co-Authored-By: minimax-m3.1-flash (Claude Code) --- tools/lan_e2e.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/lan_e2e.py b/tools/lan_e2e.py index 012e8f021..80de9e955 100755 --- a/tools/lan_e2e.py +++ b/tools/lan_e2e.py @@ -4743,9 +4743,18 @@ def run(ctl, out, resources, checks): host, guest = Game('host', ctl, resources), Game('guest', ctl, resources) # Either way explicitly: the game's default is the server thread. host.d.env['HORIZON_SERVER_THREAD'] = '1' if SERVER_THREAD else '0' + # The games render offscreen on macOS (a locked session gets no redraws) and, in a + # headless run (HORIZON_E2E_HEADLESS), on any machine with no focused window: they + # never pause on the focus loss there either, or the world would stand still. + headless = bool(os.environ.get('HORIZON_E2E_HEADLESS')) + launch = ['launch'] + if sys.platform == 'darwin' or headless: + launch.append('--offscreen') + if headless: + launch.append('--no-pause') results = {} try: - host.pid = host('launch', wait=False, offscreen=sys.platform == 'darwin')['pid'] + host.pid = host.raw(*launch)['pid'] # Guests' commands need the world's Allow Commands as well as the LAN's (#372): a creative # world has them; everyone plays in survival. host.raw('open', 'Lan', 5, 'creative') @@ -4759,7 +4768,7 @@ def run(ctl, out, resources, checks): host('command', command='gamerule spawn_mobs false') port = host.raw('lan', 'open', 0, 'commands')['port'] host.player = host.raw('lan', 'status').get('host', 'Player') # the host's profile name - guest.pid = guest('launch', wait=False, offscreen=sys.platform == 'darwin')['pid'] + guest.pid = guest.raw(*launch)['pid'] guest.raw('connect', f'127.0.0.1:{port}', GUEST_NAME) guest.raw('wait-for', 'loaded', '--timeout', 300) guest.wait(40)