Repository navigation
fix(minimal,minimald,minimald-rpc): on a VM-backed host, min box stop frees declared ingress ports - #3710
fix(minimal,minimald,minimald-rpc): on a VM-backed host, min box stop frees declared ingress ports#3710minimal-foundry[bot] wants to merge 6 commits into
Conversation
A VM-backed host binds a declared forward toward the box's switch address. A box the host handed none published its name with every declared port dead. The finalize now fails with the reason first.
Adds the release_box_forwards control verb on the host socket. The egress gate unbinds the row's declared forwards and resets their connections, and the row stays live. The caller waits for the result, so a stop can return only after the ports are free (NET-121).
min box stop now asks the VM host daemon to release the stopped box's declared forwards and waits for the reply. A start right after the stop binds the ports again. A release the host does not confirm prints one line that a start can fail on a port in use.
|
Important Review skippedBot user detected. Ask an organization administrator to verify that this bot has an active assigned CodeRabbit review seat. See the seat-assignment guide. After the seat is confirmed, request a review again.
|
Spec lint
Advisory. None of this blocks the merge; the review decides. Advisory, and never a merge gate. Linter: |
|
/revise |
|
That What the platform saidcould not start the coder: Error: there is no container instance that can be provided to this durable object Nothing to type again: the command gets a rocket when its round starts, or a refusal that names the reason. No round was counted for it yet. |
…cked-host-min-box-stop-frees-declared
The release_box_forwards handler landed between rename_box and its doc comment, so the comment described the wrong function.
|
Round 1 of 10 on a /revise note, pushed as
Verify Converted to a draft: verify exited 101. On a VM-backed host, min box stop asks the VM host daemon to unbind the box's declared ports and waits for the answer, so a min box start of the same box right after binds its declared port again. A box that declares ingress ports and gets no network address from its VM fails activation with a message that says why, and no forward is bound for it. Notes from the agent: Revise round 1 (test-kvm failure at scripts/session-e2e.sh:8204, 'an uninstalled SHELL did not fall back to bash'). I found no code path in this PR that the failing case runs. (1) The case starts a box with |
|
/arch-review |
There was a problem hiding this comment.
Reviewed at 8b9646e. The design holds up: the release reuses the withdrawal's unbind and reset path, keeps the row, refuses a pair/id mismatch, and the CLI keeps the stop successful and prints one line when the host does not confirm. CI lanes are green. Two medium findings block an approve. First, a release that runs past the 30 s wait keeps going with no hold on the address, so it can unbind the forward that a following min box start binds. Second, the new control-socket handler (reply mapping and the guest-door refusal) has no test. There is also one low wording note on the new activation refusal. Noted, not filed inline: min session stop and min box stop --exec still do not release (the PR says so), and the cmd_box_stop wiring (record read and the control_sock.is_some() gate) is tested only through release_ports_after_stop.
Generated by Claude Code
| ) { | ||
| let switch_addr = release.switch_addr(); | ||
| let (revocation, done) = release.into_revocation(); | ||
| let released = revoke_box_forwards(switch_sock, forwards, replies, revocation, backoff) |
There was a problem hiding this comment.
Medium: a release that outlives its caller can unbind the next start's forward.
revoke_box_forwards re-reads forwards.published_at(addr) on every pass, and the release builds its RowWithdrawal with an empty hold, so nothing stops a new publish at the address while the release is still running. With a switch that answers slowly, one forward can take 6 passes x REVOKE_TIMEOUT (5 s) plus the 7.75 s of UNBIND_RETRY_BACKOFF sleeps, about 38 s. That is past FORWARD_RELEASE_WAIT (30 s). Path: min box stop web gets TimedOut, prints "The VM did not confirm that the ports of web are free...", the user runs min box start web, its finalize binds the declared port at the same switch address (the row stays), and the still-running release's next unbind_pass unexposes that new forward. The box then runs with its declared port dead and no error anywhere. A withdrawal does not have this problem because its hold makes revocation_pending refuse the publish.
Suggested fix: snapshot the listeners at release time and unbind only those, or make a publish at the address wait or be refused while a release is in flight there (an in-flight marker the publish checks, like revocation_pending). A test that publishes at the address during a slow release would pin it.
Generated by Claude Code
| /// id prove (NET-121), and build the reply: the pair echoed back once every | ||
| /// forward is unbound, or when no row stands at the pair, and the reason | ||
| /// otherwise. The row is not withdrawn. One line for each release. | ||
| fn release_box_forwards( |
There was a problem hiding this comment.
Medium: this handler has no test.
The minvmd test drives BoxTable::release_row_forwards and the gate directly, and the CLI test uses a fake control socket, so nothing exercises this function or the dispatch arm in serve_request. Untested: NoRow answered as the echo, NotTheBox/NoGate/GaveUp/TimedOut answered as BoxControlReply::Error, and the verb arriving on the GuestReports door being refused (the guest must not be able to drop host-held forwards). The PR notes say the same. Existing control.rs tests already speak the wire (the RenameBox one around line 7170), so a test there that registers a row, sends ReleaseBoxForwards with the right pair, a wrong id, and on the guest door, and checks each reply, would cover it.
Generated by Claude Code
| std::io::Error::new( | ||
| std::io::ErrorKind::AddrNotAvailable, | ||
| format!( | ||
| "box {box_name} declares ingress ports, but its VM did not assign it a \ |
There was a problem hiding this comment.
Low: "its VM did not assign it a network address" says more than the code proves. The arm runs when the record carries no box_addresses, which happens when the client that created the box registered no host row with the VM host daemon; the VM assigning nothing is not what this code path checks. Something like "box declares ingress ports, but it has no network address on the VM host, so no port can be forwarded to it. The box did not start." states only what is known. The test at box_actor/tests.rs pins the text, so update both.
Generated by Claude Code
Follow-up
Fixes #3689
crates/minimald-rpc/src/lib.rscrates/minvmd/src/control.rscrates/minvmd/src/box_registry.rscrates/minvmd/src/net/egress_gate.rscrates/minimald/src/rpc.rscrates/minimal/src/cmd/boxes/vm_host.rscrates/minimal/src/cmd/boxes/lifecycle.rscrates/minimald/src/box_actor/setup.rscrates/minimald/src/box_actor/tests.rsdocs/specs/18-spec-box-networking/18-spec-box-networking.mdTask marker
Proof
On a VM-backed host,
min box stopnow sends the new release_box_forwards verb to the VM host daemon. It returns only after the daemon's egress gate unbinds the box's declared forwards and resets their connections. The row stays, so a start right after the stop binds the declared port again. The minvmd test shows the forward is unbound when the wait returns and that the same listener can be bound again at once. Separately, a VM-backed box that declares ingress and has no switch address now fails activation with this message: "box declares ingress ports, but its VM did not assign it a network address. No port can be forwarded to it. The box did not start." No forward is bound, and the cleanup leaves no record.Notes from the agent: Spec layer: the NET-121 block at the branch head had no VM-backed residual notes to remove, either on the sub-requirements or elsewhere in the NET-121 entry. I added three verify lines to NET-121 for the new tests and extended its comment to describe the VM-backed behaviour. Vale is not installed on this box, so
just lint-prosedid not run on the spec. The control handler takes no ApplyOrder ticket for the new verb, because the release changes no row and can wait up to 30 s (FORWARD_RELEASE_WAIT) for the gate. The CLI waits 35 s. A release that the host does not confirm does not fail the stop. It prints one line to stderr: "The VM did not confirm that the ports of are free.min box start <box>can fail while a port is still in use." Onlymin box stop(cmd_box_stop) calls the release.min session stop(crates/minimal/src/cmd/session.rs:427) andmin box stop --execare outside the layers and do not call it yet. The minimald activation test sets the daemon's switch to the VM host transport after the create, because box_actor tests had no VM-backed finalize fixture. The minvmd test drives the registry and the gate directly. It does not go through the control socket, so the wrapper in control.rs (release_box…[truncated]Tests
cargo test -p minvmd stopped_box_declared_forwards_released_before_stop_returnscargo test -p minimal box_stop_releases_declared_ports_on_vm_hostcargo test -p minimald activation_refused_when_vm_host_hands_no_switch_addresscargo test -p minvmd stopped_box_declared_forwards_released_before_stop_returnsVerify
min task run agent-verifyexited 101, so this PR is a draft.