Repository navigation
fix(world-hop): wait for the world switcher to load before hopping - #1935
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LjtEMzQHGuq4M1Mpqk9pPV
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughThe world-hop flow now prepares the target world before issuing the hop. If the world switcher buttons are not loaded, it opens the hopper and waits up to 5,000 ms for them. The hop is issued on the client thread only when the buttons are available. The flow clears Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The hop now waits for the world switcher before proceeding. No actionable merge-blocking issue remains after normal checks. Pre-merge checks |
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LjtEMzQHGuq4M1Mpqk9pPV
Problem
Microbot.hopToWorldcalledclient.openWorldHopper()andclient.hopToWorld(world)inside the same client-thread callback. RuneLite only accepts the hop once the world switcher interface is loaded (the stock world hopper plugin waits a game tick forWorldswitcher.BUTTONSbefore hopping), so whenever the switcher was closed the first call silently did nothing and loggedFailed to hop to world Nat ERROR. Callers only got there by calling again.Found by the release E2E harness (#1933): the
world-hopcheck failed on the firstMicrobot.hopToWorldand succeeded on the retry.Fix
World.hopViaWorldSwitcher: ifWorldswitcher.BUTTONSis not loaded, it opens the switcher and waits for it withsleepUntil(5 s timeout, off the client thread). It re-sendsopenWorldHopperevery 600 ms while waiting, like the stock plugin does each tick. Once the switcher has loaded, it callsclient.hopToWorldin a separate client-thread call. If the switcher is already open, it hops straight away.falseinstead of attempting a hop that cannot work.quickHopTargetWorldis cleared in afinally, so a concurrent call is still rejected while the switcher is loading and the guard can no longer get stuck.sleep(600)before the existingsleepUntilfor the hop state.Callers (
Rs2Player.hopIfPlayerDetected,Rs2WorldUtil.hopWorld) keep their own retry loops. Those are generic, not workarounds for this bug, so I left them alone.Tests
MicrobotWorldHopTest, 3 cases:ClientThreadGuardrailTestpasses and the baseline is unchanged.Live verification
I merged the release E2E harness (#1933, c247cb4) into a local throwaway branch on top of this fix and ran
scripts/run-release-e2e.sh quick boot login world-hopagainst the shaded jar. Setup: F2P account, start world 383, isolated runtime home. The harness code is not in this PR.Microbot.hopToWorldcall. Each hop took about 6 to 7 s including the full hop.Failed to hopline or any otherERRORline.logoutcheck, which scans the whole run'sclient.log: it passed with 0 error lines.ERRORline. I added a throwaway probe for the welcome screen and logout tab state, ran 12 more times with it, and could not reproduce it. All 12 started with the welcome screen closed and the logout tab loaded.🤖 Generated with Claude Code
https://claude.ai/code/session_01LjtEMzQHGuq4M1Mpqk9pPV