From 05e169f4e3cb32aa655b24eb5f1c9ea298af4ebd Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 21 Oct 2026 20:20:31 +0200 Subject: [PATCH] agent_control_e2e pick: wait for the server to clear the cursor Step 2 clones a stack in the creative tab and closes the screen. The clone lived only on the client: ItemPickerMenu's carried stack is the inventoryMenu's, and AbstractContainerMenu.removed clears the carried stack only for a ServerPlayer, so vanilla's client still holds it when the survival inventory opens. With a stack in hand the middle button's release sends CLONE (AbstractContainerScreen.mouseReleased); the server finds the carried stack it was told about wrong and sends the empty one (broadcastChanges). On single player's server thread that answer takes a round trip, as in vanilla, so step 3 now waits up to 20 ticks for it. The in-frame world puts the clone away when the menu closes. Co-Authored-By: Claude Opus 5.5 --- tools/agent_control_e2e.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/agent_control_e2e.py b/tools/agent_control_e2e.py index a01c25ef9..6464425fa 100644 --- a/tools/agent_control_e2e.py +++ b/tools/agent_control_e2e.py @@ -500,6 +500,15 @@ def pick_scenario(d, out): d('give', item='oak_log', count=2) assert d('open_inventory')['screen'] == 'inventory' d('click', id='slot-0', middle=True) + # The clone of step 2 lived only on this client: ItemPickerMenu's carried stack is the + # inventoryMenu's, and AbstractContainerMenu.removed clears it only for a ServerPlayer. With a + # stack in hand, mouseReleased sends CLONE, the server finds the carried stack it was told about + # wrong and sends the empty one back (broadcastChanges). On the server thread that takes a + # round trip, as in vanilla; in the frame, closing the menu already put the clone away. + for _ in range(20): + if carried() is None: + break + d('wait', ticks=1) assert carried() is None, carried() assert widgets(d)['slot-0']['stack'] == {'item': 'minecraft:oak_log', 'count': 2} d('close')