Skip to content

fix: restore reliable ground item interaction dispatch#1821

Open
JogOnJohn wants to merge 3 commits into
chsami:developmentfrom
JogOnJohn:fix/ground-item-interaction-dispatch
Open

fix: restore reliable ground item interaction dispatch#1821
JogOnJohn wants to merge 3 commits into
chsami:developmentfrom
JogOnJohn:fix/ground-item-interaction-dispatch

Conversation

@JogOnJohn

@JogOnJohn JogOnJohn commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Restore reliable ground-item interaction dispatch in both Rs2GroundItem and Rs2TileItemModel.

The change keeps the existing reflected action discovery and third-slot Take fallback, but sends the resolved ground-item entry through Microbot.doInvoke(NewMenuEntry, bounds) instead of dispatching it directly through Rs2Reflection.invokeMenu.

A focused regression test now verifies that both ground-item APIs use the synthetic target-menu path and do not call the reflected menu dispatcher directly. The entity guide also records this interaction requirement for future client updates.

Root cause

Ground-item looting originally used Microbot.doInvoke, which sets the intended entry as Microbot.targetMenu before performing the canvas click. This allows the generated scene menu to be replaced with the exact ground-item action even when another scene entity overlaps the click location.

That dispatch was replaced with a direct Rs2Reflection.invokeMenu call while ground-item action reflection was being repaired. A later fallback restored reliable discovery of Take, but retained the direct reflected dispatch path. This left action resolution fixed while bypassing Microbot's target-menu click pipeline. In live testing, that path produced Unable to find clicked menu op Take messages and ground-item interactions remained unreliable when doors, gates, or NPCs overlapped the tile. Restoring Microbot.doInvoke reinstates the synthetic ground-item menu entry before the click while preserving the hardened action discovery, Take fallback, camera handling, and world-view information.

This change separates the two responsibilities:

  • Rs2Reflection.getGroundItemActions continues to resolve actions and retain the third-slot Take fallback.
  • Microbot.doInvoke performs the resolved interaction through the synthetic target menu.

Testing

  • Re-ran 13 focused unit tests covering reflected ground actions, menu-action resolution, the Take fallback, and dispatch selection.
  • Client compilation passed as part of the focused test task.
  • Built a release jar successfully.
  • Performed approximately 30 minutes of in-game loot testing:
    • continuous looting with Autofighter;
    • manually placed loot behind doors and gates;
    • manually placed loot beneath NPCs;
    • repeated the obstruction cases from different camera angles;
    • confirmed the intended ground items were taken and no orange Unable to find clicked menu op Take messages appeared.

Verification requested

Please test this in game before merging rather than relying only on the code review and automated tests. Ground-item dispatch depends on live scene-menu behavior, so the important acceptance cases are loot behind doors or gates and loot beneath NPCs from multiple camera angles.

An optional prerelease test jar and the suggested smoke-test steps are available here:

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: fd9b9515-2034-4293-87f0-0caa14fb70a9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

Ground-item interactions in Rs2GroundItem and Rs2TileItemModel now dispatch through Microbot.doInvoke with NewMenuEntry, bounds, and world-view parameters instead of Rs2Reflection.invokeMenu. A bytecode-based test verifies this routing, and the thread-safety baseline updates regenerated lambda mappings. The item guide documents the required action-discovery and dispatch flow.

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: restoring reliable ground-item interaction dispatch.
Description check ✅ Passed The description is directly related and accurately explains the ground-item dispatch changes and verification.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

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.

@JogOnJohn
JogOnJohn marked this pull request as ready for review July 18, 2026 00:33

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@runelite-client/src/test/java/net/runelite/client/plugins/microbot/util/grounditem/GroundItemInteractionDispatchTest.java`:
- Around line 32-38: Update assertSyntheticTargetMenuDispatch and its
readDispatchCalls bytecode inspection to analyze only the expected interaction
method, filtering visitMethod by the relevant method name and descriptor before
counting doInvoke and invokeMenu calls. Apply the same method scoping to both
interaction overloads so unrelated class methods cannot satisfy or mask the
assertions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 08c6569c-1337-4c1e-b6c7-d8066171543b

📥 Commits

Reviewing files that changed from the base of the PR and between 6dd4651 and a77cf7e.

📒 Files selected for processing (5)
  • docs/entity-guides/items.md
  • runelite-client/src/main/java/net/runelite/client/plugins/microbot/api/tileitem/models/Rs2TileItemModel.java
  • runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/grounditem/Rs2GroundItem.java
  • runelite-client/src/test/java/net/runelite/client/plugins/microbot/util/grounditem/GroundItemInteractionDispatchTest.java
  • runelite-client/src/test/resources/threadsafety/client-thread-guardrail-baseline.txt

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