Skip to content

doc: give init agents guidelines (SL7.9) - #1492

Merged
Pedro Henrique Penna (ppenna) merged 5 commits into
feature/nvx-refactorfrom
agents/slim-sl7-9-init-guidelines
Nov 11, 2026
Merged

Pedro Henrique Penna (ppenna) merged 5 commits into
feature/nvx-refactorfrom
agents/slim-sl7-9-init-guidelines

Conversation

@ppenna

@ppenna Pedro Henrique Penna (ppenna) commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Part of #1130 (SL7.9, "Init agents have guidelines"). Parent #1090, umbrella #1076.

What and why

Authors of init agents had no single contract for building a guest's space, running executions, coordinating a capture and completing a restore: design 4.2 and 4.3 mixed that procedure with the architecture, and described execution machinery that nvx-init doesn't use. This PR does SL7.9's Scope and no more:

  • doc/guest-agent-guidelines.md (new) opens with the split: nvx parses the contracts, captures the guest and drives a restore's activation, but builds no space, runs no executions and enforces none of these obligations; the one exception is the time daemon, which TimeAbi::start_daemon forks. With nvx-init as the worked example, it covers:
    • ownership;
    • the space, labelled as NVX's internal reference code that nvx-init implements, not public API: its public inputs, and the rules of the root, the runtime file systems, the view, the mappings, the helpers and the one switch;
    • MappingTable's contract: parts in order, a latch after a failure, a complete table before any workload;
    • the executions: each child resets its priority, sets its credentials, changes to its working directory and execs, in its own process group, which end, cancellation, timeout and reset kill; priority, not limits (no cgroups and no per-execution limits; the RAM upper's cap is the one limit);
    • for an init with concurrent executions, the workspace contract (freeze(deadline), undone, ordered all-or-nothing freezes thawed in reverse, after_restore()), and what nvx-init does instead: it refuses a capture while an execution runs, or kills the process groups and sweeps;
    • the silent transport, the restore order (Activation::new, the space with the restore's own network policy, DNS and announcer, after_restore, complete, thaw, Ready), failures (Resumed, MustEnd) and replay.
  • Compiled snippets. The general snippets are public-API doc tests, which the guidelines quote verbatim: the mapping-table excerpt in guest's rustdoc and the capture-outcome excerpt in guest::snapshot's. The space-interface snippets are the body of the private space's unit test, guest::init::boot::tests::the_reference_space_steps_compile, also quoted verbatim. No new harness.
  • Rustdoc links. guest, guest::snapshot, guest::activation and activation link the guidelines.
  • Design 4.2 and 4.3 keep only the architecture and boundaries, of nvx-init and of the older layered sandbox root and blockless managed root, which still run.
  • doc/project-structure.md lists the page, as it lists every document in doc/. In nvx-rs: build every feature set, compile the documented examples, and give every old test a fate (SL5.1a) #1488's case matrix, the two new doc tests get a row, and the two doc tests whose lines the rustdoc links move keep theirs, at the new lines.

Not in this PR, per #1130: other guideline documents, a workspace trait or enforcement code in nvx, publishing the space module, cgroups, namespaces, per-execution roots or limits, a new example harness, or rewriting 4.2 and 4.3 beyond architecture and boundaries.

Commits. The first four are Enrique Saurez (@esaurez)'s first implementation (esaurez/slim-5.2.1-sl7.9-private-20261108), replayed with their authorship. The fifth checks each statement against nvx-init on feature/nvx-refactor and corrects those that didn't hold; its message lists them.

Rebase. Rebased from 5947e4e8 onto SL5.1a, which has merged (#1488), and now on feature/nvx-refactor 584c2ddd, after #1494. Both branches compiled the space's steps in a test of their own, in different files, so Git reported no conflict but one test would duplicate the other. This branch's version now lives in SL5.1a's test, under its name and in its file, which nvx-rs/README.md names (see below). Every statement was checked again at the new base, where the guest code is unchanged since 5947e4e8. Three statements no longer held, and are corrected: the host sends no MAPS for an empty mapping table, which no nvx_maps token announces; since #1490, no launch of NVX's CLI carries OpenVMM's older lifecycle token, which design 4.2 said the older CLI launches carry; and since #1494, no call of nvx starts the announcer, so the guidelines no longer name Announcer::start, and say that nvx-init forks the restored announcer and runs /sbin/nvx-ingress itself, while nvx-ingress start runs it for an agent that cannot hold it.

Size. 0 core lines and 0 counted files (estimate 0): documents, rustdoc comments and one unit test. BOOT_CONTRACT_VERSION, CONTROL_CONTRACT_REVISION and the public API are unchanged.

Validation

Check Result
python scripts/check_markdown_links.py, python scripts/check_test_layout.py Passed (Windows)
cargo fmt --all --check Passed (Windows)
Clippy -D warnings: --all-targets --all-features, --lib, --lib --no-default-features, --lib --no-default-features --features serde, --lib --bins --features cli, --lib --bins --no-default-features --features testing Passed (Windows). --all-targets --all-features also passed on Linux (nvx-kvm-test), where it compiles #1488's host-workflows and guest-workflows examples
Guest-only Clippy, --target x86_64-unknown-linux-musl --no-default-features --features guest --all-targets -- -D warnings (the Clippy run of nvx.py check-guest-binaries) Passed (Linux); it compiles guest-workflows with guest alone
cargo doc --no-deps --all-features, RUSTDOCFLAGS=-D warnings Passed on Windows and on Linux, where the guest modules' rustdoc builds
cargo test --doc --all-features Linux: 34 passed, among them src/guest/mod.rs - guest (line 41), src/guest/snapshot.rs - guest::snapshot (line 25), src/guest/activation.rs - guest::activation (line 195) and src/activation/mod.rs - activation (line 130), the names that the matrix gives them. Windows: the activation doc test passed
guest::init::boot::tests::the_reference_space_steps_compile Passed on Linux, with all features and with guest alone (musl). All of guest::init::boot::tests (musl): 14 passed, 2 ignored (they need a microVM)
cargo test --all-features --test security_checklist (#1488) Linux: 10 passed, 1 ignored (the idle stand-in for a VM's process)
Quoted excerpts Each of the guidelines' four rust blocks is identical to the code that it quotes
check_test_changes.py --base origin/feature/nvx-refactor 1 change, explained below

The table's results are from 0258d484, before the rebases onto 3c3dfce1 and 584c2ddd, which changed no content of these commits but the design 4.2 sentence and the announcer statements above. At 137d8029, Markdown links, test layout, fmt, rustdoc with warnings denied and the doc tests (Windows and Linux), and the private-space test (Linux, all features and guest alone), passed again, with the same doc-test names.

No runtime behavior changes, so no microVM scenario ran. Left to CI: the rest of check-nvx-rs (the full test suites, MSRV, macOS, public API, bundling) and the runtime adapter's checks.

Changes to existing tests (tests-modified)

Every other test of the area is kept. The doc tests of activation and guest::activation are unchanged, at lines 130 and 195 (were 123 and 189).

@ppenna Pedro Henrique Penna (ppenna) added tests-modified Changes existing tests, test data, or test wiring feat-nvx-refactor labels Nov 11, 2026
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

This pull request changes existing tests

It modifies or removes 1 existing test asset(s), listed below. Review each with care: a change to a test can hide a regression that the test caught. See doc/contribute.md#changes-to-existing-tests.

Test code

Change What Before After
modified test fn the_reference_space_steps_compile in guest::init::boot::tests nvx-rs/src/guest/init/boot/tests.rs:16 nvx-rs/src/guest/init/boot/tests.rs:15

Relocated unchanged: 0; added: 0. Compared the merge base 584c2ddde556 with 137d80296f24.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues require resolution.

No open issues 🎉

What changed in this PR

Implements SL7.9 of #1130 by documenting init-agent responsibilities separately from nvx’s library mechanisms, using nvx-init as the reference. Changes are limited to documentation, rustdoc examples and a compile-only unit test; runtime behavior and the public API are unchanged.

Changes:

  • Adds guidelines for guest-space assembly, execution ownership, capture coordination, restore ordering and failure handling.
  • Connects the guidelines to compiled examples through public-API doctests and the existing private-space unit test.
  • Updates the architecture pages, documentation index and acceptance-case matrix.
File Description
nvx-rs/​src/​guest/​snapshot.rs Adds a capture-outcome doctest and guidelines link.
nvx-rs/​src/​guest/​mod.rs Adds a mapping-table doctest and guidelines link.
nvx-rs/​src/​guest/​init/​boot/​tests.rs Aligns compile-only space examples with the quoted guidelines.
nvx-rs/​src/​guest/​activation.rs Links restore sequencing and caller obligations to the guidelines.
nvx-rs/​src/​activation/​mod.rs Summarizes restore-space ordering and links the guidelines.
doc/​project-structure.md Lists the new guidelines page.
doc/​guest-agent-guidelines.md Defines init-agent responsibilities with nvx-init examples.
doc/​design/​4.3-isolation-and-resource-model.md Distinguishes nvx-init’s VM-wide boundaries from legacy isolation.
doc/​design/​4.2-guest-agents-and-workload-model.md Updates lifecycle ownership and the guest architecture diagram.
doc/​acceptance-case-matrix.md Records the new doctests and updates existing doctest locations.

Review effort: Balanced

@ppenna
Pedro Henrique Penna (ppenna) force-pushed the agents/slim-sl5-1a-feature-sets branch 2 times, most recently from 9276731 to 05cd1d2 Compare November 11, 2026 21:30
Base automatically changed from agents/slim-sl5-1a-feature-sets to feature/nvx-refactor November 11, 2026 21:47
@github-actions github-actions Bot removed the tests-modified Changes existing tests, test data, or test wiring label Nov 11, 2026
@ppenna
Pedro Henrique Penna (ppenna) force-pushed the agents/slim-sl7-9-init-guidelines branch from 0258d48 to 196634c Compare November 11, 2026 21:57
@github-actions github-actions Bot added the tests-modified Changes existing tests, test data, or test wiring label Nov 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the documentation changes clarifying init-agent responsibilities and library boundaries.

No open issues 🎉

Review effort: Balanced

Enrique Saurez and others added 5 commits November 11, 2026 14:20
Centralize the guest-space, execution, capture and restore contract in one guide, with nvx-init as the internal reference example. Keep the architecture pages focused on boundaries and check the quoted public and private calls through existing rustdoc and unit tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 41345a73-b73f-4332-9ffd-9c513214af7a
Scope the VM-wide reference model separately from retained layered and blockless boot paths. Keep control-device and port-I/O boundaries, and distinguish parent-side account validation from child credentials. The daemon/helper compatibility wording remains a separately disclosed contract question.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 41345a73-b73f-4332-9ffd-9c513214af7a
Scope the reference lifecycle ownership rule without claiming that every retained API avoids forking. Describe caller-owned announcer startup and the report-only restore-finish child fallback without changing runtime or public API behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 41345a73-b73f-4332-9ffd-9c513214af7a
Distinguish the inline deferred restore checks and detector release from the deadline waiter and grace-period grandchild. Preserve the actual child-reaping boundary without changing helper behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 41345a73-b73f-4332-9ffd-9c513214af7a
The first draft of the guidelines predates the nvx-init that
feature/nvx-refactor now holds: #1453 routes the new sandbox boots
to it, #1431 serves capture requests, #1447 activates repaired
sessions, #1439 keeps a restore's announcer as a helper, and #1490
runs sandbox run through it too. Check each statement against that
code, and correct those that did not hold:

- an execution takes the VM's one workload identity, which nvx-init
  resolves, or creates, once before its switch, not an account mode
  of its own request, which nothing selects yet;
- the child also drops its capability bounding set, and nvx-init
  kills an execution's process group when its leader ends;
- nvx-init captures only the Fresh boot of a platform capture,
  refuses a session with a root with ENOTSUP, and shares one
  30-second deadline among its checks, its sweep and the capture;
- the restored broker restarts at its first epoch with a reset
  queued, and nvx-init fails on anything but that reset;
- the host sends no MAPS for an empty mapping table, which no
  nvx_maps token announces;
- no launch of NVX's CLI carries OpenVMM's older lifecycle token,
  which still routes a layered launch to the older init agent;
- since #1494, no call of nvx starts the announcer: nvx-init forks
  it and runs /sbin/nvx-ingress itself, and nvx-ingress start runs
  it for an agent that cannot hold it;
- the crate still keeps older calls that start processes, which
  nvx-init does not use.

Quote, and compile, the space's steps in the order of nvx-init's
cold boot and restore, and replace the capture excerpt with one that
handles each outcome and disposition. The steps compile in SL5.1a's
unit test of nvx-init's boot, the_reference_space_steps_compile,
which now holds them as the guidelines quote them, and the
guidelines link SL5.1a's guest-workflows example. Organize the page
by ownership, the space, the executions, the capture, the transport,
the restore, failures and replay. Trim design 4.2 and 4.3 to the
architecture and boundaries of nvx-init and of the older layered and
blockless roots, which still run. Link the guidelines from the
rustdoc of guest::activation too, list the page in the project
structure, and give the case matrix the doc tests that the
guidelines quote, and the lines to which the links move two others.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the documentation and example updates clarifying init-agent responsibilities and library–caller boundaries.

No open issues 🎉

Review effort: Balanced

@ppenna
Pedro Henrique Penna (ppenna) marked this pull request as ready for review November 11, 2026 22:25
@ppenna
Pedro Henrique Penna (ppenna) merged commit f834bcb into feature/nvx-refactor Nov 11, 2026
109 of 129 checks passed
@ppenna
Pedro Henrique Penna (ppenna) deleted the agents/slim-sl7-9-init-guidelines branch November 11, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat-nvx-refactor tests-modified Changes existing tests, test data, or test wiring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants