Skip to content

fix(minimal): resolve a box's VM from its name for exec, task run and net forward, as attach does - #2626

Merged
bryan-minimal merged 2 commits into
mainfrom
fix/720-exec-resolves-vm
Oct 29, 2026
Merged

bryan-minimal merged 2 commits into
mainfrom
fix/720-exec-resolves-vm

Conversation

@bryan-minimal

Copy link
Copy Markdown
Member

Summary

A box activated with --vm <name> shows up in min ls and min session attach reaches it, but min session exec <name> answered No session found matching '<name>'. The same for min session run and min net forward.

Why. NET-058 says a box name alone decides which VM a verb looks in, and attach honours it: the selected VM's daemon first, then every VM's socket (attach::resolve_box_vm). exec, run and forward still resolved against the selected VM's socket only.

Fix. The three go through the resolution attach uses, generalised by the verb that leads its one announcing line ("Running in session web (0199…) on VM alpha"); attach keeps its wrapper and its exact text. The hand-off then runs over the owning VM's socket. An explicit --vm still pins where to look, and a name two VMs own is still refused with both named, exactly as for attach. NET-058 now names the verbs it covers.

Not changed: min session setup-zed keeps the selected VM's socket. It bakes the socket into Zed's settings, so the operator should say which VM with --vm; happy to fold it in if you'd rather.

Evidence

Lab scenario 720-vm-named-host-key (activate in a named VM, then exec in it by name, on local-minvmd) fails on every main since the named-VM work landed; the host-key half of that report was #1843, this is the rest.

With the fix, on main cafa6743, four distros, two rounds (anvil job 01320):

candidate 720-vm-named-host-key 000-baseline
main cafa674 0 / 8 pass ("No session found matching") 8 / 8
this branch 8 / 8 pass 8 / 8

Two lab findings on the way, both now in the scenario: a cross-VM resolution must also set the process-wide VM name (the first candidate's pre-attach re-hold went to the selected VM's host daemon and the hand-off stalled), and a cold named VM materializes the session's packages on its first exec, so the scenario warms it before the timed probe, as it already did for the control.

Testing

  • New exec_fall_through_hands_off_the_owning_vm beside NET-058's attach test: the three verbs resolve a box only the other VM owns to that VM's record and socket.
  • box_name_resolves_vm_without_flag, attach_fall_through_hands_off_the_owning_vm, the ambiguous and stopped-VM cases: unchanged and passing.
  • just fmt-check, just clippy, workspace tests through anvil's CI mirror.

🤖 Generated with Claude Code

… net forward, as attach does

NET-058 says a box name alone decides which VM a verb looks in, and attach honours it: the
selected VM's daemon first, then every VM's socket. `min session exec`, `min session run` and
`min net forward` still looked only in the selected VM, so a box activated with `--vm` was listed
by `min ls` and reachable by attach, and exec answered "No session found matching" (lab scenario
720, every main since the named-VM work landed).

The three go through the resolution attach uses, generalised by the verb that leads its one
announcing line; attach keeps its wrapper and its text. The hand-off then runs over the owning
VM's socket. NET-058 names the verbs it now covers.

Refs: #1843 (the host-key half of the same report)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@bryan-minimal
bryan-minimal requested a review from a team as a code owner October 26, 2026 16:12
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

  • Run on-demand review

This review includes 5 billable files and costs up to $1.25.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 7 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

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: Essentials
  • Run ID: 560de54b-b372-453e-99a8-dfdb82d409ac
Commits

Reviewing files that changed from the base of the PR and between 2ced764 and 3b89596.

Files selected for processing: 5
  • crates/minimal/src/cmd/boxes/attach.rs
  • crates/minimal/src/cmd/net.rs
  • crates/minimal/src/cmd/session.rs
  • crates/minimal/src/tests.rs
  • docs/specs/18-spec-box-networking/18-spec-box-networking.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions

Copy link
Copy Markdown
Contributor

Spec lint

docs/specs/18-spec-box-networking/18-spec-box-networking.md — 11 finding(s)

docs/specs/18-spec-box-networking/18-spec-box-networking.md:159: P004 NET-009 names test 'native_resolution_without_proxy_env', which was not found in the repository
docs/specs/18-spec-box-networking/18-spec-box-networking.md:339: P004 NET-040 names test 'fresh_install_own_ip_ingress_publishes_loopback', which was not found in the repository
docs/specs/18-spec-box-networking/18-spec-box-networking.md:344: P004 NET-041 names test 'installer_switch_binary_executable', which was not found in the repository
docs/specs/18-spec-box-networking/18-spec-box-networking.md:382: P004 NET-048 names test 'linux_amd64_manifest_ships_vm_stack', which was not found in the repository
docs/specs/18-spec-box-networking/18-spec-box-networking.md:387: P004 NET-049 names test 'fresh_linux_kvm_activate_local_minvmd', which was not found in the repository
docs/specs/18-spec-box-networking/18-spec-box-networking.md:392: P004 NET-050 names test 'linux_arm64_manifest_ships_vm_stack', which was not found in the repository
docs/specs/18-spec-box-networking/18-spec-box-networking.md:397: P004 NET-051 names test 'fresh_arm64_kvm_activate_local_minvmd', which was not found in the repository
docs/specs/18-spec-box-networking/18-spec-box-networking.md:723: P004 NET-139 names test 'vsock_rpc_refuses_non_host_cid', which was not found in the repository
docs/specs/18-spec-box-networking/18-spec-box-networking.md:740: P004 NET-132 names test 'proxy_sees_each_vm_box_by_its_switch_address', which was not found in the repository
docs/specs/18-spec-box-networking/18-spec-box-networking.md:766: P004 NET-134 names test 'deny_all_box_reaches_proxy_and_no_other_host_port', which was not found in the repository
docs/specs/18-spec-box-networking/18-spec-box-networking.md:790: P004 NET-107 names test 'session_outbound_request', which was not found in the repository

Advisory. None of this blocks the merge; the review decides.

Advisory, and never a merge gate. Linter: gominimal/foundry@fb5932b8, spec format: How Minimal Writes Specs.

@minimal-foundry

minimal-foundry Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Approved: no findings at 3b89596ffd18.

Nothing to do.

Clobber: none seen.

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minimal-review — approved

Verdict APPROVE — No findings.

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

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

LGTM. Exec, task run and net forward now go through the same resolve_named_box_version_gated attach uses (boxes/attach.rs:45), not a copy, so they get the same --vm pin and the same refusal when two VMs own the name.

Non-blocking:

  • Attach's cross-VM path now calls set_vm_name (attach.rs:64). The reasoning in the body holds, but no test pins it.
  • On a terminal, a cross-VM min net forward prints "Forwarding to session web (0199) on VM alpha" and then "Forwarding localhost:N → … in session web (0199)". Folding the VM into the second line would read better.
  • session policy, hooks, destroy and rename still resolve only against the selected VM, so a box that only another VM owns answers "No session found". NET-058 doesn't cover them; destroy and rename are worth a follow-up.

@bryan-minimal
bryan-minimal added this pull request to the merge queue Oct 29, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 29, 2026
@bryan-minimal
bryan-minimal added this pull request to the merge queue Oct 29, 2026
Merged via the queue into main with commit f2e6ed6 Oct 29, 2026
38 checks passed
@bryan-minimal
bryan-minimal deleted the fix/720-exec-resolves-vm branch October 29, 2026 16:43
norrietaylor pushed a commit that referenced this pull request Nov 4, 2026
… net forward (#2626)

NET-058 says a box name alone decides which VM a verb looks in, and attach honours it: the
selected VM's daemon first, then every VM's socket. min session exec, min session run and min
net forward still looked only in the selected VM, so a box activated with --vm was listed by
min ls and reachable by attach, and exec answered "No session found matching". The three now go
through the resolution attach uses, generalised by the verb that leads its one announcing line,
and the hand-off runs over the owning VM's socket. NET-058 names the verbs it now covers.

Backport of #2626. Adapted to the line: the cmd/boxes/attach.rs change lands in cmd/session.rs,
with the line's session_announce names.

(cherry picked from commit f2e6ed6)
norrietaylor pushed a commit that referenced this pull request Nov 5, 2026
… net forward (#2626)

NET-058 says a box name alone decides which VM a verb looks in, and attach honours it: the
selected VM's daemon first, then every VM's socket. min session exec, min session run and min
net forward still looked only in the selected VM, so a box activated with --vm was listed by
min ls and reachable by attach, and exec answered "No session found matching". The three now go
through the resolution attach uses, generalised by the verb that leads its one announcing line,
and the hand-off runs over the owning VM's socket. NET-058 names the verbs it now covers.

Backport of #2626. Adapted to the line: the cmd/boxes/attach.rs change lands in cmd/session.rs,
with the line's session_announce names.

(cherry picked from commit f2e6ed6)
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.

2 participants