Fix: handle partial write in stdio forwarding - #41065
Merged
Feng Wang (chemwolf6922) merged 1 commit intoJul 14, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
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.
2 tasks
Ben Hillis (benhillis)
left a comment
Member
There was a problem hiding this comment.
This change looks correct to me, is it possible to have a unit test / stress test that validates the fix?
Ben Hillis (benhillis)
approved these changes
Jul 13, 2026
Ben Hillis (benhillis)
left a comment
Member
There was a problem hiding this comment.
I think this will be difficult to write a unit test for, but the fix looks correct.
Feng Wang (chemwolf6922)
deleted the
user/chemwolf6922/handle-partial-write-in-stdio-forwarding
branch
July 14, 2026 03:27
2 tasks
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 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.