Repository navigation
fix(ui): keep the saved sidebar tab and stdout intact while closing - #1954
Merged
Merged
Conversation
When the client closes, MicrobotPluginManager stops the Hub plugins and each removeNavigation runs from invokeLater after ConfigManager's final sendConfig. Removing the open tab then stored the fallback tab, so the in-memory value flipped and any later flush in the exit window persisted the wrong tab. ClientUI now marks itself closing on ClientShutdown and removeNavigation no longer stores the tab while closing. bindStdoutAppenders handed the real System.out to logback, and OutputStreamAppender.stop closes its stream, so a stopped or reset LoggerContext closed fd 1. The stream is now wrapped in a close shield. ClientUITest covers both tab paths and that console initialization binds the stdout appenders; ConsoleLogAppenderTest covers the close shield. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LjtEMzQHGuq4M1Mpqk9pPV
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 11 minutes. View limit details
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 |
This was referenced Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-ups from the review of #1951.
Problem
ClientUI.removeNavigationstores the fallback tab after it reopens one. On client close,MicrobotPluginManager.onClientShutdownstops the Hub plugins; theirClientToolbar.removeNavigationruns throughinvokeLater, afterConfigManager's finalsendConfig(priority -100). The in-memoryclientSidebarTabthen flips to the fallback tab (or is unset), and asendConfigduring the exit window (the 5-minute periodic flush, or anything else that saves config) persists the wrong tab.ConsoleLogAppender.bindStdoutAppendershanded the realSystem.outPrintStreamto logback.OutputStreamAppender.stop()andsetOutputStream()close the current stream, so a stopped or resetLoggerContext(logbackscan=truereconfiguration in dev) closed fd 1 and all later terminal output was lost.Change
ClientUI: aclosingflag is set by aClientShutdownsubscriber (priority 100, so before any plugin stops).removeNavigationstill reopens the fallback tab but does not store it while closing. Removals while the client runs (user disables a plugin) still store the tab that is shown, as in fix(console): show each log line once and stop following on user input #1951. Diff to the upstream file: 11 lines added, 1 removed.ConsoleLogAppender.bindStdoutAppenderswraps the stream in a privateCloseShieldOutputStream(close()only flushes; bulk writes are passed through).Testing
ClientUITest(buildsClientUIthrough its private constructor with a mockedConfigManager, a realEventBusand a plainJTabbedPanein place of the UI built byinit()):removingTheOpenTabWhileClosingKeepsTheSavedTab: fails ondevelopment(NeverWantedButInvoked: setConfiguration("runelite", "clientSidebarTab", ...)), passes with the fix.removingTheOpenTabStoresTheTabShownInstead: guards the fix(console): show each log line once and stop following on user input #1951 behaviour while the client runs; passes before and after.consoleInitializationKeepsStdoutLogLinesOutOfThePanel: calls the realinitializeConsoleLoggingand checks a root log line lands in the console panel once. With thebindStdoutAppenderscall removed it fails withexpected:<1> but was:<3>.ConsoleLogAppenderTest.stoppingTheLoggerContextLeavesStdoutOpen: fails ondevelopment(stream closed bycontext.stop()), passes with the fix../gradlew :client:runUnitTests --offline: 2364 tests, 0 failures, 0 errors, 2 skipped (335 classes), includingClientThreadGuardrailTestwith no baseline change.isExternal = trueadded a sidebar panel and opened it (saved tab = the probe tab). The client was closed through the window close button path (WM close + the Exit confirmation), and the probe'sshutDowncalledConfigManager.sendConfig()after its removal to simulate a flush in the exit window.null, and after a restart the persisted value wasnull.Not verified: an installed Hub plugin restoring its own tab on restart (none of the locally installed Hub plugins adds a sidebar panel, and a deployed probe registers too late for the startup-only restore). The close-shield was not exercised live with a real logback rescan; it is covered by the unit test only. Profile switches that stop plugins still store the fallback tab, as before this PR.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LjtEMzQHGuq4M1Mpqk9pPV