Skip to content

T112 — The hostname proxy takes its preferred port back when it frees, and min ls lists every port it serves - #2832

Merged
norrietaylor merged 9 commits into
mainfrom
agent/2709-the-hostname-proxy-takes-its-preferred-port-back
Nov 2, 2026
Merged

norrietaylor merged 9 commits into
mainfrom
agent/2709-the-hostname-proxy-takes-its-preferred-port-back

Conversation

@minimal-foundry

@minimal-foundry minimal-foundry Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

T112 — The hostname proxy takes its preferred port back when it frees, and min ls lists every port it serves

slice: S17
kind: task
covers: NET-150, NET-151, NET-154
size: L
est: 440 code, 240 tests
executor: agent
difficulty: needs care
model: strongest
diagnostics: the substitute-port warning and the reclaim line land in the VM host daemon's log, which min bug already collects; min ls shows the ports the proxy serves, so a person reads where to point a browser
observability: a warn line hostname proxy serving on a substitute port with fields preferred, skip_reason, port_holder and port; an info line hostname proxy reclaimed its preferred port with preferred and substitute; both in the VM host daemon's log
depends on:
- blocked by #2696
- blocked by #2705
layers:
- reclaim:
- crates/minvmd/src/net/proxy_reclaim.rs (new): watches the preferred proxy port while the proxy serves on a substitute; when the preferred port passes the same bind and loopback checks the assignment uses, it takes the reservation and asks the switch to publish 127.0.0.1:<preferred> to the guest proxy's port, so both ports serve without a VM restart; the substitute keeps serving; the node-port assignment's log line moves here and logs at warn whenever the preferred port was skipped
- crates/minvmd/src/net.rs: declares the new module
- crates/minvmd/src/cmd/run.rs: starts the watcher after the VM boots when the proxy's port is a substitute, and calls the moved assignment log
- crates/minvmd/src/control.rs: the control socket answers a proxy-ports request with every host port the proxy serves, the preferred first
test: cargo nextest run -p minvmd proxy_reclaims_preferred_port_when_free
test: cargo nextest run -p minvmd proxy_substitute_port_logs_warning
- listing:
- crates/minimald-rpc/src/lib.rs: the proxy-ports request and reply on the VM host control channel
- crates/minimal/src/cmd/session.rs: a client helper beside vm_host_answerer_status_at that reads the proxy ports from a VM's control socket
- crates/minimal/src/cmd/list.rs: the HOSTNAME PROXY row lists every port, listening on 127.0.0.1:7654 and 127.0.0.1:65264 as the HTTP proxy for <box>.min.internal names while both serve, and one port as today otherwise; --json carries "hostname_proxy_ports": [7654, 65264]
- crates/minimal/src/tests.rs: pins the one-port and two-port rows and the JSON field
test: cargo nextest run -p minimal ls_reports_every_proxy_port
produces: none
consumes: none
proof: With another process on port 7654 the VM's proxy starts on a substitute port and the VM host daemon's log warns which port it skipped and why; free 7654 and, without restarting the VM, http://web.min.internal:3000 opens through both ports and min ls lists both.

Proof

