Repository navigation
fix(minimal): resolve a box's VM from its name for exec, task run and net forward, as attach does - #2626
Conversation
… 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>
|
Warning Review limit reached
This review includes 5 billable files and costs up to $1.25.
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. View limit details
Comment |
Spec lint
Advisory. None of this blocks the merge; the review decides. Advisory, and never a merge gate. Linter: |
|
Approved: no findings at Nothing to do. Clobber: none seen. |
norrietaylor
left a comment
There was a problem hiding this comment.
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 forwardprints "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,destroyandrenamestill 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.
… 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)
… 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)
Summary
A box activated with
--vm <name>shows up inmin lsandmin session attachreaches it, butmin session exec <name>answeredNo session found matching '<name>'. The same formin session runandmin 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
--vmstill 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-zedkeeps 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, onlocal-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):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
exec_fall_through_hands_off_the_owning_vmbeside 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