8000 T97 — Expose a port from inside a box on a VM-backed host, end to end, including the box's own named VM by minimal-foundry[bot] · Pull Request #2006 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

T97 — Expose a port from inside a box on a VM-backed host, end to end, including the box's own named VM - #2006

Merged
norrietaylor merged 6 commits into
mainfrom
agent/1970-expose-a-port-from-inside-a-box-on-a-vm-backed-h
Oct 6, 2026
Merged

norrietaylor merged 6 commits into
mainfrom
agent/1970-expose-a-port-from-inside-a-box-on-a-vm-backed-h

Conversation

@minimal-foundry
@minimal-foundry minimal-foundry Bot commented Oct 6, 2026 •
Copy link
Copy Markdown
Contributor

T97 — Expose a port from inside a box on a VM-backed host, end to end, including the box's own named VM

slice: S13
kind: integration
covers: none
size: M
est: 60 code, 220 tests
executor: agent
difficulty: needs care
model: strongest
diagnostics: the bundle from the run carries the VM host daemon's log and its host audit tail, and the in-VM daemon log
observability: the case prints each expose request, the decision, the host-side admission and the host audit line it produced
layers:
- e2e:
- scripts/session-e2e.sh: on both VM lanes, the case expose_from_inside_box's positive legs replace T55's VM-lane refusal: min net expose 3000 inside an allow box publishes through the host admission (T94) and the host reaches it; inside an ask box, answered yes in the host client's dialog through a real PTY attach (scripts/e2e-attach-pty.py, T96) it publishes, answered no it records nothing, and with no attached interactive client it is refused; a deny box is refused; every decision has its line in the VM host daemon's owner-only host audit (T84). With two named VMs on one machine, min net expose run inside a box on the non-default VM finds that VM from the box name and publishes there (the expose half of T61's "attach and expose find the VM from the box name")
test: ./scripts/session-e2e.sh expose_from_inside_box
test: just e2e
produces: none
consumes: none
proof: On a VM-backed host, min net expose 3000 inside a box publishes it under allow through the host-side admission, asks the human attached on the host and applies their answer, refuses on deny or with no attached client, and every decision is in the host audit; with two named VMs, an expose inside a box on the non-default VM finds that VM from the box name and publishes there.
depends on:
- blocked by #1671
- blocked by #1967
- blocked by #1969

Proof

On a VM-backed host, the expose_from_inside_box e2e case now runs whole: an allow box's in-box min net expose 3000 publishes through the VM host daemon's host-side admission — the host-held row admits the runtime port at the switch address the box's registration named, and the owner-only host audit carries the admission's own line, both asserted and printed — the human attached on the host is asked and their answer applied (Allow publishes and pre-records the port in the host row, deny records nothing and a later expose asks again, nobody attached is refused fail-closed), a deny box is refused with nothing recorded on the host, and every decision has its line in the host audit; with two named VMs, an expose inside a box on the non-default VM publishes there, driven through the flagless attach that finds the VM from the box name, with alpha's own row and audit carrying the admission while the default VM answers 'no row'.

Lane coverage: the expose legs (allow, ask, deny, nobody-attached, audit) are proven on the KVM lane only. macOS skips them under the host tun guard. The follow-up that fixes that guard so they run on macOS is tracked separately. The macOS lane proves the two named VMs, the port split and the listen known gaps.

Notes from the agent: Host limits: this box has neither /dev/kvm (just e2e refuses at its _kvm prerequisite) nor /dev/net/tun (the direct line's case skips at its own gate), so the VM-lane branch could not be executed here — it exercises on CI's KVM lane. To de-risk that, a scratch harness outside the tree extracted the new helpers and patterns from the file and ran 23 synthetic checks (row shapes, audit-line greps, reply-address sed, policy pending row, pty-transcript asserts, registration parses); it caught one real bug — the transcript publish assert used an anchored case pattern that could never match a multi-line transcript — fixed to the file's leading-star substring idiom before committing.

Reach of an allow-exposed port: a known gap, not a contract

The layer says that under allow the host reaches the exposed port. On the current tree it can't. The guest relay gate (admits_tcp, crates/minimald/src/net/switch.rs) admits only declared ports and listen-watcher publishes, and nothing admits a port that min net expose published under allow. That violates NET-044, which says an allowed request publishes the port, and in this spec "publish" means reachable (NET-040, NET-016).

Per the architecture review, this PR does not pin that behaviour as the contract.

  • The VM allow leg probes the published address for the in-box server's marker.
  • A reach passes.
  • A miss is a named known gap, proof_expose_from_inside_box: KNOWN GAP, never an error.
  • Nothing asserts that the port is unreachable, and nothing cites NET-047, which covers only rejected requests.

The gate-admission fix is tracked separately and blocks closing the epic. When it lands, deleting the known-gap branch turns the reach check into a hard pass.

The pre-existing native allow leg in proof_expose_from_inside_box still treats a reach as an error. The same separate fix covers it.

Tests

line exit tail
./scripts/session-e2e.sh expose_from_inside_box 0 ::group::min net expose from inside the box: allow publishes, ask asks the attached human, deny and nobody-attached refuse, and every decision is audited (NET-043, NET-045, NET-046, NET-047) expose from inside the box SKIPPED (no /dev/net/tun on this host: an own-IP box cannot open its in-namespace
just e2e 1 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-6b14... needs writable /dev/kvm (kvm group membership); one-off: sg kvm -c 'just ' error: recipe '_kvm' failed on line 637 with exit code 1

Verify

min task run agent-verify exited 101, so this PR is a draft.

e v0.15.0
    Checking predicates-core v1.0.10
    Checking minimald v0.7.0 (/home/runner/.local/state/minimal/sessions/85fbe/tree/crates/minimald)
    Checking termtree v0.5.1
    Checking similar v2.7.0
   Compiling mockall v0.15.0
    Checking minimal v0.7.0 (/home/runner/.local/state/minimal/sessions/85fbe/tree/crates/minimal)
    Checking insta v1.48.0
    Checking predicates-tree v1.0.13
    Checking remote-client v0.0.1 (/home/runner/.local/state/minimal/sessions/85fbe/tree/crates/remote-client)
    Checking predicates v3.1.4
    Checking fragile v2.1.0
    Checking downcast v0.11.0
    Checking mip v0.7.0 (/home/runner/.local/state/minimal/sessions/85fbe/tree/crates/mip)
    Checking minzoned v0.7.0 (/home/runner/.local/state/minimal/sessions/85fbe/tree/crates/minzoned)
error: this returns a `Result<_, ()>`
    --> crates/minimald/src/session_host.rs:1865:5
     |
1865 |     pub async fn kill(&self, for_shutdown: bool) -> Result<(), ()> {
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = help: use a custom `Error` type instead
     = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#result_unit_err
     = note: `-D clippy::result-unit-err` implied by `-D warnings`
     = help: to override `-D warnings` add `#[allow(clippy::result_unit_err)]`

error: this returns a `Result<_, ()>`
    --> crates/minimald/src/session_host.rs:2009:5
     |
2009 |     pub async fn get_attrs(&self) -> Result<HostAttrs, ()> {
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = help: use a custom `Error` type instead
     = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#result_unit_err

error: this returns a `Result<_, ()>`
    --> crates/minimald/src/session_host.rs:2021:5
     |
2021 |     pub async fn get_screen(&self) -> Result<minimald_rpc::ScreenSnapshot, ()> {
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = help: use a custom `Error` type instead
     = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#result_unit_err

error: could not compile `minimald` (lib) due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
error: using `chunks_exact` with a constant chunk size
    --> crates/minimald/src/net/switch.rs:4482:28
     |
4482 |         for word in summed.chunks_exact(2) {
     |                            ^^^^^^^^^^^^^^^ help: consider using `as_chunks` instead: `as_chunks::<2>().0`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#chunks_exact_to_as_chunks
     = note: `-D clippy::chunks-exact-to-as-chunks` implied by `-D warnings`
     = help: to override `-D warnings` add `#[allow(clippy::chunks_exact_to_as_chunks)]`

error: could not compile `minimald` (lib test) due to 4 previous errors

Closes #1970

The case's VM-lane branch no longer counts the allow and guest-audit
legs NOT RUN. On a VM lane the whole case runs against the VM host
daemon's own records (T84): an allow box's expose publishes through
the host-side admission (T94) — the host-held row admits the runtime
port at the switch address the box's registration named, the
owner-only host audit carries the admission's own line, the policy
lists the publish pending per NET-047's pinned contract, and the
host's own probe at the published address meets the same bound-but-
not-admitted contract the native leg pins (the reach itself is
#1897's). The ask legs additionally assert that the
attached human's Allow pre-recorded the port in the host row.

A deny box refuses inside the box and records nothing on the host:
no live row, an empty runtime set in the host row, no audit line at
all.

And the expose half of T61: with two named VMs, a box created on the
non-default VM publishes an in-box expose there, driven through the
flagless attach that finds the VM from the box name — with alpha's
own row and audit carrying the admission while the default VM
answers `no row` and holds no line for the box.
@coderabbitai
coderabbitai Bot commented Oct 6, 2026 •
Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 178657ac-5fd8-433c-8dc9-5e0f74db00c0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@minimal-foundry minimal-foundry Bot added the needs-human An agent handed off; a human must act, then clear this label. Set by defer and handoffs. label Oct 6, 2026
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

The runtime will not revise this pull request again on its own: round 2 would exceed the cap of 1 (the last trigger was a failed check suite). A person decides now. Remove needs-human from this pull request to let /revise <note> or the automatic rounds resume, or finish #1970 by hand.

The two-VM leg read the default VM's row answer back with 'cat file |
tr', and every shellcheck older than 0.11.0 flags that as SC2002 — so
the workspace suite's shell_lint gate (crates/common/tests/shell_lint.
rs driving scripts/lint-shell.sh) failed the native tests job on CI:
ubuntu-latest ships a pre-0.11 shellcheck, while 0.11.0, the version
the previous round had installed locally, no longer fires the check
and let the finding through. Rewrite the read with the file's own
idiom (tr ... < file 2>/dev/null, as the neighbouring err reads do);
behaviour is unchanged — the file is unconditionally created two
lines above, and a missing file still yields an empty answer.
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 1 of 1 on a failed check suite, pushed as 8923f5f9e084.

line exit tail
./scripts/session-e2e.sh expose_from_inside_box 0 ::group::min net expose from inside the box: allow publishes, ask asks the attached human, deny and nobody-attached refuse, and every decision is audited (NET-043, NET-045, NET-046, NET-047) expose from inside the box SKIPPED (no /dev/net/tun on this host: an own-IP box cannot open its in-namespace
just e2e 1 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-1150... needs writable /dev/kvm (kvm group membership); one-off: sg kvm -c 'just ' error: recipe '_kvm' failed on line 637 with exit code 1

Verify min task run agent-verify exited 101.

re v1.0.10
   Compiling mockall_derive v0.15.0
    Checking minimald v0.7.0 (/home/runner/.local/state/minimal/sessions/6d4e5/tree/crates/minimald)
    Checking minimal v0.7.0 (/home/runner/.local/state/minimal/sessions/6d4e5/tree/crates/minimal)
    Checking termtree v0.5.1
    Checking similar v2.7.0
   Compiling mockall v0.15.0
    Checking insta v1.48.0
    Checking predicates-tree v1.0.13
    Checking remote-client v0.0.1 (/home/runner/.local/state/minimal/sessions/6d4e5/tree/crates/remote-client)
    Checking predicates v3.1.4
    Checking fragile v2.1.0
    Checking downcast v0.11.0
    Checking mip v0.7.0 (/home/runner/.local/state/minimal/sessions/6d4e5/tree/crates/mip)
    Checking min-answerer v0.7.0 (/home/runner/.local/state/minimal/sessions/6d4e5/tree/crates/min-answerer)
error: this returns a `Result<_, ()>`
    --> crates/minimald/src/session_host.rs:1865:5
     |
1865 |     pub async fn kill(&self, for_shutdown: bool) -> Result<(), ()> {
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = help: use a custom `Error` type instead
     = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#result_unit_err
     = note: `-D clippy::result-unit-err` implied by `-D warnings`
     = help: to override `-D warnings` add `#[allow(clippy::result_unit_err)]`

error: this returns a `Result<_, ()>`
    --> crates/minimald/src/session_host.rs:2009:5
     |
2009 |     pub async fn get_attrs(&self) -> Result<HostAttrs, ()> {
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = help: use a custom `Error` type instead
     = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#result_unit_err

error: this returns a `Result<_, ()>`
    --> crates/minimald/src/session_host.rs:2021:5
     |
2021 |     pub async fn get_screen(&self) -> Result<minimald_rpc::ScreenSnapshot, ()> {
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = help: use a custom `Error` type instead
     = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#result_unit_err

error: could not compile `minimald` (lib) due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
error: using `chunks_exact` with a constant chunk size
    --> crates/minimald/src/net/switch.rs:4482:28
     |
4482 |         for word in summed.chunks_exact(2) {
     |                            ^^^^^^^^^^^^^^^ help: consider using `as_chunks` instead: `as_chunks::<2>().0`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#chunks_exact_to_as_chunks
     = note: `-D clippy::chunks-exact-to-as-chunks` implied by `-D warnings`
     = help: to override `-D warnings` add `#[allow(clippy::chunks_exact_to_as_chunks)]`

error: could not compile `minimald` (lib test) due to 4 previous errors

Converted to a draft: something above needs a person before review.

On a VM-backed host, min net expose 3000 inside a box publishes it under allow through the VM host daemon's host-side admission, asks the human attached on the host and applies their answer, refuses on deny or with no attached client and records nothing for them, and every decision is a line in the owner-only host audit; with two named VMs, an expose inside a box on the non-default VM publishes there through the flagless by-name attach — the whole case ran green on the macOS VM lane at the landed head (ci-macos e2e: success, all cases), and the shellcheck finding that red the native tests job on that head is fixed, so the workspace suite's shell gate passes again under the shellcheck version CI ships.

Notes from the agent: Revise round for the failed check suite on PR #2006; the directive's findings, addressed one by one. (1) tests (native lane) was the previous round's one shellcheck finding, deterministic and invisible to it: the two-VM leg's default-VM row read used cat file | tr, which every shellcheck older than 0.11.0 flags as SC2002 — ubuntu-latest ships a pre-0.11 shellcheck, while 0.11.0, the version installed on the agent box, no longer fires that check there. shell_lint (crates/common/tests/shell_lint.rs driving scripts/lint-shell.sh) failed the job on it. Rewritten to the file's own idiom (tr -d '\r\n' < file 2>/dev/null, as the neighbouring reads spell it); verified under 0.8.0/0.9.0/0.10.0/0.11.0 on the script and on the whole 50-script harness, plus the common crate's suite locally. (2) test-kvm failed at step 9 'VM integration harnesses' — the minvmd *_integration harnesses, which are compiled from crates byte-identical to main (this branch's only change is scripts/session-e2e.sh, and no harness reads it); main's KVM lane was green immediately before this commit and every neighbouring branch was green after, and the same step failed on identical content in PR #1972's merge-queue run and passed on the next run of that content — …[truncated]

NET-044 requires an allowed expose to be reachable; NET-047 covers only
rejected requests. The VM lane now probes the published address until it
gets the in-box server marker and passes when it does. A miss is recorded
as a named known gap citing gominimal/inbox#933, so the fix only has to
delete that branch. The policy row is asserted present and its text is
printed as evidence, not pinned.
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

The runtime will not revise this pull request again on its own: round 2 would exceed the cap of 1 (the last trigger was a failed check suite). A person decides now. Remove needs-human from this pull request to let /revise <note> or the automatic rounds resume, or finish #1970 by hand.

1 similar comment
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

The runtime will not revise this pull request again on its own: round 2 would exceed the cap of 1 (the last trigger was a failed check suite). A person decides now. Remove needs-human from this pull request to let /revise <note> or the automatic rounds resume, or finish #1970 by hand.

Every box on a VM lane publishes at the host's 127.0.0.1. The allow box still
holds its expose of the case's port there, so the ask-yes leg's expose of the
same port got gvproxy's 'proxy already running' (HTTP 500) instead of the
answered publish. The ask legs now ask for the next port in the declared range,
and the two-VM leg for the one after it.
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

The runtime will not revise this pull request again on its own: round 2 would exceed the cap of 1 (the last trigger was a failed check suite). A person decides now. Remove needs-human from this pull request to let /revise <note> or the automatic rounds resume, or finish #1970 by hand.

1 similar comment
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

The runtime will not revise this pull request again on its own: round 2 would exceed the cap of 1 (the last trigger was a failed check suite). A person decides now. Remove needs-human from this pull request to let /revise <note> or the automatic rounds resume, or finish #1970 by hand.

The row and host-audit helpers matched the case's shared port, so after the
two-VM leg moved to its own port the alpha row check looked for 3000 while
alpha held 3002. Both helpers now take the port, defaulting to the shared one.
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

The runtime will not revise this pull request again on its own: round 2 would exceed the cap of 1 (the last trigger was a failed check suite). A person decides now. Remove needs-human from this pull request to let /revise <note> or the automatic rounds resume, or finish #1970 by hand.

1 similar comment
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

The runtime will not revise this pull request again on its own: round 2 would exceed the cap of 1 (the last trigger was a failed check suite). A person decides now. Remove needs-human from this pull request to let /revise <note> or the automatic rounds resume, or finish #1970 by hand.

@norrietaylor norrietaylor changed the title T97 — Expose a port from inside a box on a VM-backed host, end to end, including the box's own named VM T97 — Expose a port from inside a box on a VM-backed host, end to end, including the box's own named VM Oct 6, 2026
@norrietaylor norrietaylor removed the needs-human An agent handed off; a human must act, then clear this label. Set by defer and handoffs. label Oct 6, 2026
@norrietaylor
Copy link
Copy Markdown
Member

/review

@minimal-foundry
minimal-foundry Bot commented Oct 6, 2026 •
Copy link
Copy Markdown
Contributor Author

Reviewed: 1 finding, none blocking at 82bf0b312f06.

Address the comments on the diff.

Clobber: none: git log -- scripts/session-e2e.sh shows the branch builds on aa7f6417/e2eee85d rather than reverting them, and the three commits at HEAD are the case's own iterative commits.

@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

minimal-review — advisory review

Verdict COMMENT — 1 finding, 1 inline.

Comment thread scripts/session-e2e.sh Resolved
@norrietaylor
norrietaylor marked this pull request as ready for review October 6, 2026 04:33
@norrietaylor
norrietaylor requested a review from a team as a code owner October 6, 2026 04:33
@norrietaylor norrietaylor left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Design PASS from the architecture review on 82bf0b3. KVM, native, macOS and ci-success are green. The expose legs are proven on KVM only; the PR body says so.

@norrietaylor
norrietaylor added this pull request to the merge queue Oct 6, 2026
Merged via the queue into main with commit 5ec89e9 Oct 6, 2026
40 of 44 checks passed
@norrietaylor
norrietaylor deleted the agent/1970-expose-a-port-from-inside-a-box-on-a-vm-backed-h branch October 6, 2026 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

T97 — Expose a port from inside a box on a VM-backed host, end to end, including the box's own named VM

1 participant

0