forked from the-crypt-keeper/tldw
-
Notifications
You must be signed in to change notification settings - Fork 86
Fix VZ guest exec buffering #2628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rmusser01
wants to merge
3
commits into
dev
Choose a base branch
from
codex/vz-real-smoke-debug
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
backlog/tasks/task-12141 - Fix-VZ-Linux-real-smoke-exec-output-over-VSock.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| --- | ||
| id: TASK-12141 | ||
| title: Fix VZ Linux real smoke exec output over VSock | ||
| status: Done | ||
| assignee: [] | ||
| created_date: '' | ||
| updated_date: '2026-08-27 02:02' | ||
| labels: | ||
| - sandbox | ||
| - vz-linux | ||
| - real-smoke | ||
| - bugfix | ||
| dependencies: [] | ||
| --- | ||
|
|
||
| ## Description | ||
|
|
||
| <!-- SECTION:DESCRIPTION:BEGIN --> | ||
| Real Apple Virtualization.framework smoke reaches guest readiness but exec output propagation is unreliable: direct helper exec can time out and the host smoke can complete with empty stdout. Investigate and fix the guest/helper VSock request-response path with minimal code and tests. | ||
| <!-- SECTION:DESCRIPTION:END --> | ||
|
|
||
| ## Acceptance Criteria | ||
| <!-- AC:BEGIN --> | ||
| - [x] #1 Guest VSock client preserves host bytes buffered immediately after ready ACK | ||
| - [x] #2 Regression test covers ready ACK plus exec request in one host write | ||
| - [x] #3 Real host VZ smoke passes with rebuilt guest bundle | ||
| <!-- AC:END --> | ||
|
|
||
| ## Implementation Notes | ||
|
|
||
| <!-- SECTION:NOTES:BEGIN --> | ||
| <!-- SECTION:IMPLEMENTATION_NOTES:BEGIN --> | ||
| ['Observed on local Apple Silicon host with signed macos-vz-helper and Debian arm64 bundle.', 'Helper daemon bundle smoke passed. Real smoke selected tests: 2 passed, 1 failed on missing stdout token.', 'Manual helper probe reached guest readiness then direct exec_guest timed out at guest_transport_timeout.', 'Leading hypothesis: guest VSock client primes handshake/ready with bufio.Reader, then ServeStream reads from raw conn; bytes buffered after ready can be lost from ServeStream.'] | ||
| <!-- SECTION:IMPLEMENTATION_NOTES:END --> | ||
|
|
||
| Root cause confirmed with failing test: primeConnection used a bufio.Reader for handshake/ready, then Run passed the raw conn into ServeStream. If the helper's ready ACK and first exec request arrived together, the exec bytes could remain buffered in the discarded reader. | ||
|
|
||
| Fix: return the priming bufio.Reader from primeConnection and pass it to ServeStream so buffered exec bytes remain visible. | ||
|
|
||
| Verification: GOCACHE=/private/tmp/tldw-go-build-cache go test ./internal/guest; GOCACHE=/private/tmp/tldw-go-build-cache go test ./... in tools/tldw-agent; rebuilt Debian arm64 bundle; real host smoke final_exit_code=0 at /private/tmp/tvz-e2e.4iJ3wt/evidence/host-smoke-evidence.json. | ||
|
|
||
| Bandit: not applicable to touched production code; this change is Go-only under tools/tldw-agent. | ||
|
|
||
| PR review follow-up: updated TestGuestVSockClientRunPreservesExecBufferedAfterReady to wait for and validate the exec response before closing the helper-side pipe, removing the race noted in review. | ||
| <!-- SECTION:NOTES:END --> | ||
|
|
||
| ## Final Summary | ||
|
|
||
| <!-- SECTION:FINAL_SUMMARY:BEGIN --> | ||
| Fixed VZ Linux guest VSock exec delivery by preserving the buffered reader used during handshake/readiness when entering ServeStream. Added a regression test for ready ACK plus exec request arriving in one host write, then verified unit tests and real Apple VZ smoke against a rebuilt Debian arm64 bundle. | ||
| <!-- SECTION:FINAL_SUMMARY:END --> | ||
|
|
||
| ## Definition of Done | ||
| <!-- DOD:BEGIN --> | ||
| - [x] #1 Acceptance criteria completed | ||
| - [x] #2 Tests or verification recorded | ||
| - [x] #3 Documentation updated when relevant | ||
| - [x] #4 Bandit run for touched code when applicable or document non-code/environment skip | ||
| - [x] #5 Final summary added | ||
| - [x] #6 Known skips or blockers documented | ||
| <!-- DOD:END --> |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.