Skip to content

T60 — Address boxes across two VMs by name without a global flag - #1807

Merged
norrietaylor merged 24 commits into
mainfrom
agent/1670-address-boxes-across-two-vms-by-name-without-a-g
Oct 2, 2026
Merged

norrietaylor merged 24 commits into
mainfrom
agent/1670-address-boxes-across-two-vms-by-name-without-a-g

Conversation

@minimal-foundry

@minimal-foundry minimal-foundry Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

T60 — Address boxes across two VMs by name without a global flag

slice: S15
kind: task
covers: NET-057, NET-058, NET-059
size: L
est: 450 code, 240 tests
executor: agent
difficulty: needs care
model: strongest
diagnostics: the bundle's daemon log tail names each VM's proxy publication
observability: one debug log line per box-name resolution naming the VM it resolved to
layers:
- cli:
- crates/minimal/src/cmd/list.rs: ls lists every VM and adds a VM column, filled on the client side
- crates/minimal/src/cmd/session.rs: attach resolves the VM from the box name through the shared resolution attach.rs provides, which expose reuses once T53 lands
- crates/minimal/src/attach.rs: resolution across every VM's socket
- crates/minimal/src/tests.rs: hosts the listing and resolution tests
- crates/minimal-client/src/lib.rs: enumerates the VMs' sockets
test: cargo nextest run -p minimal ls_shows_vm_per_box
test: cargo nextest run -p minimal box_name_resolves_vm_without_flag
- tui:
- crates/minimal-tui/src/rpc.rs: the provider probes cover every named VM
test: cargo nextest run -p minimal-tui probes_every_named_vm
- daemon:
- crates/minimald/src/server.rs: each VM publishes the proxy on a host port of its own instead of all taking the same one
- crates/minimald/src/net/proxy.rs: hosts the concurrent-routing test
test: cargo nextest run -p minimald two_vms_hostnames_route_concurrently
produces: none
consumes: none
proof: With two VMs running, ls shows the VM per box, attach finds the VM from the box name alone, and both VMs' box names route through the host at the same time; the expose verb's resolution of the VM is T53's.
depends on:
- blocked by #1621
- blocked by #1626

Proof

With two VMs running, min ls shows the VM per box, attach finds the VM from the box name alone, and both VMs' box names route through the host at the same time. The expose verb's resolution of the VM belongs to T53.

NET-059 is met on native hosts and on Linux VM hosts. The macOS VM backend is pending #1814, because minvmd can hand two VMs the same proxy port there.

