Skip to content

fix(world-hop): call hopToWorld once per attempt in Rs2WorldUtil.hopWorld - #1946

Merged
chsami merged 2 commits into
developmentfrom
claude/worldutil-single-hop
Oct 13, 2026
Merged

chsami merged 2 commits into
developmentfrom
claude/worldutil-single-hop

Conversation

@chsami

@chsami chsami commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Problem

Rs2WorldUtil.hopWorld called Microbot.hopToWorld as the condition of sleepUntil(..., 6000). A hop that failed fast was refused again on every poll for six seconds, about 140 calls per attempt in the unit test, each logging an error. Reasons for failing fast include combat, dialogue, an invalid world, or cantHopWorld. The 6s bound also meant nothing once hopToWorld blocks: it waits up to 15s to land, and longer for the hop limit from #1942.

Change

Call Microbot.hopToWorld(world) once per attempt. The isHopping and world checks that follow already handle a failed hop and drive the backoff retries.

The old polling also happened to retry a hop refused only because the game was briefly LOADING, for example after a region load. To keep that, hopWorld now waits up to 6s for the player to be logged in before the single call. It also drops a stray empty statement.

Removing the lambda renumbers the remaining one in hopWorld, so its existing client-thread guardrail baseline entry moves from lambda$hopWorld$8 to lambda$hopWorld$7. It is the same violation, not a new one.

Nothing in the client or Microbot-Hub calls hopWorld or hopToNextBestWorld today. This came up as a leftover from the #1945 review.

Testing

  • :client:runUnitTests: 2,316 passed, 0 failed. New Rs2WorldUtilHopWorldTest:
    • with hopToWorld failing, two attempts call it exactly twice. On the old code the same test sees 141 calls;
    • a player still loading when the attempt starts is hopped once, after login. This test fails without the login wait.
  • Live: a runtime-deployed probe called Rs2WorldUtil.hopWorld from world 301. It hopped on the first attempt and the hop limit counted it once (389 → 388). This was run twice: before the login wait (to 571, 9.6s) and after it (to 335, 8.3s).

🤖 Generated with Claude Code

https://claude.ai/code/session_01LjtEMzQHGuq4M1Mpqk9pPV

…orld

hopWorld wrapped Microbot.hopToWorld in sleepUntil(..., 6000), so a hop
that failed fast (combat, dialogue, an invalid world) was retried on
every poll for six seconds, logging an error each time. The isHopping
and world checks that follow already handle a failed hop and drive the
backoff retries, so call it once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LjtEMzQHGuq4M1Mpqk9pPV
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: debeef44-2d71-46bf-805e-47c07c20d08c
📥 Commits

Reviewing files that changed from the base of the PR and between 49cc3da and 58bd4c0.

📒 Files selected for processing (3)
  • runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/world/Rs2WorldUtil.java
  • runelite-client/src/test/java/net/runelite/client/plugins/microbot/util/world/Rs2WorldUtilHopWorldTest.java
  • runelite-client/src/test/resources/threadsafety/client-thread-guardrail-baseline.txt

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

Walkthrough

hopWorld now calls Microbot.hopToWorld(world) once per attempt instead of repeating the call during a wait. The existing retry and validation logic remains. A new test checks that two failed attempts produce two hop calls. The thread-safety guardrail baseline records the updated lambda name.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 58bd4

The change is mergeable after normal checks; no outstanding issue is identified.

Pre-merge checks · Passed 4 · Failed 1

Failed Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely describes the main change: calling hopToWorld once per attempt in Rs2WorldUtil.hopWorld.
Description check Passed The description is directly related to the changeset. It explains the repeated-call problem, the implementation change, the baseline update, and the tests.
Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Calling hopToWorld once lost the old polling's retry when the hop was
refused only because the game was briefly LOADING. Wait up to six
seconds for the player to be logged in before the attempt, and drop a
stray empty statement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LjtEMzQHGuq4M1Mpqk9pPV
@chsami
chsami merged commit 25b1e94 into development Oct 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant