From 5f0e92422143bddc89f2467e9a187c039ce8712a Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 21 Oct 2026 20:46:21 +0200 Subject: [PATCH 1/2] agent_control_e2e: wait for the world, and start below a tree's crown - survival and ui asserted that the Create New World click itself answered `playing`. Since 7f4193f8 the in-frame world is prepared off the UI thread behind the title screen, so the click answers `title` and both scenarios failed in the frame (main's default) every time. They now wait for `loaded`, as the other scenarios do. - The survival spawn is random within the spawn radius, on the first full top face below the MOTION_BLOCKING height (PlayerSpawnFinder.getLevelRespawnPos), so a tree's leaves too: from there no tree was reachable within goto's three-block drops. The scenario now drops the player to the ground under the leaves first. Co-Authored-By: Claude Opus 5.5 --- tools/agent_control_e2e.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tools/agent_control_e2e.py b/tools/agent_control_e2e.py index e51969654..c76a4f63f 100644 --- a/tools/agent_control_e2e.py +++ b/tools/agent_control_e2e.py @@ -187,12 +187,24 @@ def scenario(d, out): d('click_button', label='Create New World') d('type', field='name', replace=True, text='Agent World') d('type', field='seed', text='5') # spawn near a walkable oak - created = d('click_button', label='Create New World') - assert created['screen'] == 'playing', created + d('click_button', label='Create New World') + # The world opens a few frames later: in the frame it is prepared off the UI thread behind the + # title screen (world_loading.rs), on the server thread once the server has it. + d('wait_for', condition='loaded', timeout=400) d('wait_ready', seconds=400) state = d('state') assert state['gamemode'] == 'survival' and state['player']['health'] > 0, state d('command', command='time set day') + # The spawn is random within the spawn radius, on the first full top face below the + # MOTION_BLOCKING height (PlayerSpawnFinder.getLevelRespawnPos): a tree's leaves too, too high + # for goto's drops. + x, y, z = state['player']['block_pos'] + ground = y - 1 + while ground > y - 16 and d('block', x=x, y=ground, z=z)['block'].endswith(('_leaves', 'air')): + ground -= 1 + if ground < y - 1: + d('command', command=f'tp @s {x + 0.5} {ground + 1} {z + 0.5}') + d('wait', ticks=5) # 2. Walk to a tree: the nearest trunk the path finder can reach. for _, base, log_id in trunk_bases(d)[:8]: @@ -276,8 +288,8 @@ def ui_scenario(d, out): tree = widgets(d) assert tree['game']['kind'] == 'button' and any(w['kind'] == 'field' for w in tree.values()), tree d('type', field='name', replace=True, text='UI World') - created = d('click', id='create-new-world') - assert created['screen'] == 'playing', created + d('click', id='create-new-world') + d('wait_for', condition='loaded', timeout=400) # a few frames later, as in the survival scenario d('wait_ready', seconds=400) # 2. Options from the pause menu: a slider set by id moves its value and label. From 1bd1d57fb3949dde2759f2697a75fa48b60aaf8a Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 21 Oct 2026 20:55:20 +0200 Subject: [PATCH 2/2] agent_control_e2e survival: a tree whose log is hidden is skipped Low leaves can hide every face of the trunk's bottom log from where the walk stops ("no face of block ... is visible from here"). The scenario now breaks inside the tree loop and moves on to the next tree, as it already did for one it cannot reach. Co-Authored-By: Claude Opus 5.5 --- tools/agent_control_e2e.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tools/agent_control_e2e.py b/tools/agent_control_e2e.py index c76a4f63f..4edc7ae55 100644 --- a/tools/agent_control_e2e.py +++ b/tools/agent_control_e2e.py @@ -206,19 +206,25 @@ def scenario(d, out): d('command', command=f'tp @s {x + 0.5} {ground + 1} {z + 0.5}') d('wait', ticks=5) - # 2. Walk to a tree: the nearest trunk the path finder can reach. + # 2. Walk to a tree, the nearest trunk the path finder can reach, and 3. break the log at the + # bottom of the trunk (it must end up in the inventory). Low leaves can hide every face of that + # log from where the walk stops: then the next tree. for _, base, log_id in trunk_bases(d)[:8]: x, y, z = base try: d('goto', x=x + 0.5, y=y, z=z + 0.5, near=2.5, timeout=60) - break except Failed as e: print(f' cannot reach {log_id} at {base}: {e}') + continue + try: + broke = d('break', x=x, y=y, z=z) + break + except Failed as e: + if 'no face' not in str(e): + raise + print(f' {log_id} at {base} is hidden: {e}') else: raise Failed('no reachable tree near spawn') - - # 3. Break the log at the bottom of the trunk; it must end up in the inventory. - broke = d('break', x=x, y=y, z=z) assert broke['block_before'].startswith(log_id), broke assert broke['drops'].get(log_id, 0) >= 1, broke if broke['picked_up'].get(log_id, 0) < 1: