Repository navigation
tests: serve the control session in the runtime adapter's guest agent - #640
Merged
Enrique Saurez (esaurez) merged 6 commits intoOct 21, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
Source review identified no blocking issues in this scoped adapter change; validation was not rerun.
No open issues 🎉
What changed in this PR
Adds the runtime adapter’s guest-side NVXS session using public nvx-rs APIs and independent application framing, advancing the guest portion of consumer-contract scenario C1.
Changes:
- Adds bounded message framing and guest session handling.
- Adds
runtime-adapter-guest serveand framing/session tests. - Updates adapter and CI documentation; host integration remains deferred.
| File | Description |
|---|---|
| tests/runtime-adapter/tests/guest_session.rs | Tests guest sessions and binary behavior against a test broker. |
| tests/runtime-adapter/src/lib.rs | Exposes framing and guest modules. |
| tests/runtime-adapter/src/guest.rs | Implements guest session handling through public APIs. |
| tests/runtime-adapter/src/frame.rs | Adds bounded framing, incremental decoding, and unit tests. |
| tests/runtime-adapter/src/bin/runtime-adapter-guest.rs | Adds serving over standard input and output. |
| tests/runtime-adapter/README.md | Documents framing, guest behavior, and tests. |
| doc/project-structure.md | Updates the adapter’s structure and capabilities. |
| doc/ci.md | Documents guest-side C1 coverage. |
Review effort: Balanced
Enrique Saurez (esaurez)
force-pushed
the
esaurez/a1-guest-g6-nvxs-session-20261020
branch
from
October 20, 2026 21:06
2be2c7d to
dd171e2
Compare
Enrique Saurez (esaurez)
force-pushed
the
esaurez/a1-guest-g6-adapter-20261020
branch
from
October 20, 2026 21:09
8def730 to
9ad0b5f
Compare
Enrique Saurez (esaurez)
force-pushed
the
esaurez/a1-guest-g6-nvxs-session-20261020
branch
from
October 20, 2026 22:46
dd171e2 to
6af062f
Compare
Enrique Saurez (esaurez)
force-pushed
the
esaurez/a1-guest-g6-adapter-20261020
branch
from
October 20, 2026 22:48
9ad0b5f to
f0e4e3a
Compare
Enrique Saurez (esaurez)
force-pushed
the
esaurez/a1-guest-g6-adapter-20261020
branch
from
October 20, 2026 23:16
f0e4e3a to
d9c1924
Compare
Base automatically changed from
esaurez/a1-guest-g6-nvxs-session-20261020
to
dev
October 20, 2026 23:51
Give the runtime adapter its own application framing, length-prefixed messages with a kind byte, and a guest agent that serves the host program with it over the guest's end of the control session, through nvx::guest::nvxs alone. The guest agent acknowledges each reset once it dropped the earlier epoch's partial message, credits each payload back once it holds it, and answers Ping, Echo and Stop. `runtime-adapter-guest serve` runs it on its standard input and output. tests/guest_session.rs checks it against a test broker that plays the broker's end of the guest's session over a Unix socket pair, for the library and for the static binary. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 086f45a6-c39c-4704-85ef-1fa7f8b8b672
The runtime adapter's documentation, comments, and test names referred to scenario IDs and later steps that only planning issues define, called its parts halves, and named the control session after its protocol. Describe each part by its role instead: the host program, the guest agent, and the control session between the host and the guest. nvx::guest::nvxs remains as the API path that the guest agent uses, and the contract string keeps its protocol versions. The CI and contribution guides, the check-nvx-rs action, and the microVM workflow describe the adapter the same way. 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-guest-g6-adapter-20261020
branch
from
October 21, 2026 00:14
d9c1924 to
d21f93e
Compare
The tests waited without a limit for the guest agent's thread and for the guest binary to end. A regression that kept the guest serving, such as a frame check that no longer refuses a header, hung the test run instead of failing it. Wait at most the broker's receive timeout for each, then fail the test; a binary that is still running is killed and reaped first. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 086f45a6-c39c-4704-85ef-1fa7f8b8b672
Enrique Saurez (esaurez)
marked this pull request as ready for review
October 21, 2026 00:31
The guest session tests still waited without a limit when the guest stopped reading: the broker wrote with write_all on a blocking socket, and the socket's buffer can fill before the guest's receive window does, as with 7-byte records. Each write now has a deadline of TIMEOUT, so a guest that stops reading fails the test instead of hanging it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 086f45a6-c39c-4704-85ef-1fa7f8b8b672
The CI docs said that the microVM jobs run the runtime adapter's hypervisor scenarios, which suggested coverage that the adapter does not have. Say what the step does instead: it builds the host-only configuration and runs any ignored tests that it declares, while the adapter's other tests run in the nvx-rs job. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 086f45a6-c39c-4704-85ef-1fa7f8b8b672
Pedro Henrique Penna (ppenna)
approved these changes
Oct 21, 2026
This was referenced Oct 21, 2026
MAX_BODY was written as 256 KiB, and its doc said that four of the session's records carry less than that, though they carry exactly that much. Define it as four of the session's largest record payloads, the relation that the tests rely on: the longest message, with its header, spans five records, and the guest's minimum receive window holds a quarter of its body. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 086f45a6-c39c-4704-85ef-1fa7f8b8b672
Enrique Saurez (esaurez)
deleted the
esaurez/a1-guest-g6-adapter-20261020
branch
October 21, 2026 01:45
This was referenced Oct 21, 2026
This was referenced Oct 21, 2026
Closed
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.

#619 makes the guest's role of the control session between the host and the guest usable by any guest agent, through
nvx::guest::nvxsand with noNVXCdependency. Its G6 step covers NVX's managed agent (#639) and the runtime adapter's guest agent. This PR gives the runtime adapter from #626 its own application framing, and a guest agent that serves the host program with it over that session, through public APIs only. In #535's terms, it adds the guest's part of consumer-contract scenario C1, the control session with independent framing. The repository's docs describe these tests by what they check, without scenario IDs.Part of #619
Refs #535
What changed
runtime_adapter::frame, in every configuration: the adapter's framing, which its host program and guest agent exchange over the control session in place ofNVXC.u32, then the message's kind:Ping,Pong,Echo(at most 256 KiB, what four of the session's largest records carry),StopandStopped.Decoderreassembles messages that span records, or share one. It checks each header before it takes any byte of the body, and holds at most one partial message.runtime_adapter::guest, the guest agent, in the guest-only configuration:serveserves the host program over any stream to the guest's end of the session, throughnvx::guest::nvxs::GuestConnection.Ping,EchoandStop.runtime-adapter-guest serveruns the guest agent on its standard input and output, such as a control console in raw mode. Without arguments, the binary still reports its contract, and anything else is still a usage error, astests/independent_build.rsexpects.frame's unit tests: each kind's encoding, messages in pieces of any size and split at every byte, and the headers that it refuses.tests/guest_session.rs, in the guest-only configuration. A test broker plays the broker's end of the guest's session over a Unix socket pair withnvx's public record API, forserveand for the static binary. It covers:doc/project-structure.md,doc/ci.mdanddoc/contribute.md. They describe the adapter by its parts' roles: the host program, the guest agent, and the control session between the host and the guest. They no longer refer to scenario IDs or later steps that only issues define. Neither do the adapter's comments in thecheck-nvx-rsaction and the microVM workflow.The host program's use of the session, and the hypervisor scenarios that run the adapter, come later in #620 and #535.
Validation
In
tests/runtime-adapter, the steps thatcheck-nvx-rsruns:x86_64-unknown-linux-musl, withcargo fmt --all --check, Clippy with-D warnings,cargo build,cargo testandcargo +1.89 check.Pingthroughrefused, one to the binary, and 16 MiB written to a guest that never reads. Each failed after 30 to 32 s instead of hanging.Also on Windows 11:
python scripts/check_markdown_links.py.python -m unittest scripts.test_nvx_tools, because the change edits comments in thecheck-nvx-rsaction and the microVM workflow. In one of two full runs, a release-packaging test failed with "Access is denied" while it renamed a staging directory that it had just written. It passed in three runs on its own.The adapter adds no dependency. No hypervisor scenario runs the adapter yet, so CI's microVM jobs only build it.