Repository navigation
nvx-rs: run the control session on the shared NVXS session's host role - #641
Merged
Enrique Saurez (esaurez) merged 1 commit intoOct 21, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
Static review identified no blocking issues in the delegation, error translation, or test-broker updates; tests were not rerun.
No open issues 🎉
What changed in this PR
Moves the host control session onto the shared NVXS HostConnection, keeping NVXC framing in the adapter and preserving broker-compatible behavior.
Changes:
- Delegates transport and session validation to
HostConnection, translating failures into existing control-session errors. - Updates test brokers and expands protocol, timeout, and framing coverage.
- Documents the shared-session architecture.
| File | Description |
|---|---|
nvx-rs/src/testing/fake_openvmm.rs |
Sends authentication ERROR records with the required code. |
nvx-rs/src/host/session.rs |
Adapts NVXC over HostConnection and expands tests. |
nvx-rs/src/host/mod.rs |
Documents the host session layering. |
nvx-rs/src/host/cli/session/tests.rs |
Uses a protocol-valid RESET record. |
nvx-rs/src/host/cli/session.rs |
Clarifies the Python-parity comment. |
nvx-rs/src/guest/managed_agent/loopback.rs |
Preserves queued records and sequences RESET correctly. |
nvx-rs/README.md |
Updates the host module descriptions. |
Review effort: Balanced
Enrique Saurez (esaurez)
marked this pull request as ready for review
October 20, 2026 16:46
ControlSession parsed the control endpoint's NVXS records itself, and tracked the broker's identity and sequence numbers inline with NVXC decoding. Make it the NVXC adapter over the host role of the shared session, nvx::host::nvxs::HostConnection: each NVXC frame travels in one DATA record, and a failure keeps its variant and, for a record with one fault, its message, so that the CLI reports what it reported before. The shared session checks more than the control session did: the sequence numbers of WAIT and READY, the code that an ERROR carries, and the identity and sequence number of a RESET. A failure that leaves the stream unusable, such as a reset, a record that the protocol does not allow, or a write that times out, now ends the session, and later calls fail. OpenVMM's broker refuses a capability by closing the stream, and never sends the host a RESET. The fake OpenVMM refuses one with an ERROR record, and the managed agent's loopback broker resets the host; both now send these records as the shared session requires: an ERROR carries its code, and a RESET to the host carries the session's next epoch at the host leg's next sequence number. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 086f45a6-c39c-4704-85ef-1fa7f8b8b672
Enrique Saurez (esaurez)
force-pushed
the
esaurez/a1-host-h4-nvxs-session-20261020
branch
from
October 21, 2026 00:34
144fc51 to
38d7b9b
Compare
Pedro Henrique Penna (ppenna)
approved these changes
Oct 21, 2026
Enrique Saurez (esaurez)
deleted the
esaurez/a1-host-h4-nvxs-session-20261020
branch
October 21, 2026 01:47
This was referenced Oct 21, 2026
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.
The host's control session parsed the control endpoint's NVXS records itself: it checked each record's header, tracked the broker's identity and sequence numbers, and did all of it inline with
NVXCdecoding. This PR makesnvx::host::session::ControlSessiontheNVXCadapter over the host role of the shared NVXS session from #627,nvx::host::nvxs::HostConnection. EachNVXCframe travels in one DATA record, as before. The wire format is unchanged, and so are the session's failures, and the CLI's messages, for everything that OpenVMM's broker sends.Part of #620
Refs #535
What changed
host::session:ControlSessionwraps aHostConnection.attachhands the capability toHostConnection::attach, which waits while the broker sends WAIT.SessionErrorthat the session reported before: a timeout, a closed stream, a refused capability, a reset or an I/O error. A protocol violation keeps the message of the check that it fails: a malformed or oversized header, a payload in WAIT or READY, an empty DATA record, and otherwise an invalid attach response or data record. A stream that ends inside a record has closed, as before. The CLI's Python-parity messages are unchanged, and so are its golden scenarios.nvx::host::nvxsandnvx::host::session.Behavior
OpenVMM's broker sends the host WAIT, READY and DATA. It refuses a capability by closing the stream, and never sends the host an ERROR or a RESET. The shared session checks a few things that the control session didn't, in records that the broker never sends:
Instancecan poll with short deadlines.Validation
At 38d7b9b, this PR's commit rebased onto
devat b47a9f8. The only conflict was in the host module's overview, next to the newstoreentry.dev's guest artifacts, whose managed agent runs on the shared session's guest role since nvx-rs: run the managed agent on the shared NVXS session's guest role #639, and this PR'snvx-rsCLI asNVX_RS:python scripts\nvx.py test-microvm --backend whp, the default suite. All 42 scenario runs pass. That includesmanaged-lifecycle, which builds and runs the library'smanaged_lifecycletest with this change.--scenario managed-exec-config --scenario sandbox-lifecycle. Both pass.nvx-rswithNVX_BUNDLE=skip:cargo fmt --all --checkcargo clippy --locked --all-targets --all-features -- -D warningscargo clippy --locked --lib --no-default-features -- -D warningscargo test --locked --all-features, thencargo test --lockedbundledtestcargo doc --locked --no-deps --all-features, withRUSTDOCFLAGS=-D warningscargo +1.89 check --locked --all-targets --all-featurescargo check --locked --all-targets --all-features --target aarch64-apple-darwinpython3 scripts/nvx.py check-guest-binaries --toolchain 1.95.0build-guest-binaries, thentest-guest-binariescheck-nvx-rsruns them: protocol-only and host-only on both OSes, and guest-only on Linux.aci_edge_sandboxes, on both OSes: its fmt, Clippy, test, doc and MSRV steps, andtest-agent-bundling. On Linux, its macOS check too.python scripts/nvx.py verifyandpython scripts/check_markdown_links.py.Everything passes except one environmental failure on Linux, where my shell runs as root. The CLI golden test's caller-owned-share scenario, with 20 differences, refuses its temporary share because UID 0 owns it, as
--mount-owner callerrequires.devfails the same way there, and CI runs the test unprivileged.I didn't run KVM or MSHV myself: this machine's nested KVM can't boot OpenVMM's built-in CPU profile. CI runs the KVM, MSHV and WHP matrix, which adds managed-lifecycle on the Ubuntu and Azure Linux guests.