How NET-059 is met depends on how the daemon boots:

  • VM boots (T63, #1788). minvmd assigns each VM's hostname-proxy and zone-answerer ports before boot and passes them on the boot line. The guest binds and publishes them pinned, and they are never walked. Distinct ports per VM therefore depend on minvmd handing out distinct numbers, which is tracked in #1814.
  • Boots with no handed port (an older minvmd, a native run, or a host that handed 0). If the host refuses a daemon's default publication, the daemon publishes on a host port of its own (the next rung) and reports that port at session start and in min ls. Its listener keeps the documented port. This applies to both the proxy and the box-zone answerer.
  • Bind rule. The proxy listener uses the platform-default bind: SO_REUSEADDR on Unix, and never SO_REUSEPORT. A port that a live listener holds is still refused with EADDRINUSE. A native daemon restarted in place rebinds the documented port over TIME_WAIT.
  • Host resolver. The host's resolver recipe names the documented answerer port, so it reaches the first VM's zone. A second VM's zone answers on its own host port. A single answerer per host belongs to T65 (#1710, PR #1813).

Behaviour changes

  • min ls lists every VM. With more than one VM it adds a VM column and prefixes each VM's routing lines with the VM name. That includes NET-018's NAME SURFACE line, which is computed per VM from one shared host read, because the resolver hook routes the zone to one VM's answerer. With one VM the output is unchanged.
  • min ls --json with more than one VM returns one object: sessions spans every VM, each entry carries "vm", and each VM's own facts sit under vms[]. With one VM the output is unchanged.
  • VMs other than the selected one get one connect attempt each (Client::probe, 4 s PROBE_TIMEOUT). A stopped VM's stale socket reads as not running. The selected VM keeps the gated connect and its retry window.
  • min session attach <box> falls through to the VM that owns the name and announces it. If two VMs know the name, attach refuses and lists both.
  • TUI: the provider probes cover every named VM. A VM named host or vm gets the label vm:host or vm:vm, so it never collides with the host daemon's or the default VM's group.
  • The daemon log's NET-018 line names the port the host's resolver actually reaches, the same port the discovery field carries.

Tests (round 6, head 73e7f98)

line result
cargo nextest run -p minimal ls_shows_vm_per_box pass
cargo nextest run -p minimal box_name_resolves_vm_without_flag pass
cargo nextest run -p minimal-tui probes_every_named_vm pass
cargo nextest run -p minimald two_vms_hostnames_route_concurrently pass

Also covered: attach_refuses_a_box_name_two_vms_know, walked_proxy_port_reported_at_start_and_in_ls, two_vms_pinned_ports_route_concurrently, proxy_bind_rebinds_over_the_time_wait_a_restart_leaves, vms_named_for_the_reserved_labels_keep_their_own_candidates, a_stopped_vm_does_not_hold_a_listing, ls_keeps_the_selected_vm_when_its_socket_appears_late, ls_leashes_the_vms_it_did_not_select, attach_fall_through_hands_off_the_owning_vm, a_stopped_vm_does_not_hold_a_box_name_resolution, a_walked_answerer_publication_keeps_the_bind_and_reports_the_rung.

crates/minimal/src/resolver.rs is outside the plan's layers. It changes because of the merge with T15 (#1802): the single-daemon live_name_surface became live_name_surfaces, one verdict per listed VM, with no change for a single VM.

All lanes are green on 73e7f98, KVM and macOS included.

Closes #1670

The default VM plus every named VM with a state dir, default first and
the rest alphabetical; a directory whose name breaks the naming rule is
skipped (the provider dir holds non-VM trappings) rather than failing a
listing, and the native minimald backend enumerates nothing. This is
the set a multi-VM listing lists across (NET-057) and a box-name
resolution probes (NET-058).
min ls on a multi-VM host is one listing of all of them: each running
VM contributes its boxes and every row carries the VM it came from
(NET-057), one VM keeps the single-VM output byte for byte. A named
attach target resolves to the VM that owns it from the name alone
(NET-058): the selected VM's daemon first, then a probe across every
VM's socket — the shared resolution in attach.rs that min net expose
reuses once it lands — refusing an ambiguous name rather than guessing,
and never overriding an explicit --vm.
The dashboard's provider discovery now walks the VM side per VM: the
default VM keeps the vm group label a saved dashboard state records,
and every named VM joins under its own name and its own socket, so a
two-VM host's sidebar shows both VMs' boxes. A provider's label is a
String now — a named VM's is its name, not a fixed vocabulary.
Two VMs on one host used to contend for one host loopback port by
construction: the publication of a VM's hostname proxy asked the gvproxy
forwarder for the same number the listener bound in-guest, and when the
host held it the daemon moved the *bind* — sacrificing the documented
port every box-side recipe shares with its VM's daemon — just to fix a
host-facing contention (NET-059).

The publication now carries its own host port. It proposes the bound
port first, so a lone VM still publishes on the documented default, and
when the host refuses that one as taken it walks one rung further up
(HOST_PUBLISH_PORT_STRIDE) while the listener keeps the port it bound. A
pinned port never walks — the operator named it, and the retry with the
report stays the remedy — and a transient failure still keeps its port,
so a daemon that boots before its host gvproxy does not drift. The RPC
discovery field carries the port a client can reach: the published one
on a VM whose publication walked, the bound one everywhere else.

Each accepted publication is named in the log with both ports — the
bundle's answer to which VM owns which host port when two run.

two_vms_hostnames_route_concurrently drives two VM-shaped daemons
through the walk (the ledger stand-in holding every host port it
accepts) and proves both VMs' box names route through their published
host ports at the same time, each refusing the other's names, with both
listeners still answering the documented default.
…0s ran out

the coder's uncommitted work as it stood when its 7200s ran out

The coder was stopped at the end of its time with these changes
not committed. The runtime committed its working tree as it stood so
the work is kept: this commit is a snapshot, not a finished step, and
may not build or pass its tests.
@coderabbitai

coderabbitai Bot commented Oct 2, 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: 3081f4bc-7445-4666-bb72-9e506d9f730d

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

Autopilot is currently an internal CodeRabbit preview.


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

@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.

Review of round 0 (head 8c2c3655) against T60's plan block (#1670). All eight layer files and four test lines are present; the two ls verbs and the resolver are driven on two real daemons. The items below are what a revise round needs before the draft lifts; I will post the /revise once round 1 (the inventory tests) lands.

  1. HIGH crates/minimal/src/cmd/list.rs:325 — the exists() pre-check runs before Client::connect's retry, and Client::connect's own doc (crates/minimal-client/src/lib.rs:221) says the macOS bridge UDS appears after vm-up; with a second VM up, the selected VM is skipped, listings is non-empty so the fallback at list.rs:340 never fires, and min ls silently renders the other VM as a single-VM listing. Connect the selected VM unconditionally (it was just ensured); only pre-check the others.
  2. MEDIUM crates/minimald/src/server.rs:1772-1810 — the new answerer comment ("keeps the bound port's number on the host side … one answerer serves the host's zone") contradicts the arm beneath it, which still aborts the serve and rebinds on port 0 when the host refuses the publish ("the same release-and-rebind the routing proxies take" — they no longer do). On a two-VM host VM B's answerer moves its in-guest bind to a random UDP port and VM B's names never reach the host resolver; NET-059's "host's hostname surface" is proven for the HTTP proxy only. Make the comment true and state in the PR whether the DNS half is T60's or deferred.
  3. MEDIUM crates/minimal/src/cmd/list.rs:616-645 — with two or more VMs --json becomes an array of per-VM objects instead of the documented single object, so jq '.sessions[]' pipelines break the day a second VM appears; the plan asks for a VM column, i.e. per-row attribution. Prefer a "vm" field on each entry in one flat sessions array, or document the array deliberately.
  4. MEDIUM crates/minimal/src/cmd/list.rs:325,338 and crates/minimal/src/attach.rs:281 — a stopped VM's ssh.sock is never unlinked (minvmd only removes it at the next start, crates/minvmd/src/vm.rs:309), so exists() is true and Client::connect burns 20×100 ms before erroring: every min ls and every cross-VM attach fallback pays +2 s per stopped VM and prints warning: skipping VM …: Connection refused for a normal state. Treat ECONNREFUSED on a non-selected VM as "not running" (no retry, no warning), and put a short tokio::time::timeout around the non-selected probes — today a wedged VM holds ls for up to ~72 s (crates/minimal-client/src/lib.rs:170,181,189).
  5. LOW crates/minimal/src/tests.rs:64-99 — the two inventory tests only need three additive lines: "tests.rs::create_box_on = asserts nothing" (in-process same-build fixture; say so in a comment), "attach.rs::box_record_on = gated", and "cmd/list.rs::list_vm = gated" (comment: gate applied to the selected VM only; the rest are read-only and ungated like the dashboard). The call sites are correctly gated per the scanner's rule; do not change them.
  6. LOW crates/minimal/src/cmd/session.rs:1089-1110 — the attach fall-through (selected daemon errors → resolve_box_vm → session_via_ssh on the other VM's socket) is the one new path no test drives; box_name_resolves_vm_without_flag covers the resolver only. Also squash 687bda9 (fmt/#[expect] fallout only) into 77842f0 if this is not squash-merged.

The named-VM work opened two daemon connections and one CreateSession
site, so `every_daemon_connection_is_classified` and
`every_create_session_asserts_the_daemon_build` failed on the branch:
the inventories are asserted rather than documented, so each new site
has to be judged and listed here.

`box_record_on` gates the owning VM's daemon on the reply that named
the box, and `list_vm` keeps the gate for the selected VM while the
other VMs stay listable ungated. The two-VM fixture's create now
asserts the build the way every other site does, so no site passes
`None` quietly.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 1 of 10 on a failed check suite, pushed as f497f672fe89.

line exit tail
cargo nextest run -p minimal ls_shows_vm_per_box 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-a411... Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/613ff/tree/crates/args) Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/613ff/tree/crates/ot) C
cargo nextest run -p minimal box_name_resolves_vm_without_flag 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-49df... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/9909b/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/9909b/tree/crate
cargo nextest run -p minimal-tui probes_every_named_vm 0 ling rustls v0.23.45 Compiling idna v1.1.0 Compiling url v2.5.8 Compiling futures-executor v0.3.34 Compiling google-cloud-wkt v1.8.0 Compiling lalrpop v0.23.1 Compiling tokio-util v0.7.19 Compiling tokio-rustls v0.26.5 Compiling futures v0.3.34 Compiling h2 v0.4.18 Comp
cargo nextest run -p minimald two_vms_hostnames_route_concurrently 0 Applying loadouts: default Running task runtime-implement-test-3 in session task-runtime-implement-test-3-a78d... Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/b121e/tree/crates/args) Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/b121e/tree/crates/ot) C

