Files
PowerToys/src/modules
Michael Jolley 123f341d3d Harden JSON-RPC transport writes, logging, and inbound fan-out (round 2, phase 2)
Fixes three round-2 phase-2 findings in the Command Palette JSON-RPC transport:

- Non-cancellable writes: frame emission (WriteAsync/FlushAsync) no longer runs
  under CancellationToken.None. It is now bounded by a dedicated write timeout and
  linked to disposal, so a child that stops draining stdin can no longer hang a
  write (or the write lock) forever. On timeout or disposal the write is abandoned,
  the connection enters its terminal closed state (raising Disconnected so the owner
  tears the child down), and the caller fails fast with a transport error. Caller
  cancellation still never corrupts a live, reusable connection.
- Malformed-body logging: the parse-failure log path now truncates the offending
  payload to a small cap with a marker instead of logging the full body up to the
  32 MB frame cap.
- Inbound request fan-out: inbound requests are drained by a fixed pool of workers
  through a bounded queue, replacing the untracked fire-and-forget tasks. This caps
  concurrency, applies backpressure to the peer when saturated, and lets disposal
  await the in-flight handlers cleanly.

Adds unit tests covering the write timeout and disposal teardown of a stuck write,
truncated logging of an oversized malformed body, and bounded inbound concurrency
with clean disposal. Updates the disposal-during-write test to the new contract.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 311db8aa-f8db-47bb-943f-5447037946c7
2026-08-28 13:02:52 -05:00
..