Repository navigation
tests: attach the runtime adapter's host program to the control session - #671
Merged
Enrique Saurez (esaurez) merged 1 commit intoOct 22, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Terminal send timeouts can leave the client returning buffered messages after its underlying connection has ended.
1 open issue
What changed in this PR
Adds the runtime adapter’s host-side client for independent framing over NVXS, complementing its guest agent. Hypervisor lifecycle scenarios remain follow-up work.
Changes:
- Adds attachment, message exchange, and request/reply APIs.
- Adds cross-platform tests for framing, session failures, and timeouts.
- Documents the host client and test coverage.
| File | Description |
|---|---|
| tests/runtime-adapter/tests/host_session.rs | Tests host sessions using an in-memory broker. |
| tests/runtime-adapter/src/lib.rs | Exposes the host module behind its feature. |
| tests/runtime-adapter/src/host.rs | Implements the host client and error handling. |
| tests/runtime-adapter/README.md | Documents client behavior and tests. |
| doc/project-structure.md | Describes both adapter session endpoints. |
| doc/ci.md | Documents host-side session coverage. |
Review effort: Balanced
Enrique Saurez (esaurez)
force-pushed
the
esaurez/a1-host-h5-adapter-host-20261020
branch
from
October 21, 2026 03:10
497c36a to
e1c767d
Compare
Enrique Saurez (esaurez)
marked this pull request as ready for review
October 21, 2026 03:12
This was referenced Oct 21, 2026
The runtime adapter's guest agent serves the control session between the host and the guest with the adapter's own framing, but its host program had no end of that session. Add `runtime_adapter::host::Client`, built on `nvx::host::nvxs::HostConnection` over any platform transport: - `Client::attach` attaches with the launch capability and reports the identity of the session's epoch; - `send` and `receive` exchange the adapter's messages as application data, reassembling messages that span records or share one; - `ping`, `echo` and `stop` send a request and check its answer. The client holds at most the rest of one record and one partial message. A reset of the session ends the attachment with its partial message, because the next epoch starts with a new message, in a new attachment. A failure of the session, a send that fails or times out, which the session cannot resume, a malformed message, or a message that only the host sends ends the client. A receive that times out keeps what arrived. A request ends the client on any failure, since a late answer would answer the wrong request. `tests/host_session.rs` checks it in the host-only configuration against a test broker that plays the broker's host-facing end, and the guest agent behind it, with the public record API over an in-memory transport, so it runs on Linux and Windows: the attachment and its bootstrap record, waits and refusals, messages that span records both ways, partial records, record lengths, ERROR payloads, sequence and identity errors, resets and disconnects in the middle of a message, timeouts, sends that fail, the answers that requests check, and the bounded buffers of the framing and the records. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 76c7c1bb-20fe-4724-bbc0-dfb01bbec828
Enrique Saurez (esaurez)
force-pushed
the
esaurez/a1-host-h5-adapter-host-20261020
branch
from
October 21, 2026 18:10
e1c767d to
02decf1
Compare
Enrique Saurez (esaurez)
deleted the
esaurez/a1-host-h5-adapter-host-20261020
branch
October 22, 2026 21:53
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 runtime adapter's guest agent serves the control session between the host and the guest with the adapter's own framing (#640), but its host program had no end of that session. This PR adds the host program's client,
runtime_adapter::host::Client, through public APIs only, with tests of the host's part of the session with independent framing. The hypervisor scenarios that launch, reattach and stop a VM with it come in a follow-up pull request.Part of #620
Refs #535
What changed
runtime_adapter::host(featurehost):Clientattaches throughnvx::host::nvxs::HostConnection::attachover anynvx::host::platform::Transport, with the launch capability, and exchanges the adapter's messages (PingandPong,Echo,StopandStopped) as the session's application data, mirroring the guest agent.attachwaits while the broker waits for the guest, and reports the identity of the session's epoch.sendsends a message in as many records as it takes.receivereturns the guest agent's next message, whether it spans records or shares one with the next message.ping,echoandstopsend a request and check its answer:Pong, anEchoof the same bytes, andStopped.Ended. A receive that times out keeps what arrived. A request ends the client on any failure after the framing accepted it, a timeout included, because an answer that arrived later would answer the wrong request.tests/host_session.rs, in the host-only configuration: a test broker plays the broker's host-facing end of the session, and the guest agent behind it, with the public record API ofnvx::protocol::nvxs, over an in-memoryTransport, so the tests run on Linux and Windows. They cover:doc/ci.mdanddoc/project-structure.md.The adapter adds no dependency, and its binaries don't change.
Validation
At e1c767d, on
devat 916a61f. Intests/runtime-adapter, the commands of the three "Check the runtime adapter's ..." steps ofcheck-nvx-rs:x86_64-unknown-linux-musl, each withcargo fmt --all --check, Clippy with-D warnings,cargo build,cargo test, andcargo +1.89 check --all-targets. All pass;tests/host_session.rsruns 9 tests.tests/host_session.rsruns 9 tests.Also on Windows 11:
cargo doc --no-deps --features hostwithRUSTDOCFLAGS=-D warningsin the adapter,python scripts/check_markdown_links.py, andpython scripts/nvx.py verify.The adapter declares no ignored test yet, so the microVM jobs, which a change to the adapter runs, only build its host-only configuration on each backend. I ran no hypervisor for this change.