Verify min task run agent-verify exited 101.

libwinnow-99c1af2fb880a040,libserde_spanned-be80f269d4b6496f,libtoml_datetime-84ecc87c2d97e656,libtracing-d69d2e93d23e90b6,libpin_project_lite-e13bf5cc3a2893ba,libtracing_core-e3d9d07d66b344ca,libonce_cell-95bf9403d1811857,libportable_atomic-eb019a898abb5d0a,libnutype-5de32d6a6c3d6388,libpaths-637b95848fb67a52,libdirs-7b74faaf8c47e5cf,libdirs_sys-e816aac2461e3c7b,liboption_ext-c133e3a0e728f5f8,libthiserror-d480180f980aa8a1,libcamino-a3afdc3a0dd66bb1,libuuid-df55427de28109e2,libgetrandom-e6a96a028037d8a0,librand_core-487754200c3459ba,libcrossterm-4157ef51ca141707,librustix-6c1ccdf526613d4b,liblinux_raw_sys-3f2dd9ef9c127637,libbitflags-0492bab2449ba0a3,libparking_lot-a71066ce459c6554,libparking_lot_core-328b1ddf8bd7f133,libcfg_if-e3caa094f03d0de5,libsmallvec-df4578fedb17cd5a,liblock_api-6b4bf631be04280f,libscopeguard-503598ba60f6dfd9,libderive_more-a516510e66ffc4f9,libfutures_core-1ded8d77a42a3e04,libsignal_hook_mio-3906fcd3e935cb35,libsignal_hook-6db02a0e5f002e75,libsignal_hook_registry-b038d11ed14e2d87,liberrno-d4aa7be9461b3730,libmio-61a0140fd537af25,liblibc-836828b86c8ecf52,liblog-367969b2b60f5a63,libanyhow-f3e9872018b8d373,libchrono-f6edb270f24ca652,libiana_time_zone-1079e7b338da537a,libnum_traits-5ec56d639a34aad8,libserde-75035935062ebae6,libserde_core-ee9647d9df6f413c}.rlib" "<sysroot>/lib64/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,libcfg_if-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/work/build-cache/cargo-home/build/debug/deps/rustc2kwr0P/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/work/build-cache/cargo-home/build/debug/build/tree-sitter-6d857ef690a7a05e/out" "-L" "/work/build-cache/cargo-home/build/debug/build/tree-sitter-nickel-3f36464d3516a3fb/out" "-L" "/work/build-cache/cargo-home/build/debug/build/blake3-bbcf47287b18f779/out" "-L" "/work/build-cache/cargo-home/build/debug/build/aws-lc-sys-ff63e510f19823f4/out" "-L" "/work/build-cache/cargo-home/build/debug/build/zstd-sys-c7912bebb9979a47/out" "-L" "<sysroot>/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/work/build-cache/cargo-home/build/debug/deps/snapshots-714c9f32a88bf89b" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: /usr/bin/ld: final link failed: No space left on device
          collect2: error: ld returned 1 exit status
          

error: could not compile `minimal-tui` (test "snapshots") due to 1 previous error
error: command `/usr/bin/cargo '--color=auto' test --no-run --message-format json-render-diagnostics --package minimal --package minimal-client --package minimald --package minimal-tui --locked` exited with code 101

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

With two VMs running, min ls shows the VM per box, min session attach <box> resolves the owning VM from the box name alone, and both VMs' box names route through the host's hostname surface at the same time — and this round the branch's workspace suite is green again: the two version-inventory tests that failed the CI tests job now pass, with all four of the task's named proofs still passing at the new head.

Notes from the agent: Revise round on PR #1807; the directive carried only the two failed checks (ci-linux-native-success, tests) and no review threads. Both checks traced to one root: every_daemon_connection_is_classified and every_create_session_asserts_the_daemon_build in crates/minimal/src/tests.rs are source-scanning inventories that must list every Client::connect and CreateSessionRequest site in the crate, and the earlier session's named-VM work had added three (attach.rs::box_record_on, cmd/list.rs::list_vm, tests.rs::create_box_on) without judging them. I verified each classification against the code — box_record_on gates the owning VM's daemon on the reply that named the box, list_vm keeps the gate for the selected VM and lists the others ungated — and made the two-VM fixture's create assert the build via minimal_client::version_assertion() instead of passing None, so no create site states nothing. No runtime code changed; the native-daemon-e2e and minimald-root-integration jobs that were green on this head are unaffected by a one-test-file diff, and cargo-deny/doctests are untouched by it. The proof's expose-verb half is T53's, per the task. Not run: just test-ignored and cargo test --doc (neither is reachable from this diff; the workspace suite and fmt/clippy gates are what failed). The full 2509-test suite needed several frees of the shared build cache — the box's disk filled mid-round, so I deleted stale duplicate cargo artifacts under /work/build-cache (build output only, no repo file); nothing in the checkout wa…[truncated]

@norrietaylor

Copy link
Copy Markdown
Member

