Conversation
…on login initalization
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe changes refactor login state tracking across MicrobotPlugin and LoginManager to use game state comparison instead of a boolean flag. MicrobotPlugin now checks if the last known game state equals Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 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: 0
🧹 Nitpick comments (1)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/security/LoginManager.java (1)
44-45: Inconsistent accessor pattern between atomic reference fields.
LAST_KNOWN_GAME_STATEuses explicit getter/setter methods that unwrap theGameStatevalue (lines 54-60), butlastLoginTimestampuses Lombok's@Getterwhich exposes the rawAtomicReference<Instant>. This creates an inconsistent API:
getLastKnownGameState()→ returnsGameStategetLastLoginTimestamp()→ returnsAtomicReference<Instant>Consider either removing the
@Getterand adding explicit accessors that returnInstant, or documenting that the raw reference is intentionally exposed.- @Getter - private static AtomicReference<Instant> lastLoginTimestamp = new AtomicReference<>(null); + private static final AtomicReference<Instant> lastLoginTimestamp = new AtomicReference<>(null); + + public static Instant getLastLoginTimestamp() { + return lastLoginTimestamp.get(); + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/MicrobotPlugin.java(2 hunks)runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/security/LoginManager.java(3 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/**/*.java
📄 CodeRabbit inference engine (AGENTS.md)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/**/*.java: Gameplay automation lives inrunelite-client/src/main/java/net/runelite/client/plugins/microbot; keep new scripts and utilities inside this plugin
Register new automation undernet.runelite.client.plugins.microbotand reuse the scheduler pattern shown inExampleScript
Files:
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/security/LoginManager.javarunelite-client/src/main/java/net/runelite/client/plugins/microbot/MicrobotPlugin.java
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/**/*.java
📄 CodeRabbit inference engine (AGENTS.md)
Shared helpers sit under
.../microbot/util
Files:
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/security/LoginManager.java
**/*.java
📄 CodeRabbit inference engine (AGENTS.md)
**/*.java: Keep indentation with tabs, follow the brace placement already inMicrobotPlugin.java, and prefer lines under 120 characters
UseUpperCamelCasefor types,lowerCamelCasefor members, and prefix configuration interfaces with the plugin name (e.g.,ExampleConfig)
Rely on Lombok for boilerplate where already adopted
Files:
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/security/LoginManager.javarunelite-client/src/main/java/net/runelite/client/plugins/microbot/MicrobotPlugin.java
runelite-client/src/main/java/net/runelite/client/plugins/microbot/*Plugin.java
📄 CodeRabbit inference engine (AGENTS.md)
When adding panel controls or overlays, update the Microbot navigation panel setup in
MicrobotPluginand provide default config values
Files:
runelite-client/src/main/java/net/runelite/client/plugins/microbot/MicrobotPlugin.java
🧠 Learnings (5)
📚 Learning: 2025-11-24T19:05:32.967Z
Learnt from: CR
Repo: chsami/Microbot PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T19:05:32.967Z
Learning: Applies to runelite-client/src/main/java/net/runelite/client/plugins/microbot/**/*.java : Gameplay automation lives in `runelite-client/src/main/java/net/runelite/client/plugins/microbot`; keep new scripts and utilities inside this plugin
Applied to files:
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/security/LoginManager.javarunelite-client/src/main/java/net/runelite/client/plugins/microbot/MicrobotPlugin.java
📚 Learning: 2025-11-24T19:05:32.967Z
Learnt from: CR
Repo: chsami/Microbot PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T19:05:32.967Z
Learning: Applies to runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/**/*.java : Shared helpers sit under `.../microbot/util`
Applied to files:
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/security/LoginManager.javarunelite-client/src/main/java/net/runelite/client/plugins/microbot/MicrobotPlugin.java
📚 Learning: 2025-11-24T19:05:32.967Z
Learnt from: CR
Repo: chsami/Microbot PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T19:05:32.967Z
Learning: Applies to runelite-client/src/main/java/net/runelite/client/plugins/microbot/*Plugin.java : When adding panel controls or overlays, update the Microbot navigation panel setup in `MicrobotPlugin` and provide default config values
Applied to files:
runelite-client/src/main/java/net/runelite/client/plugins/microbot/MicrobotPlugin.java
📚 Learning: 2025-11-24T19:05:32.967Z
Learnt from: CR
Repo: chsami/Microbot PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T19:05:32.967Z
Learning: Applies to runelite-client/src/main/java/net/runelite/client/plugins/microbot/example/**/*.java : Runnable examples live in `.../microbot/example`
Applied to files:
runelite-client/src/main/java/net/runelite/client/plugins/microbot/MicrobotPlugin.java
📚 Learning: 2025-11-24T19:05:32.967Z
Learnt from: CR
Repo: chsami/Microbot PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T19:05:32.967Z
Learning: Applies to runelite-client/src/main/java/net/runelite/client/plugins/microbot/**/*.java : Register new automation under `net.runelite.client.plugins.microbot` and reuse the scheduler pattern shown in `ExampleScript`
Applied to files:
runelite-client/src/main/java/net/runelite/client/plugins/microbot/MicrobotPlugin.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Build
🔇 Additional comments (1)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/MicrobotPlugin.java (1)
306-331: Login state tracking logic looks correct.The flow properly checks
wasLoggedInagainst the previous state before running the initialization code, then updatessetLastKnownGameStateat the end of the handler. This ensuresRs2RunePouch.fullUpdate()andRs2CacheManager.registerEventHandlers()execute only on a fresh login transition, which addresses the original bug.
… instead of using lombok to generate it.
I think this was vibed a little too hard...
Issue
the wasLoggedIn variable inside of onGameStateChanged was changed to leverage this new class called
LoginManager.java, when this happened, this was specifically targeting if the current GameState is LOGGED_IN, which we know is already true as if we look at MicrobotPlugin.java#L301, we have an if statement thatif (gameStateChanged.getGameState() == GameState.LOGGED_IN).. Due to this, this caused Rs2RunePouch.fullUpdate(); & Rs2CacheManager.registerEventHandlers(); to be unreachable.Fix
I have created a new member variable inside of the LoginManager to store the previously "known" game state by saving it at the end of the onGameStateChanged event. this way we can compare against it inside of the primary logic above. This will allow this previously unreachable logic to function & fixes the initial load of the Runepouch data.