Skip to content

Fix: handle partial write in stdio forwarding - #41065

Merged
Feng Wang (chemwolf6922) merged 1 commit into
masterfrom
user/chemwolf6922/handle-partial-write-in-stdio-forwarding
Jul 14, 2026
Merged

Fix: handle partial write in stdio forwarding#41065
Feng Wang (chemwolf6922) merged 1 commit into
masterfrom
user/chemwolf6922/handle-partial-write-in-stdio-forwarding

Conversation

@chemwolf6922

@chemwolf6922 Feng Wang (chemwolf6922) commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary of the Pull Request

Partial writes on the WSL stdio relay were ignored. This could result in loss of data.
This PR adds the partial write handling logic.

PR Checklist

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

Tested manually by copying large amount of data to vim.

Regression tests are not added because the failure is hard to repro in e2e tests. Open to suggestions on the tests.

Copilot AI review requested due to automatic review settings July 13, 2026 05:11
@chemwolf6922
Feng Wang (chemwolf6922) requested a review from a team as a code owner July 13, 2026 05:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes silent data loss in the Linux-side stdio relay by correctly handling short (partial) write() results when forwarding stdin into the child process. This aligns with the reported symptoms in #41063 where large pastes could drop data at 4 KiB boundaries due to ignored partial writes.

Changes:

  • Detect partial writes to the child stdin FD and buffer the unwritten remainder in PendingStdin.
  • Reuse the existing deferred-stdin write path to retry remaining bytes without blocking the relay loop.

@chemwolf6922 Feng Wang (chemwolf6922) changed the title handle partial write in stdio forwarding Fix: handle partial write in stdio forwarding Jul 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@benhillis Ben Hillis (benhillis) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks correct to me, is it possible to have a unit test / stress test that validates the fix?

@benhillis Ben Hillis (benhillis) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will be difficult to write a unit test for, but the fix looks correct.

@chemwolf6922
Feng Wang (chemwolf6922) merged commit a3bdd01 into master Jul 14, 2026
13 checks passed
@chemwolf6922
Feng Wang (chemwolf6922) deleted the user/chemwolf6922/handle-partial-write-in-stdio-forwarding branch July 14, 2026 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WSL 2.9.3] Large bracketed pastes silently lose 512-byte chunks at 4 KiB boundaries

3 participants