fix: restore reliable ground item interaction dispatch#1821
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughGround-item interactions in Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (5)
docs/entity-guides/items.mdrunelite-client/src/main/java/net/runelite/client/plugins/microbot/api/tileitem/models/Rs2TileItemModel.javarunelite-client/src/main/java/net/runelite/client/plugins/microbot/util/grounditem/Rs2GroundItem.javarunelite-client/src/test/java/net/runelite/client/plugins/microbot/util/grounditem/GroundItemInteractionDispatchTest.javarunelite-client/src/test/resources/threadsafety/client-thread-guardrail-baseline.txt
Summary
Restore reliable ground-item interaction dispatch in both
Rs2GroundItemandRs2TileItemModel.The change keeps the existing reflected action discovery and third-slot
Takefallback, but sends the resolved ground-item entry throughMicrobot.doInvoke(NewMenuEntry, bounds)instead of dispatching it directly throughRs2Reflection.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 asMicrobot.targetMenubefore 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.invokeMenucall while ground-item action reflection was being repaired. A later fallback restored reliable discovery ofTake, 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 producedUnable to find clicked menu op Takemessages and ground-item interactions remained unreliable when doors, gates, or NPCs overlapped the tile. RestoringMicrobot.doInvokereinstates the synthetic ground-item menu entry before the click while preserving the hardened action discovery,Takefallback, camera handling, and world-view information.This change separates the two responsibilities:
Rs2Reflection.getGroundItemActionscontinues to resolve actions and retain the third-slotTakefallback.Microbot.doInvokeperforms the resolved interaction through the synthetic target menu.Testing
Takefallback, and dispatch selection.Unable to find clicked menu op Takemessages 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: