Repository navigation
Complete a requested restore after its provider retires - #30
Merged
Merged
Conversation
An explicit restore whose provider retired before the client answered it was never placed or completed. The placement script's teardown asks for the master's restore and releases the tree; then KWin destroys the script, and with it the writer's provider. When the client's answer arrived the restoration was no longer current: configurePlacementPolicy gave ContentOnly, so the window took its floating size at the tile's position, and completeTransientRestoration refused, so the record stayed Restoring until the window closed. A new provider could neither settle it nor admit the window again (plasma-fusion#174). The provider decides whether a restore starts. Once its request has returned, the target is the record's own floating frame, the configure is the client's to answer, and the writer keeps the restoring reservation through the retirement. requestTransientRestore now marks the attempt (requestReturned) at its success exit, after its own last check, and a provider that is not current refuses only an attempt without that mark. A retirement while the request is being made, its last check included, still supersedes it; writer loss, a newer manual action, close, context changes and the attempt's own state check stop it as before. The writer null check moves in front: the provider check no longer covers it. Tests: - testRestoreCompletion: the provider retires after the request returned, with the controller gone (row 8), with a replacement provider registered (row 9), and for the configure-less shape whose next plain commit completes it (row 10). Each completes: A placed, the record and the reservation cleared. While in flight a settle answers NotReleased, not StaleProvider, and the floating frame is A. - testTransientConfigurePlacement: row 10 (provider-retired-before-commit) expected the old rule, the configure unplaced and the record kept; it now expects A placed and the record completed, as rows 5, 6, 7 and 11. After a retirement, a manual resize (row 27) or move (row 28), or a minimum size that no longer admits A with no request at all (row 29), still leaves the configure unplaced and the record kept. - testTransientTilingFacadeRestoreAfterProviderRetired: #174 through the scripting facade, as the script's teardown runs it (restoreWindow, releaseTile, the provider destroyed, a new one registered): before the client answers, the new provider's admission is busy; after, the window is on A, the record is gone, and the new provider tiles it again. Rows 8, 9 and 10 of testRestoreCompletion, row 10 of testTransientConfigurePlacement and the facade test fail without the change. The rows that retire the provider during the request (provider-first-callback, provider-final-callback) and the other provider-retirement rows pass unchanged. Mutations, each run against the whole testXdgShellWindow binary: the old rule, no provider check for restores at all, the mark never set and no writer null check each fail rows or crash. A check that, once marked, skips the rest of the rule fails row 29 (its settle answer). Two are equivalent: the mark set in the scope guard before the post-request check (nothing can call back in between), and the exception also granted during the dispatch (the post-request check still applies the strict rule, before the mark). Signed-off-by: Wisbendji Fimerlus <archledger236@gmail.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
What
An explicit restore whose provider retires before the client answers it is now placed and completed. Until now it never was: the window took its floating size at the tile's position, and its record stayed Restoring until the window closed. Found by plasma-fusion's NT08 session check (archledger/plasma-fusion#174, cause in its comment).
How it happened
The placement script's teardown (when it is disabled, reloaded or unloaded during a tiling session) asks for the master's restore (
restoreWindow=UntileOrRestoreOp) and releases the tree. Then KWin destroys the script, and with it the writer's provider: the writer clears the token onQObject::destroyedat once, andproviderRetiredfollows queued.transientRestoreAttemptIsCurrentrequiredtransientProviderIsCurrent, so when the client's answer arrived the restoration was no longer current.configurePlacementPolicygaveContentOnly: the floating size without the position.completeTransientRestorationrefused: the record stayed Restoring. A new provider's admission answered busy (3), andsettleWindowwants the admitting provider, so nothing ended it but closing the window.The change
requestTransientRestoremarks the attemptrequestReturnedat its success exit, after its own last check.transientRestoreAttemptIsCurrent: a provider that is not current now refuses only an attempt without that mark.Why this is safe:
providerRetirementKeepsReservation); itscompleteRestoreasks nothing of the provider.NotReleased.Tests
testRestoreCompletion: the provider retires after the request returned:Each completes: A placed, the record and the reservation cleared. While in flight, a settle answers
NotReleased(notStaleProvider) and the floating frame is A.testTransientConfigurePlacementrow 10 (provider-retired-before-commit) changes its expectation. It expected the old rule (the configure unplaced at the tile's position, the record kept), which is #174's symptom. It now expects A placed and the record completed, as rows 5, 6, 7 and 11 (row 11 deletes the tree before the commit). The row came with the configure-provenance work of 2026-11-05, before the completion boundary and the settle operation existed.New rows after a retirement, where the configure stays unplaced and the record kept:
testTransientTilingFacadeRestoreAfterProviderRetired: #174 end to end throughWorkspace.transientTiling(), as the script's teardown runs it (restoreWindow,releaseTile, the provider destroyed, a new one registered).NotReleasedand its admission is busy.Rows 8, 9 and 10 of
testRestoreCompletion, row 10 oftestTransientConfigurePlacementand the facade test fail without the change.Unchanged and passing:
testTransientRestoreRequestprovider-first-callbackandprovider-final-callback;testTransientRestoreClaimprovider-retired-during-releaseandprovider-retired-after-claim;testMaximizeRestoreNormalizationprovider-lost-callback;testNoRequestFinalizationValidityprovider-retired;testTransientOwnershipPreparationretired-provider;testTransientReceiptLifetimestale-after-provider-retiredandprovider-retired-before-apply;testTransientOwnershipBeforeRequestprovider-retired-before-call;testTransientOwnershipNativeProgressprovider-before-requestandprovider-after-request.Evidence
Failing first. With the final tests, the old rule fails five rows: the facade test, rows 8, 9 and 10 of
testRestoreCompletion, and row 10 oftestTransientConfigurePlacement. In each, the record is not cleared or the configure is not placed.This branch:
testXdgShellWindowbinary passes, 916 of 916;git clang-formaton the changed lines: clean.Mutations, each against the whole binary:
writer-lost-during-releaseIn a Fedora 44 VM, with trial RPMs of the 6.8.2 line carrying the first version of this change (release
pf3.174.1) and plasma-fusion#173's script. That version used a stage test instead of the mark, and passed 27 of 27 suites on that line. The master's frame and its native record were read every 0.3 s:v6.8.2-pf3kwinrc+ reconfigure)In plasma-fusion's NT08 session pass, the re-toggle after the script went and came back is accepted (refused on
v6.8.2-pf3). An orderly restart and akill -9mid-session keep the placement file, leave no tree and dump no core.Between that trial and this branch: the mark changes nothing in a reachable state. It closes the gap between the request's last strict check and its post-check, where nothing can call back today. The tagged build gets the same VM checks.
Not in this change
Other ways a record can be left Restoring after its provider retires still end only when the window closes (archledger/plasma-fusion#175): a restore that never starts before the tree's release, a restore superseded after the retirement, and a provider retired while the window is still owned. Ending those needs an adoption or expiry rule of its own.