/revise
Round 2 for T60 (#1670). Round 1 fixed the inventory tests but did not see the review on #1807. Address these items:

  1. In crates/minimal/src/cmd/list.rs:322-327, exempt the selected VM (vm.vm == selected) from the if !vm.sock.exists() { continue; } skip. The macOS bridge UDS can appear after vm-up (see Client::connect's doc, crates/minimal-client/src/lib.rs:221), and today, with a second VM running, min ls silently drops the selected VM's boxes. Correct the comment at 322–324. Add a case to ls_shows_vm_per_box (or a sibling test) where the selected VM's socket path does not exist yet when the loop runs, and assert that the listing is not rendered as alpha-only.
  2. In crates/minimald/src/server.rs:1772-1810, make the box-zone answerer's comments match its code: the arm still aborts and rebinds on port 0, and the routing proxies no longer do. Either give the answerer the proxies' no-rebind behaviour, or keep it and state in the PR body that the DNS half of NET-059 ("the host's hostname surface") is deferred, with a linked issue. Do not claim in the PR body or round notes that both VMs' names route through the whole hostname surface unless the answerer does.
  3. In crates/minimal/src/cmd/list.rs:616-638, keep min ls --json a single object on multi-VM hosts: one sessions array whose entries each carry "vm". Assert that shape in ls_shows_vm_per_box. If you keep the per-VM array instead, justify it in the PR body as a deliberate shape change.
  4. In crates/minimal/src/cmd/list.rs:325,333-337 and crates/minimal/src/attach.rs:281-284, stop charging a stopped VM's stale ssh.sock. For non-selected VMs, treat ECONNREFUSED as "not running", with no 2 s connect retry and no warning: skipping VM line. Bound each non-selected list_vm/box_record_on probe with a short tokio::time::timeout, like the TUI's 4 s CONNECT_TIMEOUT, so a wedged VM cannot hold min ls or an attach for about 72 s.
  5. In crates/minimal/src/tests.rs, add a test for the attach fall-through at crates/minimal/src/cmd/session.rs:1089-1110. Use two_vms/create_box_on, select the default VM, name a box that exists only on alpha, and assert that the record and socket handed off are alpha's. Extract the selection into a helper if that is needed to test it without a live SSH attach.
  6. Refresh the PR body's Tests and Verify sections from this round's run, and drop the stale r0 "Out of time" and exited 100 text. If verify fails on infrastructure again (round 1's was No space left on device), say so explicitly.

Client::connect retries its socket for ~2 s to absorb the bridge UDS
appearing late, which is the right patience for the VM an operator
picked and the process just ensured — and the wrong patience for every
VM it merely walks past on a host that may hold several. probe makes
one connect attempt and classifies the refusal: a stale ssh.sock
(ConnectionRefused) or a vanished path (NotFound) is NotRunning, an
answer the caller can act on, and anything else is Unreachable, worth a
warning.

The handshake moves into its own helper so connect, connect_scoped and
probe share it. PROBE_TIMEOUT names the leash callers are expected to
run a probe under: 4 s, the same window the TUI allows a mid-run
reconnect, against the ~72 s the stacked retry, handshake and RPC
deadlines would otherwise charge per wedged VM.
A listing or a box-name resolution spans every VM the CLI can see, and
until now each VM it passed was charged the full patience of the one the
operator picked: a 2 s connect retry for every stopped VM's stale
ssh.sock and, for a wedged one, the stacked handshake and RPC deadlines
that held the caller for about 72 s per VM.

- The listing and the resolution probe those VMs instead (the new
  Client::probe, one attempt), read "not running" as the answer it is —
  no retry, no warning — and bound each probe with the short
  PROBE_TIMEOUT leash. fill_git_info stays outside the leash: it walks
  git on the host, not the daemon. The selected VM keeps the gated
  connect it always had.
- The selected VM is exempt from the not-running skip: it is up, but on
  the VM backend its bridge UDS can appear a beat after the vm-up line,
  which is exactly the race connect's retry window absorbs — skipping it
  dropped the operator's own boxes and printed another VM's as the whole
  picture.
- min ls --json stays one object on a multi-VM host: the sessions array
  every consumer parses, each entry carrying its VM, with each VM's own
  facts under vms. The per-VM array it briefly printed broke that parse
  for no gain.
- cmd_attach's fall-through (selected daemon misses, resolve_box_vm
  finds the owner) moves into resolve_attach_target_version_gated so the
  record and socket handed to the SSH attach are testable without a
  live session shell.

The version-gate inventory now scans both verbs the client opens, so a
probe path cannot carry its gate decision — or skip it — unrecorded.
drive_answerer_until_serving still released its socket and rebound on
port 0 when the host refused its publication, and its comments claimed
that matched the routing proxies — which stopped doing that when their
publication learned to walk host ports of its own (NET-059). The
comments were the bug's last holdout.

The answerer now takes the proxies' walk: the socket keeps the
documented port it bound, serving its zone from the moment of the bind,
and a host port the host refuses is proposed one rung further up until
one is accepted; a pinned port has no rung and keeps retrying, and a
transient failure never moves. The state's discovery field reports the
port the host's resolver can actually reach — the published one, or the
bound one when nothing was published — and the log names the relocation
and the publication with both ports, beside the bind.

two_vms_hostnames_route_concurrently drives both halves of the host's
hostname surface now: alongside the routing proxies, each VM's answerer
binds the documented default on its own guest loopback, the first
publication holds that number on the host, the second walks to a rung,
and A queries through each published port answer that VM's own box and
say the other VM's is nobody's here — concurrently, each answerer never
having left the port it bound.
Both leashes discard the elapsed marker their timeouts produce; it
carries nothing the messages lack, so expect clippy::map_err_ignore at
the two sites, as session.rs already does for the same shape. The
answerer tests' refused_ports helper slices the log tail out by byte
index; split_once does it without the panic the string_slice lint
guards against.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 2 of 10 on a /revise note, pushed as 3826ab353ff4.

The coder ran out of its 7200s before it finished. If it left work uncommitted, its last commit is the runtime's snapshot of that work as it stood — the commit message says so — and not a finished step: it may not build or pass its tests.

line exit tail
cargo nextest run -p minimal ls_shows_vm_per_box 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-9347... Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/ab4d5/tree/crates/ot) Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/ab4d5/tree/crates/args) C
cargo nextest run -p minimal box_name_resolves_vm_without_flag 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-f2c1... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/92645/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/92645/tree/crate
cargo nextest run -p minimal-tui probes_every_named_vm 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-6619... Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/0c29d/tree/crates/args) Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/0c29d/tree/crates/ot) C
cargo nextest run -p minimald two_vms_hostnames_route_concurrently 0 Applying loadouts: default Running task runtime-implement-test-3 in session task-runtime-implement-test-3-3798... Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/da5ad/tree/crates/ot) Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/da5ad/tree/crates/args) C

Verify min task run agent-verify passed.

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

With two VMs running, ls shows the VM per box, attach finds the VM from the box name alone, and both VMs' box names route through the host at the same time; the expose verb's resolution of the VM is T53's.

@norrietaylor

Copy link
Copy Markdown
Member

/revise
Round 3 for T60 (#1670) on #1807. Round 2 met all five code asks. Your merge of main brought in T63 (#1788), and two items follow from it. Keep this round to these items:

  1. Reconcile the NET-059 comments with T63's handed ports. Rounds 0–2 asked for this: "make the box-zone answerer's comments match its code". After the merge, a VM boot reads its node ports from the boot line (crates/minimald/src/main.rs:552-557) and binds them as ProxyPort::Pinned, so reselects_when_publish_refused is false and the publication walk never runs on the VM path. Reword crates/minimald/src/server.rs:1165-1176 (the reselects_when_publish_refused doc), server.rs:1655-1663 (the drive_answerer_until_serving doc), and the doc of two_vms_hostnames_route_concurrently in crates/minimald/src/net/proxy.rs. They should say that, on a VM boot, each VM's distinct host ports come from minvmd's handed assignment (pinned, never walked), and that the walk covers boots with no handed port. Do not change the walk itself or anything outside these files.
  2. In crates/minimald/src/net/proxy.rs, add a test beside two_vms_hostnames_route_concurrently that drives two daemons the way T63 boots them: distinct ProxyPort::Pinned ports for each VM's hostname proxy and zone answerer. Assert that both publish at their pinned numbers, that neither logs relocated, and that each routes its own box (proxy request and zone query) concurrently while refusing the other VM's box.
  3. Tighten the r2 ask 4 proof on min ls. That ask's original scope was: "For non-selected VMs, treat ECONNREFUSED as "not running", with no 2 s connect retry and no warning: skipping VM line." In crates/minimal/src/tests.rs, add a min ls case with the selected VM running and one stopped VM only (a dropped UnixListener's leftover ssh.sock, no wedged VM). Assert that cmd::ls_listings returns only the running VM in under 1 s, mirroring a_stopped_vm_does_not_hold_a_box_name_resolution. The existing 8 s bound in ls_leashes_the_vms_it_did_not_select cannot tell a 2 s retry apart from no retry.
  4. Do not edit crates/minvmd/**. If you think minvmd's node-port probe (assign_node_port, which probes 0.0.0.0) can hand two VMs the same proxy port on macOS, say so in your round notes, and do not fix it here.

Reconcile NET-059's comments with T63's handed ports: a VM boot now
reads its node ports off the boot line and binds them as pinned, so each
VM's distinct host ports come from minvmd's handed assignment and the
publication walk never runs on the VM path. The reselects_when_publish_
refused and drive_answerer_until_serving docs and the walking test's
doc now say so, and name the boots the walk still covers: no handed
port — an older minvmd, a native run, a host that handed 0.

Beside the walking test, drive two daemons the way T63 boots them:
distinct pinned proxy and answerer ports per VM. Both publish at
exactly the numbers they were handed, neither logs a relocated line,
and each routes its own box — proxy request and zone query — through
the host concurrently while refusing the other VM's.
The stopped-VM half of the ls leash, under the bound that proves the
ask: with no wedged VM in the picture, a stopped VM's stale ssh.sock
is ECONNREFUSED on one probe attempt — not running, no 2 s connect
retry, no warning — so cmd::ls_listings returns only the running VM
in under 1 s. The wedged test's 8 s bound cannot tell a 2 s retry
from none; this mirrors the resolution path's own one-second proof,
a_stopped_vm_does_not_hold_a_box_name_resolution.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 3 of 10 on a /revise note, pushed as 3652946bd358.

line exit tail
cargo nextest run -p minimal ls_shows_vm_per_box 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-2fdb... Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/e3d18/tree/crates/ot) Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/e3d18/tree/crates/args) C
cargo nextest run -p minimal box_name_resolves_vm_without_flag 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-bf8c... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/30374/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/30374/tree/crate
cargo nextest run -p minimal-tui probes_every_named_vm 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-5843... Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/eaa84/tree/crates/args) Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/eaa84/tree/crates/ot) C
cargo nextest run -p minimald two_vms_hostnames_route_concurrently 0 Applying loadouts: default Running task runtime-implement-test-3 in session task-runtime-implement-test-3-e854... Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/75a2a/tree/crates/ot) Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/75a2a/tree/crates/args) C

Verify min task run agent-verify passed.

On a two-VM host — including two VMs booted the way T63 boots them, each handed its own pinned node ports — the NET-059 comments now match the code (a handed, pinned publication never walks; the walk covers only boots with no handed port), a new test proves both VMs publish at exactly their handed numbers with no relocated line and route their own boxes through the host concurrently while refusing each other's, and min ls past a stopped VM returns only the running VM in under a second, so a 2 s connect retry is no longer possible to miss beside no retry.

Notes from the agent: Directive item 4 (minvmd, untouched): yes, assign_node_port can hand two VMs the same proxy port — through a window, not a macOS bind quirk. The probe binds 0.0.0.0: and releases it, and the host port is only held later, when gvproxy's forwarder binds 127.0.0.1: at the first VM's publication; the guest binds inside its own netns in between. Two VMs booted inside that window each get the default 7654/7656, on macOS exactly as on Linux — the probe's own comment names the lost race. A VM booted after the first one's surface is up does get a distinct port: a wildcard bind on macOS conflicts with a held 127.0.0.1 binding there as on Linux (std sets no SO_REUSEADDR on Unix), so the probe fails and falls back to an OS-picked port. What changed is the consequence: since T63 a lost race no longer self-heals, because a refused pinned publication never walks — it retries 'unavailable' for the daemon's lifetime while the host's box table still names the handed port. The fix belongs in minvmd (hold the probe binding until the guest publishes, or keep a per-host registry of handed ports), which this round leaves alone per the directive. Also this round: cargo clippy -p minimald --all-targets --locked -- -D warnings and cargo clippy -p minimal --all-targets --locked -- -D warnings both clean; cargo fmt --check -p minimald -p minimal clean after one rustfmt pass committed sep…[truncated]

@norrietaylor

Copy link
Copy Markdown
Member

/revise
Round 4: the architecture review's conditions on T60. Rounds 1–3 stay as they are; do not undo any of them.

  1. Refuse an ambiguous attach; never pick one. When min session attach <box> falls through and more than one VM's daemon knows the box name, error out. List every VM that knows it and ask for an explicit VM or provider (the existing global VM selector). Never take the first VM that answers. When exactly one VM knows the name, keep today's fall-through and its announcement. The shared resolution in crates/minimal/src/attach.rs carries this, so expose inherits it once T53 lands. Add a test, for example attach_refuses_a_box_name_two_vms_know: the same box name on two VMs gives an error naming both, and no attach.
  2. Never walk a port silently. This applies only to a boot with no handed port (older minvmd, a native run, a host that handed 0) whose daemon publishes on a host port of its own after the default is refused. Report the walked host port to the user:
    • at session start: one line naming the VM and the real proxy port;
    • on that VM's min ls routing line, so a PAC file or URL points at the real port.
      A log line alone is not enough. If the walk already reaches both surfaces, say where in the round notes and add a test that pins it, for example walked_proxy_port_reported_at_start_and_in_ls. Handed, pinned ports keep never walking.
  3. No address reuse on the proxy's real bind. The hostname proxy's listener (and the zone answerer's TCP listener, if any) must bind without SO_REUSEADDR and SO_REUSEPORT. A duplicate handed port then fails loudly at bind, as item 2's surfaced error, instead of letting two VMs share a port where one VM's proxy answers for the other VM's names. Rust std and tokio set SO_REUSEADDR on Unix TCP listeners, so build the socket explicitly (socket2, or tokio::net::TcpSocket with set_reuseaddr(false)). Add a test, for example proxy_bind_refuses_a_port_already_held_on_loopback: with a listener held on 127.0.0.1:p, binding the proxy on p fails on both macOS and Linux. Scope: the in-VM and native daemon proxy bind in crates/minimald only. Do not edit crates/minvmd/**; the assignment fix is #1814.

Keep every other file as it is. Do not rewrite the PR body; it is maintained by hand.

@minimal-foundry

minimal-foundry Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Reviewed: 1 finding, none blocking at 73e7f9814bda.

Address the comments on the diff.

Clobber: none: git log on list.rs and proxy.rs shows the pre-existing walk/republish logic was intentionally replaced, not reverted (the reserved-label fix in rpc.rs at head 73e7f981 explicitly addresses the one unresolved review thread).

@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 — approved

Verdict APPROVE — No findings.

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Oct 2, 2026
The listener is no longer the socket TcpListener::bind builds: it is
built with TcpSocket, with SO_REUSEADDR explicitly off and mio's
backlog kept, so neither reuse option is ever set. tokio sets
SO_REUSEADDR on every Unix TCP listener by default, and a reuse
option is the licence to share or shadow a port another holder has
— one VM's proxy answering for the other VM's names — where the
rule this daemon ships is the opposite: two daemons on one host
meet on one port number only through the walk the publication
takes, and a duplicate handed port fails loudly at bind, as the
surfaced error the caller's report carries, instead of binding
beside its holder. The test reads both options off a bound socket
with getsockopt, because a refused second bind cannot tell a set
option from an unset one: the pin is the kernel's own answer for
the socket's options, on both platforms this daemon runs on.
The create reply already carried the port this daemon's hostnames
route through, and `min ls` already printed it; a session start now
prints the same fact beside the routing-down warning it already
prints — one line naming the VM on the VM backend, where on a
two-VM host it says whose port is whose, and reading word for word
as `min ls`'s single-daemon routing line on the native backend.

That is the case the line exists for: a boot with no handed port
whose proposed host port was held publishes on a host port of its
own (NET-059) — a handed one is pinned and keeps proposing the port
it was given — and a native daemon whose default was busy asks the
OS for a free one (NET-025). Either way the port the recipes assume
is not the one in use, so a walked port is never a log line alone:
the address a PAC file or an HTTP(S)_PROXY export points at lands
on both surfaces the operator reads. Absent while the proxy is
still coming up, or from a daemon that predates the field, exactly
as in `min ls`.
Two tests the architecture review's conditions asked for:

- attach_refuses_a_box_name_two_vms_know: the same box name on two
  VMs, with the selected VM a third that does not know it, is
  refused by the fall-through with an error naming both VMs and
  pointing at `--vm` — never resolved to the first VM that answers,
  and no record or socket comes back for the ssh hand-off to run
  over. The refusal the shared resolution carries is the exposed
  verb's too, once that lands.
- walked_proxy_port_reported_at_start_and_in_ls: the walked rung is
  the port on `min ls`'s routing line for the VM that walked, the
  session-start line names the same VM and the same port, and the
  native start line is the single-VM routing line word for word —
  while the port the recipes assume appears nowhere on the walked
  VM. The daemon-side half, the rung landing in the reported field
  these surfaces render, stays pinned by
  two_vms_hostnames_route_concurrently in minimald.
The connection inventory is what stops a new `Client::connect` from
landing ungated, and it scans tests.rs too — the refusal test's
connection to the selected daemon is a connection all the same. It
drives `resolve_attach_target_version_gated`, the gated path, so the
label records what the test asserts; the comment now says the same of
both fall-through tests.

@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 crates/minimald/src/net/proxy.rs Resolved
@minimal-foundry minimal-foundry Bot removed the review:approved minimal-review approved the current head label Oct 2, 2026
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 4 of 10 on a /revise note, pushed as a3de7ff68504.

line exit tail
cargo nextest run -p minimal ls_shows_vm_per_box 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-3c79... Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/d4a37/tree/crates/args) Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/d4a37/tree/crates/ot) C
cargo nextest run -p minimal box_name_resolves_vm_without_flag 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-4ec4... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/ce510/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/ce510/tree/crate
cargo nextest run -p minimal-tui probes_every_named_vm 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-0dc2... Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/c04a2/tree/crates/args) Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/c04a2/tree/crates/ot) C
cargo nextest run -p minimald two_vms_hostnames_route_concurrently 0 Applying loadouts: default Running task runtime-implement-test-3 in session task-runtime-implement-test-3-f83e... Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/53804/tree/crates/ot) Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/53804/tree/crates/args) C

Verify min task run agent-verify passed.

With two VMs running, min ls shows the VM per box and attach finds the VM from the box name alone — and now, when two VMs' daemons both know the name the selected VM does not, attach refuses it, naming every VM that knows it and pointing at --vm, rather than landing in whichever VM answered first — while both VMs' box names route through the host at the same time, each on a host port of its own that is printed both at session start (naming the VM) and on min ls's routing line, and the proxy's listener now binds without SO_REUSEADDR or SO_REUSEPORT, so a port another daemon already holds fails loudly at bind as the surfaced error both reports carry; the expose verb's resolution of the VM is T53's.

Notes from the agent: The three directive conditions, and where each landed: (1) the ambiguous-attach refusal was already in attach::resolve_box_vm (names every VM that knows the name, points at --vm — the existing global VM selector — and propagates out of resolve_attach_target_version_gated, so no record or socket comes back for the hand-off); this round pins it on the attach path itself with attach_refuses_a_box_name_two_vms_know, whose selected VM is a third VM that does not know the name, since that is what sends attach through the fall-through. The single-owner fall-through and its announcement are untouched (attach_fall_through_hands_off_the_owning_vm still passes). The connection-inventory test scans tests.rs too, so the new test's own Client::connect had to be classified — its entry is in its own commit. (2) Where the walk already reached both surfaces: min ls already carried it (rounds 1–3 — record_serving stores the published rung and format_ls/format_ls_across_vms print it); session start did not, so activate_session now prints hostname_proxy_start_line beside the routing-down warning it already printed — naming the VM on the VM backend, and reading word for word as min ls's single-daemon routing line on the nativ…[truncated]

@norrietaylor

Copy link
Copy Markdown
Member

/revise

Round 4's C2 is met: the walked port is printed at session start and in ls, with walked_proxy_port_reported_at_start_and_in_ls. C1's refusal test is present. One change remains, and it supersedes round 4's ask about the reuse options.

  1. Restore the platform-default bind for minimald's hostname proxy.
    • In crates/minimald/src/net/proxy.rs, remove bind_without_reuse. bind_listener binds through TcpListener::bind again, which sets SO_REUSEADDR on Unix. Never set SO_REUSEPORT.
    • Why: on Linux, SO_REUSEADDR never lets a second socket listen on an address:port an active listener holds. Its only effect is that a restart can rebind over TIME_WAIT connections.
    • Without it, native-daemon-e2e fails (run 37035644090): after a daemon restart, 127.0.0.1:7654 gives "Address already in use (os error 98)", the proxy is unbound, and the NET-001 curl exits 7. A native daemon could also silently move off its documented port.
    • The two-VM shadowing case is the macOS host-side forwarded port in minvmd, which #1814 owns. minimald on macOS always binds inside the guest's namespace, where two VMs never meet.
    • Keep proxy_bind_refuses_a_port_already_held_on_loopback, adjusted so it asserts that a second bind on a held, listening port fails with EADDRINUSE and is surfaced, and that SO_REUSEPORT is off on the bound socket. Drop the SO_REUSEADDR-off assertion.
    • Rewrite the doc comments that justify the no-reuse bind to say this instead.
    • Evidence required: native-daemon-e2e green at the new head.

bind_listener binds through TcpListener::bind again: SO_REUSEADDR on
Unix, never SO_REUSEPORT. On Linux, SO_REUSEADDR never lets a second
socket listen on an address:port an active listener holds — a port
another daemon holds is still refused with EADDRINUSE, as the surfaced
failure the reports carry — so its one effect is the one the native
daemon needs: a restart can rebind over the TIME_WAIT sockets the
previous run's accepted connections left, keeping the documented
127.0.0.1:7654 instead of failing the rebind with EADDRINUSE and moving
off it (native-daemon-e2e, run 37035644090).

The rule that two VMs never shadow one host port is not this bind's to
carry: a microVM daemon binds inside its guest's own netns, where the
two never meet, and the host-side forwarded port they do share is
minvmd's bind (#1814). bind_without_reuse and its
hand-built socket are gone, with the doc comments rewritten to say the
platform-default rule and where the no-shadow rule lives now. The
pinned test keeps the EADDRINUSE refusal and the SO_REUSEPORT-off read
off the bound socket, and drops the SO_REUSEADDR-off pin the restored
default makes wrong.
The restored platform default is what makes a native daemon restart
keep the documented port: the previous run's accepted connections
leave their sockets in TIME_WAIT on it, and SO_REUSEADDR is the one
licence Linux gives to rebind over those. The test builds that leftover
(one accepted connection the listener's side closed first), proves the
TIME_WAIT tuple is really held by refusing a no-reuse bind on it — the
hand-built socket bind_without_reuse used to make, since both std's
and tokio's TcpListener::bind set the option on Unix and cannot serve
as the control — then asserts the daemon's bind retakes the same port
with SO_REUSEADDR on, the shape the native e2e's restart needs
(run 37035644090 failed exactly here behind the no-reuse bind).
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 5 of 10 on a /revise note, pushed as 27062c7ea6bb.

line exit tail
cargo nextest run -p minimal ls_shows_vm_per_box 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-66b8... Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/131ba/tree/crates/args) Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/131ba/tree/crates/ot) C
cargo nextest run -p minimal box_name_resolves_vm_without_flag 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-a72e... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/c1f9f/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/c1f9f/tree/crate
cargo nextest run -p minimal-tui probes_every_named_vm 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-6952... Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/d178e/tree/crates/args) Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/d178e/tree/crates/ot) C
cargo nextest run -p minimald two_vms_hostnames_route_concurrently 0 Applying loadouts: default Running task runtime-implement-test-3 in session task-runtime-implement-test-3-3f69... Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/4ff58/tree/crates/ot) Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/4ff58/tree/crates/args) C

Verify min task run agent-verify passed.

Review threads the coder judged:

  • 👍 valid — crates/minimald/src/net/proxy.rs: bind_listener binds through TcpListener::bind again, so the native daemon's restart rebinds 127.0.0.1:7654 over TIME_WAIT instead of failing EADDRINUSE and relocating; the no-reuse build is gone, the refusal test keeps the EADDRINUSE and SO_REUSEPORT-off pins, and the restart rebind is pinned by pro

minimald's hostname proxy binds through TcpListener::bind again — SO_REUSEADDR on Unix, SO_REUSEPORT never set — so a native daemon restarted in place rebinds 127.0.0.1:7654 over the TIME_WAIT sockets its previous run's accepted connections left and keeps its documented port, while a port another live listener holds is still refused with EADDRINUSE and surfaced in min ls and min session activate; the restart rebind is pinned by a new unit test whose control bind (SO_REUSEADDR off, the hand-built socket the removed code used) is refused on the same port, proving the TIME_WAIT tuple is real.

Notes from the agent: Round 5's one change, in crates/minimald/src/net/proxy.rs only (the daemon layer's file): removed bind_without_reuse and its LISTEN_BACKLOG hand-build, so bind_listener binds through TcpListener::bind again; rewrote the doc comments that justified the no-reuse bind (bind_listener's doc and the refusal test's doc) to state the platform-default rule — SO_REUSEADDR never lets a second socket listen beside an active holder on Linux, its one effect is the restart rebind over TIME_WAIT — and that the two-VM no-shadow rule is minvmd's host-side forwarded-port bind (#1814), not this daemon's. Kept proxy_bind_refuses_a_port_already_held_on_loopback with the directive's shape: held-listening-port refusal fails with EADDRINUSE and is surfaced, SO_REUSEPORT is read off the bound socket and pinned off, the SO_REUSEADDR-off assertion is dropped. Added proxy_bind_rebinds_over_the_time_wait_a_restart_leaves as the local pin of the exact CI failure (native-daemon-e2e run 37035644090): it drives one accepted connection into TIME_WAIT, proves the tuple is held by refusing a no-reuse bind on it — std's TcpListener::bind also sets SO_REUSEADDR on Unix, so the control must be a TcpSocket with the option explicitly off — then asserts bind_listener retakes the same port with SO_REUSEADDR on. The directive's required evidence, native-daemon-e2e green at the new head,…[truncated]

@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 crates/minimal-tui/src/rpc.rs Resolved
@norrietaylor

Copy link
Copy Markdown
Member

/revise Round 6: round 5 is met (platform-default bind restored, restart rebind test, native-daemon-e2e green). Two small asks, scope unchanged:

  1. Stale base. The branch conflicts with main again after the latest merges. Merge origin/main and resolve the conflicts keeping both sides' behaviour; rerun the plan's test lines.
  2. LOW thread on vm_label (crates/minimal-tui/src/rpc.rs:49-54). Verify first. If it holds, a named VM called host or vm must not collide with HOST_LABEL/DEFAULT_VM_LABEL: either make connect_missing dedup by socket alone except for the macOS host/default-VM same-socket case, or give named VMs a label that cannot equal the reserved ones. Add a test with a VM named host and one named vm that both reach the provider list. Reply on the thread with what you did.

…xes-across-two-vms-by-name-without-a-g

Resolve the T15/NET-018 live-name-surface work against this branch's
multi-VM listing and per-VM host publications:

- min ls keeps the multi-VM listing (NET-057) and gains NET-018's
  name-surface verdict, one per VM from one shared host read, because
  on a two-VM host the resolver hook routes the zone to one VM's
  answerer (NET-059): the resolver's singular verdict became
  live_name_surfaces, which pays the list's one-second detection once
  for every VM's verdict, and format_ls_across_vms renders each VM's
  NAME SURFACE line beside its per-VM routing facts. One VM listed
  stays byte-for-byte the single-VM listing.
- the answerer driver still records the port the host's resolver
  reaches — the walked publication's when the default was held — and
  NET-018's observability line now logs that reached port, so the log
  and the discovery field never name two ports for one answerer.

All four plan test lines and T15's NET-018 tests pass on the merge.
A VM whose own name is one of the two reserved sidebar labels — both
valid per paths::validate_vm_name — took the identity of the provider
that label already belongs to: connect_missing skips any candidate
whose label a connected provider carries, so a VM named host was never
(re)connected once the host daemon was up and a VM named vm while the
default VM was connected, and the dashboard — which keys refresh,
attach, and the saved state by label alone — would conflate the two
even without the skip.

vm_label now escapes such a name into the VM side's namespace
(vm:host, vm:vm), which no VM name can spell since validate_vm_name
admits no colon, so no two providers ever share a label and every VM
reaches the provider list under its own group. Pinned beside the
probing test with a VM named host and one named vm, each keeping a
candidate and a label no other candidate carries.

@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 crates/minimal/src/cmd/list.rs Resolved
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 6 of 10 on a /revise note, pushed as 73e7f9814bda.

Resolved conflicts in: crates/minimal/src/cmd/list.rs, crates/minimald/src/server.rs

line exit tail
cargo nextest run -p minimal ls_shows_vm_per_box 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-f980... Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/14173/tree/crates/args) Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/14173/tree/crates/ot) C
cargo nextest run -p minimal box_name_resolves_vm_without_flag 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-dc37... Compiling stdlib v0.0.21 (/home/runner/.local/state/minimal/sessions/12319/tree/crates/stdlib) Compiling version v0.7.0 (/home/runner/.local/state/minimal/sessions/12319/tree/crate
cargo nextest run -p minimal-tui probes_every_named_vm 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-5f1b... Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/ec3e1/tree/crates/args) Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/ec3e1/tree/crates/ot) C
cargo nextest run -p minimald two_vms_hostnames_route_concurrently 0 Applying loadouts: default Running task runtime-implement-test-3 in session task-runtime-implement-test-3-0ee8... Compiling args v0.0.1 (/home/runner/.local/state/minimal/sessions/89c92/tree/crates/args) Compiling ot v0.0.1 (/home/runner/.local/state/minimal/sessions/89c92/tree/crates/ot) C

Verify min task run agent-verify passed.

Outside the task's layers::

  • crates/minimal/src/resolver.rs

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

Review threads the coder judged:

  • 👍 valid — PRRT_kwDOPdfcxM6ocB_q: Verified it holds: both names pass validate_vm_name, and connect_missing:156 skips on the label match while app.rs keys refresh/attach/saved state by label alone. Fixed by escaping the reserved names in vm_label into the VM namespace (vm:host, vm:vm — no VM name can spell those, validate_vm_name adm (not posted on the thread: not an open thread on the pull request)

With two VMs running, min ls shows the VM per box and — merged from main — each VM's own NET-018 NAME SURFACE verdict beside its routing facts (one VM native, its sibling proxy, from one shared host read), attach finds the VM from the box name alone, both VMs' box names route through the host at the same time with the answerer's log naming the port the host's resolver actually reaches, and a VM named host or vm keeps its own provider group in the dashboard instead of vanishing behind the reserved labels; the expose verb's resolution of the VM stays T53's.

Notes from the agent: Round 6, both asks done in two commits (the merge commit, then the TUI fix). (1) Stale base: merged origin/main (T15/NET-018+NET-019, #1802) and resolved both conflicts keeping both sides' behaviour — cmd_ls keeps the branch's per-VM warnings and multi-VM listing and now computes main's verdict per VM via live_name_surfaces (the resolver's singular live_name_surface became the plural so the list's one-second detection is paid once for every VM's verdict, not once per VM; format_ls_across_vms renders a NAME SURFACE line per VM beside its per-VM routing facts, and one VM listed stays byte-for-byte the single-VM listing); minimald's answerer tail still records the port the host's resolver reaches (the walked publication's, NET-059) and main's log_live_name_surface now logs that same reached port. The merge itself carried main's own changes into files outside this task's layers — crates/minimal/src/cmd/session.rs, crates/minimal/src/resolver.rs, crates/minimal/tests/cli.rs, crates/minimald-rpc/src/lib.rs, crates/minimald/src/net/proxy.rs, crates/minimald/src/rpc.rs — all from main's commit or its signature fallout (resolver.rs's plural verdict and the src/tests.rs call-site updates are my resolution of that fallout, not new scope). (2) The LOW thread on vm_label: verified valid (both host and vm pass paths::validate_vm_name and connect_missing:156 skips on a label match, whi…[truncated]

@minimal-foundry
minimal-foundry Bot marked this pull request as draft October 2, 2026 19:15
@norrietaylor
norrietaylor marked this pull request as ready for review October 2, 2026 19:45

@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.

Round 6 meets every ask: main merged with one name-surface verdict per VM, vm_label collision fixed with a test, platform-default bind kept (SO_REUSEPORT off), ARCH C1/C2 tests intact, all lanes green.

@norrietaylor
norrietaylor added this pull request to the merge queue Oct 2, 2026
Merged via the queue into main with commit e6702bb Oct 2, 2026
34 checks passed
@norrietaylor
norrietaylor deleted the agent/1670-address-boxes-across-two-vms-by-name-without-a-g branch October 2, 2026 20:24
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.

T60 — Address boxes across two VMs by name without a global flag

2 participants