Repository navigation
fix(wm): reconcile monitor state across RDP transitions - #1761
Open
MattKotsenas wants to merge 6 commits into
Open
MattKotsenas wants to merge 6 commits into
MattKotsenas wants to merge 6 commits into
Conversation
Require present serial ids when matching attached monitors. Let the manager repair surviving monitor focus, user indices, workspace rules and known HWNDs after removal.
Compare monitor identities as well as counts. Apply the verified enumeration snapshot once and repair references after preference-based insertion.
Use ordinary tests with scoped fixtures for shared configuration and temporary storage. Replace the leaked-listener test with bounded handler processing; keep production listener supervision unchanged.
Finish cached restoration, layout, bookkeeping and subscriber notification before best-effort explicit activation. Preserve normal focus error propagation and report foreground refusal without stale last-error diagnostics.
Empty serials and shared UNKNOWN device IDs could overwrite or restore another display's cached workspaces. Match session entries using upstream display identity, preferring an exact nonempty serial over a competing port match. Keep configured device and serial cache bindings distinct, including configuration for displays not yet connected. Consume the selected entry only after its restoration and layout succeed, and recognize newly attached UNKNOWN displays independently. Preserve UNKNOWN display names when insertion remaps focus, workspace rules and known-window locations. Reuse upstream disconnection detection and update rebased test fixtures. Cover cache isolation, one-time consumption, serial/port conflicts and configured bindings through bounded handler tests. Verify the regressions reject raw-device-ID mutations; retain upstream live-topology matching policy.
Restore monitor focus through the same old-to-new index map used by workspace rules, avoiding a separate identity snapshot and lookup. Explain why session cache matching needs explicit configured bindings and cannot use Hash/Eq keys. Consolidate same-count topology checks into the handler regression and remove the overlapping handler smoke test. Keep cache-identity matrices, serial-priority regressions and isolation guarantees. Verify the consolidated regression rejects count-only matching.
MattKotsenas
force-pushed
the
fix/stale-rdp-monitors
branch
from
November 19, 2026 01:01
f98ddf9 to
1033c2a
Compare
This branch has not been deployed
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.
Summary
With this change, Komorebi reconciles display replacements across RDP transitions even when the monitor count stays unchanged. Previously, equal counts could leave windows associated with a detached monitor: retile operated on that stale state, while reacquisition skipped windows already considered managed.
Changes
UNKNOWNdevice ID. Prefer an exact nonempty serial when multiple cached displays could match, preserve explicit device/serial cache bindings, and consume only the entry restored.Validation
UNKNOWNdisplays, serial/device changes, competing serial and port matches, configured bindings, and configuration cached before a display connects.test_cached_unknown_displays_restore_independentlyfails when either cache insertion or new-monitor detection uses raw device IDs. The test passed again after each mutation was reverted.