Skip to content

rejected input future keeps executed listeners and runs them every idle tick #335

Description

@tr330ne

Description

INPUTS.submit hands back the shared static InputRequestFuture.rejected right away when a request with equal or higher priority is already pending, and addInputExecutedListener on it just appends to that shared list, Bot.postTick calls notifyListeners() on the current input future every tick and then resets it to rejected, so on every tick where the current future is rejected (no input request ran, or a container is open), every listener that was ever added to a rejected future runs again, nothing ever clears the list

AutoEat.startEating sets isEating = true; delay = 50 through that listener, if its right click gets rejected right away because something with equal or higher priority (11000 by default for AutoEat) is already pending in that tick, like antiafk swing, click/rotate from the terminal or a plugin, the listener sticks, from then on those ticks flip AutoEat into eating and it sends noInput + noAction for 50 ticks without checking hunger, then the next such tick starts it again. If the click is accepted first and only replaced later it gets its own future and nothing sticks. reset() on bot ticks stopping and starting clears AutoEats fields but not the listener, so the next such tick sets them again

on a live bot I saw behavior consistent with this, food at 20 the whole time while it held golden carrots (not canAlwaysEat, so hasFood was false), no use item at all, AutoEat holding the inventory manager on every action tick whenever pathing had stopped, 274 of these between 07:03:50 and 07:11:45:

[2026/09/24 07:03:50.298] [Client] [DEBUG] Starting Bot Ticks
[2026/09/24 07:03:50.317] [Client] [DEBUG] [Inventory Manager] [655385] Executing no action, requester: AutoEat
[2026/09/24 07:03:50.618] [Client] [DEBUG] [Inventory Manager] [655391] Executing no action, requester: AutoEat
[2026/09/24 07:03:50.919] [Client] [DEBUG] [Inventory Manager] [655397] Executing no action, requester: AutoEat
[2026/09/24 07:11:45.885] [Cache] [DEBUG] Player food: 19

it kept going through bot ticks stopping and starting that morning (me connecting to the proxy and leaving) and was gone after a restart. I havent captured the initial rejected startEating or reproduced the listener attachment on a test server

fix could be addInputExecutedListener skipping futures that are already completed as rejected, or a fresh rejected future per call instead of the shared one, fixing it there instead of in AutoEat would also cover the other places that do submit(...).addInputExecutedListener(...) (AutoFish, AutoOmen, KillAura, InteractWithProcess, ClickCommand) and plugins that copied the pattern

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions