CmdPal: Refine superseding value gate lifecycle #51380

Open
jiripolasek opened 6:15pm on October 17, 2026 wants to merge 1 commit into microsoft/powertoys main from
dev/jpolasek/f/51379-cmdpal-superseding-value-gate
Diff Delta:
0
About 74 Diff Delta/hour
Classified as:  Feature Add

zadjii-msft's Description of Work

Summary of the Pull Request

This PR tefines SupersedingAsyncValueGate<T> so requests arriving as the worker becomes idle complete reliably, and disposal prevents later results from being applied.


  • Preserves latest-request-wins behavior and keeps caller cancellation scoped to waiting.

  • Serializes request scheduling and keeps caller cancellation scoped to its wait.

  • Runs work cancellation callbacks asynchronously and drains them before reporting idle.

  • Adds asynchronous disposal while allowing committed application to finish.

  • Documents lifecycle guarantees and exposes gate and request state in the debugger.

PR Checklist


  • [x] Closes: #51379
    <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) -->

  • [ ] Communication: I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected

  • [ ] Tests: Added/updated and all pass

  • [ ] Localization: All end-user-facing strings can be localized

  • [ ] Dev docs: Added/updated

  • [ ] New binaries: Added on the required places



  • [ ] Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

5 total changed files
Loading changes...
Review complete πŸ’ͺ
Your attention span may now revert to "default human"