A VM whose proxy starts on a substitute port because another process holds 7654 now logs a warn line, hostname proxy serving on a substitute port, in the VM host daemon's log. The line carries preferred, skip_reason, port_holder and port. While the VM runs, a watcher probes 7654 every 5 seconds with the same bind and loopback checks the assignment uses. When 7654 is free, the watcher takes its reservation and asks the switch to publish 127.0.0.1:7654 to the guest proxy's substitute port. The substitute keeps serving, and the watcher logs hostname proxy reclaimed its preferred port. min ls then prints HOSTNAME PROXY: listening on 127.0.0.1:7654 and 127.0.0.1:65264 as the HTTP proxy for <box>.min.internal names, and min ls --json carries "hostname_proxy_ports": [7654, 65264]. The unit tests prove this with a real held port and a stand-in switch. Nobody on this box ran it against a real VM, so the browser half of the proof (http://web.min.internal:3000 through both ports) is not observed.

Notes from the agent: Outside the layers: a new BoxControlRequest::ProxyPorts and BoxControlReply::ProxyPorts each need one arm in an existing exhaustive match. The arms are in crates/minimald/src/rpc.rs (the native control socket refuses the verb like the other VM-host verbs) and crates/minimal-client/src/box_registration.rs (a registration that gets this reply fails). Without them those crates do not compile.

The spec excerpt in .implement/spec.md does not contain NET-150, NET-151 or NET-154. I worked from the task's layer notes and the observability line only.

This box has no libkrun, so run_foreground (where the watcher starts) is behind cfg(minvmd_libkrun) and the normal clippy run does not compile it. I type-checked it once with RUSTFLAGS="--cfg minvmd_libkrun" cargo check -p minvmd --lib in a separate target dir, and it passed. No VM end-to-end run was made.

Design points for review: (1) The reclaim publish is a host-side expose of 127.0.0.1:<pref…[truncated]

Tests

line exit tail
cargo nextest run -p minvmd proxy_reclaims_preferred_port_when_free 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-6a83... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling args v0.0.1 (/workbench/crates/args) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling client-config v0.0.1 (/wo
cargo nextest run -p minvmd proxy_substitute_port_logs_warning 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-17d7... Compiling version v0.8.0 (/workbench/crates/version) Compiling mlog v0.0.1 (/workbench/crates/mlog) Compiling minvmd v0.8.0 (/workbench/crates/minvmd) Finished 'test' profil
cargo nextest run -p minimal ls_reports_every_proxy_port 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-ee08... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling args v0.0.1 (/workbench/crates/args) Compiling client-config v0.0.1 (/wo

Verify

min task run agent-verify exited 100 under rustc 1.99.0, which the repository does not pin (1.99.1 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.

t_span_id": "77b16dd0b0e5b4e6",
                "span_id": "ae2147e028bc8bb2",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "GetDenyAllOptOut",
                "parent_span_id": "77b16dd0b0e5b4e6",
                "span_id": "aa3d2a6d20f1417c",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "GetPaths",
                "parent_span_id": "77b16dd0b0e5b4e6",
                "span_id": "c12a532b5319da98",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "77b16dd0b0e5b4e6",
                "queued_behind": "0",
                "span_id": "481e3d338a222c7c",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "77b16dd0b0e5b4e6",
                "queued_behind": "0",
                "span_id": "b6f80ba930dfd7c5",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "b6f80ba930dfd7c5",
                "span_id": "d92c5e0f9c142cda",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
    ]
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 3 tests still running
        PASS [   5.010s] ( 945/2991) minimal-client box_registration::tests::resume_timeout_goes_on_and_an_absent_host_fails_closed
        PASS [   4.309s] ( 946/2991) minimal-client tty_relay::tests::resume_after_drop_prints_line_and_nudges_winsize
        PASS [   6.219s] ( 947/2991) minimal-client box_registration::tests::a_silent_daemon_does_not_hold_the_exit_past_the_deadline
────────────
     Summary [  41.081s] 947/2991 tests run: 946 passed, 1 failed, 26 skipped
        FAIL [   2.798s] ( 944/2991) minimal::otel_cli exec_run_attach_and_task_run_share_the_commands_trace
warning: 2044/2991 tests were not run due to test failure (run with --no-fail-fast to run all tests, or run with --max-fail)
error: test run failed

Out of scope

These files are outside the task's layers:, so this PR is a draft:

  • crates/minimal-client/src/box_registration.rs
  • crates/minimald/src/rpc.rs

Residuals

  • #2837: the live macOS VM proof that replies on the reclaimed preferred port pass the egress gate (arch C1). The unit tests use a stand-in switch.

Closes #2709

The hostname proxy that starts on a substitute port now watches its
preferred port. When the port passes the assignment's checks, the
watcher takes its reservation and asks the switch to publish it to the
guest proxy, so both ports serve without a VM restart. The assignment
line moves to net::proxy_reclaim and logs at warn when the preferred
port was skipped. The control socket answers a proxy_ports read.
min ls reads the ports the VM's hostname proxy serves on from the VM
host daemon's control socket. The HOSTNAME PROXY row names both ports
while a reclaimed preferred port and the substitute serve, and --json
carries them as hostname_proxy_ports.
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

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

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5471c5e4-a3e3-4dd5-893f-4123d2cf7e19

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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Babysitter review of b883662 against T112. proxy_reclaim.rs watches the preferred port while the proxy serves on a substitute. Once the port is free it takes the reservation and asks the switch to publish it, without a VM restart. A failed publish warns once and then logs at debug, and a reclaim logs hostname proxy reclaimed its preferred port. The assignment line warns with skip_reason when the preferred port was skipped. min ls names every served port on the HOSTNAME PROXY row ("listening on 127.0.0.1:7654 and 127.0.0.1: …"), and --json carries hostname_proxy_ports. A daemon with no read prints exactly what it printed before. This matches the plan block's layers and test lines, and all lanes are green.

@norrietaylor
norrietaylor marked this pull request as ready for review November 1, 2026 07:20
@norrietaylor
norrietaylor requested a review from a team as a code owner November 1, 2026 07:20
@minimal-foundry

minimal-foundry Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor Author

Approved: every review thread resolved at 7ad1fe1e815a.

@norrietaylor resolved the last thread, which releases the approval this review had withheld.

Nothing to do.

@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 — 2 findings, 2 inline.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

Comment thread crates/minimal/src/cmd/list.rs Resolved
Comment thread crates/minvmd/src/cmd/run.rs Resolved

@minimal-arch minimal-arch Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

arch-review: CONDITIONS · 1 condition · the full ruling

The reclaim forward is outside the egress gate's publish ledger. Every other host-side forward is in it (SwitchMirrorBinder::bind). Section 7.1 line 244 says each forward the helpers bind comes from the records they hold. Line 254 says revocation unbinds the forward and ends its connections. The gate cannot do that for a forward it holds no record of. The publisher also accepts proxy already running with no record of who holds the listener. That fails open. Make the change in C1. The placement, the warn line and the min ls listing conform. The browser proof leg is still open.

Ruled at b883662 against gominimal/arch@8640f85e193d by claude-opus-5-5.

Comment thread crates/minvmd/src/cmd/run.rs Resolved
Comment thread crates/minvmd/src/cmd/run.rs Resolved
An unconfirmed publish or a port held after the start serves nothing the host can vouch for. The proxy-ports reply is now empty then, and the reclaim watcher does not take or publish the preferred port.
The --json listing now applies the same proxy-down verdict as the HOSTNAME PROXY row, on the single-VM and the multi-VM paths.

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

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

Comment thread crates/minimal/src/cmd/list.rs Resolved

@minimal-arch minimal-arch Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

arch-review: PASS_WITH_CONDITIONS · 1 condition · the full ruling

The change conforms to §7.1 lines 244, 254 and 264. The compare resolves the proxy-down items from the last ruling. The reclaim forward comes from the host's own records and reaches the same guest proxy. A pinned port never moves, and min ls names no port while the proxy is down. One leg of the proof is open: nobody ran the browser check through both ports on a real VM. C1 asks for that run, or for an issue that tracks it.

Ruled at dd0daf3 against gominimal/arch@8640f85e193d by claude-opus-5-5.

Comment thread crates/minvmd/src/cmd/run.rs Resolved
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 1 of 10 on the runtime's review findings, pushed as dd0daf3b4d52.

line exit tail
cargo nextest run -p minvmd proxy_reclaims_preferred_port_when_free 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-10ed... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling args v0.0.1 (/workbench/crates/args) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling client-config v0.0.1 (/wo
cargo nextest run -p minvmd proxy_substitute_port_logs_warning 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-11a6... Compiling version v0.8.0 (/workbench/crates/version) Compiling mlog v0.0.1 (/workbench/crates/mlog) Compiling minvmd v0.8.0 (/workbench/crates/minvmd) Finished 'test' profil
cargo nextest run -p minimal ls_reports_every_proxy_port 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-2fc5... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling args v0.0.1 (/workbench/crates/args) Compiling client-config v0.0.1 (/wo

Verify min task run agent-verify exited 100 under rustc 1.99.0, which the repository does not pin (1.99.1 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.

t_span_id": "ffd5dd91ccb9d638",
                "span_id": "7f5b3be51129c919",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "GetDenyAllOptOut",
                "parent_span_id": "ffd5dd91ccb9d638",
                "span_id": "45bf803f0cda4946",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "GetPaths",
                "parent_span_id": "ffd5dd91ccb9d638",
                "span_id": "9a2cdce6327e95e7",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "ffd5dd91ccb9d638",
                "queued_behind": "0",
                "span_id": "7812568c15e157af",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "ffd5dd91ccb9d638",
                "queued_behind": "0",
                "span_id": "2afb7c7157cd0ca7",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "2afb7c7157cd0ca7",
                "span_id": "7f5a24c5a7edb4f2",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
    ]
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 3 tests still running
        PASS [   5.007s] ( 945/2993) minimal-client box_registration::tests::resume_timeout_goes_on_and_an_absent_host_fails_closed
        PASS [   4.296s] ( 946/2993) minimal-client tty_relay::tests::resume_after_drop_prints_line_and_nudges_winsize
        PASS [   6.058s] ( 947/2993) minimal-client box_registration::tests::a_silent_daemon_does_not_hold_the_exit_past_the_deadline
────────────
     Summary [  40.060s] 947/2993 tests run: 946 passed, 1 failed, 26 skipped
        FAIL [   3.235s] ( 944/2993) minimal::otel_cli exec_run_attach_and_task_run_share_the_commands_trace
warning: 2046/2993 tests were not run due to test failure (run with --no-fail-fast to run all tests, or run with --max-fail)
error: test run failed

Outside the task's layers::

  • crates/minimal-client/src/box_registration.rs
  • crates/minimald/src/rpc.rs

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

Review threads the coder judged:

  • 👍 valid — crates/minimal/src/cmd/list.rs:1148: insert_proxy_ports now takes the answerer's proxy_down and goes through serving_proxy_port, the same as the text row. Both the single-VM and the multi-VM --json paths pass it. ls_reports_every_proxy_port pins that a down proxy has no hostname_proxy_ports.
  • 👍 valid — PRRT_kwDOPdfcxM6yYKu-: serving_ports() now returns nothing while a down cause is recorded (unconfirmed or held after start). The watcher's take is wrapped in take_while_serving, so it does not reserve or publish the preferred port until a confirm clears the cause, and never after a late port-held report. (not posted on the thread: not an open thread on the pull request)

With another process on port 7654, the VM's proxy starts on a substitute port, and the VM host daemon's log warns which port it skipped and why. Free 7654 and the watcher publishes it beside the substitute without a VM restart, so http://web.min.internal:3000 opens through both ports and min ls lists both. A proxy that the VM host reports as down or unconfirmed now names no port in the min ls row, in --json, or in the control socket's proxy-ports reply.

Notes from the agent: Revise round 1. The run_foreground path compiles only with the minvmd_libkrun cfg. This box has no libkrun, so I type-checked it with cargo rustc -p minvmd --lib --profile=check -- --cfg minvmd_libkrun, and it passed. No test exercises the gated watcher inside run_foreground on this box. The new unit test covers take_while_serving and serving_ports. The merge of origin/main was already committed on the branch before this round.

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 1, 2026 07:42
@norrietaylor

Copy link
Copy Markdown
Member

/revise Arch C1 and two review findings on b883662.

  1. Arch C1 (crates/minvmd/src/cmd/run.rs proxy_reclaim_publisher, lines 2881 and 2891): note the reclaim forward in the egress gate's publish ledger before you post the expose, as SwitchMirrorBinder::bind does.
    • Pass it the BoxTable (boxes) and call mirror_ledger(). Note listener 127.0.0.1, port <preferred>, dialling daemon_ip() at <substitute>.
    • MirrorLedger::note_bind in crates/minvmd/src/net/egress_gate.rs keys the inside port to the listener port today. Give it, or a new note_forward, a separate inside port.
    • A stopped gate, HeldElsewhere or Full returns Err, so the attempt is ReclaimAttempt::PublishFailed and the reservation drops.
    • Accept SWITCH_ALREADY_BOUND (proxy already running) as success only when the note returned Ok(false). Otherwise it is Err. Call forget_bind when the expose fails.
    • Extend proxy_reclaims_preferred_port_when_free to attach a ledger (the test helper beside MirrorLedger) and assert the forward is noted. Add a case where the switch answers proxy already running with no note, and assert the watcher does not record the port.
  2. Review MEDIUM (crates/minimal/src/cmd/list.rs:1141 insert_proxy_ports): the JSON must agree with the text row. When the VM host daemon reports the proxy down, serving_proxy_port(.., proxy_down) is None, so write no hostname_proxy_ports either. Pin it in ls_reports_every_proxy_port.
  3. Review LOW (run.rs:1572): start the reclaim watcher and record the served ports only for a publish that is confirmed, not UpUnconfirmed. A later ProxyPortHeld that calls set_down must also stop the watcher and clear the recorded ports, so the control socket never names ports for a proxy that is down.

Run this task's test lines.

The reclaim publisher now notes 127.0.0.1:<preferred> -> node:<substitute>
in the gate's publish ledger before the expose, as the node mirror's binds do.
A refused note fails the attempt. 'proxy already running' counts only when
the ledger already held the same forward, and a failed expose drops the note.
MirrorLedger gains note_forward, which takes a separate inside port.
The --json listing now reads each VM's answerer status, so the
proxy-down verdict that hides the HOSTNAME PROXY ports also leaves
hostname_proxy_ports out of the document.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 2 of 10 on a /revise note, pushed as 8fc6ea8670c3.

line exit tail
cargo nextest run -p minvmd proxy_reclaims_preferred_port_when_free 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-03c5... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling args v0.0.1 (/workbench/crates/args) Compiling client-config v0.0.1 (/wo
cargo nextest run -p minvmd proxy_substitute_port_logs_warning 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-cdce... Compiling version v0.8.0 (/workbench/crates/version) Compiling mlog v0.0.1 (/workbench/crates/mlog) Compiling minvmd v0.8.0 (/workbench/crates/minvmd) Finished 'test' profil
cargo nextest run -p minimal ls_reports_every_proxy_port 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-5c0d... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling args v0.0.1 (/workbench/crates/args) Compiling client-config v0.0.1 (/wo

Verify min task run agent-verify exited 100 under rustc 1.99.0, which the repository does not pin (1.99.1 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.

t_span_id": "bf41f2f57a5baa5d",
                "span_id": "57df409da81e547b",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "GetDenyAllOptOut",
                "parent_span_id": "bf41f2f57a5baa5d",
                "span_id": "09d4602ff7d1d9bb",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "GetPaths",
                "parent_span_id": "bf41f2f57a5baa5d",
                "span_id": "37acba15817775d4",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "bf41f2f57a5baa5d",
                "queued_behind": "0",
                "span_id": "c7a163e3f3427eda",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "bf41f2f57a5baa5d",
                "queued_behind": "0",
                "span_id": "0a150ea6e1e59b8e",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "0a150ea6e1e59b8e",
                "span_id": "4c1111ccfe8fdf79",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
    ]
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 3 tests still running
        PASS [   5.010s] ( 945/2994) minimal-client box_registration::tests::resume_timeout_goes_on_and_an_absent_host_fails_closed
        PASS [   4.339s] ( 946/2994) minimal-client tty_relay::tests::resume_after_drop_prints_line_and_nudges_winsize
        PASS [   6.105s] ( 947/2994) minimal-client box_registration::tests::a_silent_daemon_does_not_hold_the_exit_past_the_deadline
────────────
     Summary [  41.336s] 947/2994 tests run: 946 passed, 1 failed, 26 skipped
        FAIL [   2.963s] ( 944/2994) minimal::otel_cli exec_run_attach_and_task_run_share_the_commands_trace
warning: 2047/2994 tests were not run due to test failure (run with --no-fail-fast to run all tests, or run with --max-fail)
error: test run failed

Outside the task's layers::

  • crates/minimal-client/src/box_registration.rs
  • crates/minimald/src/rpc.rs
  • crates/minvmd/src/net/egress_gate.rs

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

Review threads the coder judged:

  • 👍 valid — crates/minvmd/src/cmd/run.rs:2895: proxy_reclaim_publisher takes boxes.table(), notes the forward via the new MirrorLedger::note_forward (127.0.0.1: -> daemon_ip:) before the expose, returns Err on a refused note, and calls forget_bind when the expose fails.
  • 👍 valid — crates/minvmd/src/cmd/run.rs: 'proxy already running' is success only when note_forward returned Ok(false). Otherwise it is Err (PublishFailed). Pinned by proxy_reclaims_preferred_port_when_free_not_on_a_listener_held_elsewhere.
  • 👍 valid — crates/minimal/src/cmd/list.rs:870: cmd_ls now reads the answerer status for --json too (only --raw skips it), so the proxy-down verdict reaches insert_proxy_ports in the real command. Detection queries are still skipped in --json.
  • 👍 valid — crates/minvmd/src/cmd/run.rs: Removed the unproven claim from the doc comment. The forward is now noted in the gate ledger, and the test asserts the note. The real-VM run is still owed: this box has no VM lane and cannot file issues, so a person must run the T112 proof or file the issue.

When another process holds port 7654, the VM's proxy starts on a substitute port and the VM host daemon's log warns which port it skipped and why. When 7654 frees, the watcher notes the 127.0.0.1:7654 forward in the egress gate's ledger, asks the switch to publish it, and the control socket and min ls (text and --json) list both ports. The unit tests show this against a stand-in switch. No real VM ran on this box.

Notes from the agent: Revise round 2. Arch C1: proxy_reclaim_publisher now takes the BoxTable, notes the forward with a new MirrorLedger::note_forward (separate inside port), fails on a stopped gate or a refused note, accepts 'proxy already running' only when the note returned Ok(false), and calls forget_bind when the expose fails. Out of scope: crates/minvmd/src/net/egress_gate.rs is not in the task's layers. The directive asked for the note_forward change there, so I made it (note_bind now delegates to note_forward with inside = port). Review MEDIUM (item 2) and LOW (item 3) were addressed in round 1 (f933def, dd0daf3). This round also makes min ls --json read the answerer status, so the proxy-down check in insert_proxy_ports takes effect in the real command. Not done: the T112 proof on a real VM. This box has no VM lane, and I have no credential to file an issue. A person must run it (just e2e or a manual boot with 7654 held) or file the issue. commitlint: f933def and dd0daf3 have body lines over 100 characters. I cannot rewrite commits already on the branch, so that check stays red until someone squashes or rewords them at merge. The new commits keep body lines under 100.

@norrietaylor

Copy link
Copy Markdown
Member

/revise One review finding on 8fc6ea8 (thread at crates/minimal/src/cmd/list.rs:870).

insert_proxy_ports takes the proxy-down verdict from vm_answerer. But cmd_ls leaves vm_answerers empty when --json is set (list.rs:639), so in the real command the check never runs, and the doc comment claims a guard that does not exist. The JSON is correct today only because the daemon's serving_ports returns no ports while a down cause is set (f933def).

Drop the verdict parameter from insert_proxy_ports, and say in its doc comment that the VM host daemon reports no ports while the proxy is down. Keep ls_reports_every_proxy_port asserting that a down proxy has no hostname_proxy_ports, driven by an empty served list. Run this task's test lines.

cmd_ls reads no VM answerers for --json, so the verdict check never ran.
The VM host daemon reports no ports while the proxy is down, and the
empty served list leaves hostname_proxy_ports out.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

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

line exit tail
cargo nextest run -p minvmd proxy_reclaims_preferred_port_when_free 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-5ed9... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling args v0.0.1 (/workbench/crates/args) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling client-config v0.0.1 (/wo
cargo nextest run -p minvmd proxy_substitute_port_logs_warning 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-8c7f... Compiling version v0.8.0 (/workbench/crates/version) Compiling mlog v0.0.1 (/workbench/crates/mlog) Compiling minvmd v0.8.0 (/workbench/crates/minvmd) Finished 'test' profil
cargo nextest run -p minimal ls_reports_every_proxy_port 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-02b6... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling args v0.0.1 (/workbench/crates/args) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling client-config v0.0.1 (/wo

Verify min task run agent-verify exited 100 under rustc 1.99.0, which the repository does not pin (1.99.1 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.

t_span_id": "40fdea0df55fa2f0",
                "span_id": "bb840caabd55e6dd",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "GetDenyAllOptOut",
                "parent_span_id": "40fdea0df55fa2f0",
                "span_id": "ba4f6cc1ed50133c",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "GetPaths",
                "parent_span_id": "40fdea0df55fa2f0",
                "span_id": "25192e2ed46009ff",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "40fdea0df55fa2f0",
                "queued_behind": "0",
                "span_id": "51d01d8bcf4d1c90",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "40fdea0df55fa2f0",
                "queued_behind": "0",
                "span_id": "740c29473d1be4d5",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "740c29473d1be4d5",
                "span_id": "271ccfcd3596c019",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
    ]
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 3 tests still running
        PASS [   5.009s] ( 945/2994) minimal-client box_registration::tests::resume_timeout_goes_on_and_an_absent_host_fails_closed
        PASS [   4.300s] ( 946/2994) minimal-client tty_relay::tests::resume_after_drop_prints_line_and_nudges_winsize
        PASS [   6.071s] ( 947/2994) minimal-client box_registration::tests::a_silent_daemon_does_not_hold_the_exit_past_the_deadline
────────────
     Summary [  41.777s] 947/2994 tests run: 946 passed, 1 failed, 26 skipped
        FAIL [   2.860s] ( 944/2994) minimal::otel_cli exec_run_attach_and_task_run_share_the_commands_trace
warning: 2047/2994 tests were not run due to test failure (run with --no-fail-fast to run all tests, or run with --max-fail)
error: test run failed

Outside the task's layers::

  • crates/minimal-client/src/box_registration.rs
  • crates/minimald/src/rpc.rs
  • crates/minvmd/src/net/egress_gate.rs

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

With another process on port 7654 the VM's proxy starts on a substitute port, and the VM host daemon's log warns which port it skipped and why. When 7654 frees, the proxy serves on both ports without a VM restart, and min ls lists both ports in the HOSTNAME PROXY row and in --json as hostname_proxy_ports. A down proxy has no hostname_proxy_ports, because the VM host daemon reports no ports while the proxy is down.

Notes from the agent: This round: insert_proxy_ports no longer takes a proxy-down verdict. Its doc comment now says that the VM host daemon reports no ports while the proxy is down. The unused answerer binding in the multi-VM --json loop is removed. ls_reports_every_proxy_port asserts the down case through an empty served list. The commitlint failure is on two earlier commits (f933def, dd0daf3) whose body lines exceed 100 characters. Fixing it needs a history rewrite, which this round must not do. The new commit keeps body lines under 72 characters. A squash merge with a fresh message clears that check.

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

Babysitter review of daf96a0. The dead verdict parameter is gone, and the JSON leaves hostname_proxy_ports out on an empty served list, which is what the VM host daemon reports while the proxy is down (f933def). Arch C1 (the ledger note) is met at a87e0bd. The live-VM proof is residual #2837. commitlint flags one body line in dd0daf3. It is not a required check, and the squash commit takes the PR title.

@norrietaylor
norrietaylor marked this pull request as ready for review November 1, 2026 20:24

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

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

Comment thread crates/minimal/src/cmd/list.rs Resolved

@minimal-arch minimal-arch Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

arch-review: PASS_WITH_CONDITIONS · 1 condition · the full ruling

The reclaim forward now goes through the egress gate's ledger before the switch exposes it. This closes the code half of the earlier C1, as §7.1 line 254 requires. The --json listing now reads one source for a down proxy, and that source is correct. The live-VM proof is still not observed. C1 keeps it open as the filed residual #2837. The --json answerer read in cmd_ls is no longer used, and its comment is out of date. That is a code-quality item, not a design item.

Ruled at daf96a0 against gominimal/arch@8640f85e193d by claude-opus-5-5.

Comment thread crates/minvmd/src/cmd/run.rs Resolved
The JSON document reads no proxy-down verdict, so the per-VM control
socket round trip bought nothing.

@minimal-arch minimal-arch Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

arch-review: PASS_WITH_CONDITIONS · 1 condition · the full ruling

The compare removes an answerer-status read from min ls --json. The JSON output never used that read. The proxy-down decision stays on the host side: minvmd returns no proxy ports while the proxy is down, as §7.1 line 244 requires. Everything outside the compare keeps the ruling on daf96a0. C1 stays open under #2837: a live VM leg must show that the reclaimed 7654 serves and keeps egress parity (§7.1 line 254).

Ruled at 7ad1fe1 against gominimal/arch@8640f85e193d by claude-opus-5-5.

@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 — approval withheld

Verdict COMMENT — APPROVE withheld: 2 unresolved threads — minimal-foundry[bot] crates/minimal/src/cmd/list.rs, minimal-arch[bot] crates/minvmd/src/cmd/run.rs:2906. No findings.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 4 of 10 on the runtime's review findings, pushed as 7ad1fe1e815a.

line exit tail
cargo nextest run -p minvmd proxy_reclaims_preferred_port_when_free 0 y v0.34.0 Compiling tokio-util v0.7.20 Compiling tokio-rustls v0.26.5 Compiling opentelemetry_sdk v0.33.1 Compiling h2 v0.4.18 Compiling tower v0.5.3 Compiling tower-http v0.6.11 Compiling tokio-stream v0.1.19 Compiling crossbeam-deque v0.8.7 Compiling malachite-nz v0.9.2
cargo nextest run -p minvmd proxy_substitute_port_logs_warning 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-2a1d... Compiling version v0.8.0 (/workbench/crates/version) Compiling mlog v0.0.1 (/workbench/crates/mlog) Compiling minvmd v0.8.0 (/workbench/crates/minvmd) Finished 'test' profil
cargo nextest run -p minimal ls_reports_every_proxy_port 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-8b36... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling args v0.0.1 (/workbench/crates/args) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling client-config v0.0.1 (/wo

Verify min task run agent-verify exited 100 under rustc 1.99.0, which the repository does not pin (1.99.1 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.

t_span_id": "f92ce71cdfb27925",
                "span_id": "f12991b287fbe305",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "GetDenyAllOptOut",
                "parent_span_id": "f92ce71cdfb27925",
                "span_id": "66012bffb0a1583d",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "GetPaths",
                "parent_span_id": "f92ce71cdfb27925",
                "span_id": "7b3ee938211fc242",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "f92ce71cdfb27925",
                "queued_behind": "0",
                "span_id": "f5293d6a948dce42",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "f92ce71cdfb27925",
                "queued_behind": "0",
                "span_id": "6d0e066c561b4e0c",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "6d0e066c561b4e0c",
                "span_id": "5ff72ffd97d41a56",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
    ]
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 3 tests still running
        PASS [   5.009s] ( 945/2994) minimal-client box_registration::tests::resume_timeout_goes_on_and_an_absent_host_fails_closed
        PASS [   4.323s] ( 946/2994) minimal-client tty_relay::tests::resume_after_drop_prints_line_and_nudges_winsize
        PASS [   6.218s] ( 947/2994) minimal-client box_registration::tests::a_silent_daemon_does_not_hold_the_exit_past_the_deadline
────────────
     Summary [  42.896s] 947/2994 tests run: 946 passed, 1 failed, 26 skipped
        FAIL [   3.071s] ( 944/2994) minimal::otel_cli exec_run_attach_and_task_run_share_the_commands_trace
warning: 2047/2994 tests were not run due to test failure (run with --no-fail-fast to run all tests, or run with --max-fail)
error: test run failed

Outside the task's layers::

  • crates/minimal-client/src/box_registration.rs
  • crates/minimald/src/rpc.rs
  • crates/minvmd/src/net/egress_gate.rs

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

Review threads the coder judged:

  • 👍 valid — crates/minimal/src/cmd/list.rs: Restored if args.json || args.raw on the answerer status read in cmd_ls and its old comment. The JSON path reads no proxy-down verdict, so --json makes no extra control-socket round trip now.

With another process on port 7654 the VM's proxy starts on a substitute port, and the VM host daemon's log warns which port it skipped and why. When 7654 frees, the proxy serves on both ports without a VM restart, and min ls lists both. min ls --json now carries hostname_proxy_ports without an extra answerer status read for each VM.

Notes from the agent: This round restores the args.json || args.raw guard on the answerer status read and its old comment. The minvmd test lines were not re-run because this round changed no minvmd file.

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 1, 2026 20:43

@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 — every review thread is resolved; @norrietaylor closed the last one. The review of 7ad1fe1e815a withheld this approval on the threads open then. Posted as a comment: the App cannot approve its own pull request; the check and the label carry it.

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Nov 1, 2026

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

Babysitter review of 7ad1fe1. --json makes no answerer status read again, which is correct now that the verdict is no longer used there. The arch PASS_WITH_CONDITIONS carries C1 as residual #2837, and I added the e2e-leg wording to the issue.

@norrietaylor
norrietaylor marked this pull request as ready for review November 1, 2026 21:04
@norrietaylor
norrietaylor added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit 0e2a028 Nov 2, 2026
35 of 36 checks passed
@norrietaylor
norrietaylor deleted the agent/2709-the-hostname-proxy-takes-its-preferred-port-back branch November 2, 2026 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:approved minimal-review approved the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

T112 — The hostname proxy takes its preferred port back when it frees, and min ls lists every port it serves

1 participant