8000 fix(minvmd,minimal): key a named VM's known_hosts entry on the alias ssh connects with by gominimal-aw-bot[bot] · Pull Request #1843 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(minvmd,minimal): key a named VM's known_hosts entry on the alias ssh connects with - #1843

Merged
norrietaylor merged 2 commits into
mainfrom
inbox-patch/fix/named-vm-known-hosts-alias-7a21d59cd36339d2
Oct 3, 2026
Merged

norrietaylor merged 2 commits into
mainfrom
inbox-patch/fix/named-vm-known-hosts-alias-7a21d59cd36339d2

Conversation

@gominimal-aw-bot
@gominimal-aw-bot gominimal-aw-bot Bot commented Oct 3, 2026 •
Copy link
Copy Markdown
Contributor

Routing-Key: inbox-route/I_kwDOSUhdos8AAAABUuDTmA

Defect

On a named VM (min --vm <name>), session exec, attach, and Zed setup
failed with No ED25519 host key is known for <name> ... Host key verification failed.

The known_hosts writer keyed every entry on the fixed provider-instance
name local-minvmd0, while the ssh readers derive the host alias from the
socket's parent directory basename. For a named VM that basename is the VM
name, so the two disagreed and the key lookup failed.

Change

Add a single ssh_host_alias helper in crates/paths and use it in all
three sites — the minvmd known_hosts writer, the attach client, and Zed
setup — so the writer and readers can never disagree on the alias.

The default VM keeps the alias local-minvmd0. A named VM gets
<vm>.local-minvmd0 rather than the bare VM name: ssh matches its host
argument against the user's ~/.ssh/config Host blocks, so a bare name
such as dev could pick up ControlMaster, User or forwarding options
meant for a real machine. VM names never contain ., so the namespaced
form cannot clash.

Verification

  • cargo fmt --all --check — clean
  • cargo clippy -p paths -p minvmd -p minimal-client -p minimal --no-deps -- -D warnings — clean
  • cargo build --workspace --locked — clean
  • cargo test -p paths -p minvmd -p minimal-client --locked — pass
    (new tests cover the named-VM alias in all three crates)

Summary by CodeRabbit

  • Bug Fixes
    • SSH connections now use the correct host alias for named virtual machines, including when attaching or opening a session in Zed.
    • SSH host keys are recorded under the matching alias for default and named virtual machines, helping avoid mismatches during host verification. If a valid alias cannot be determined, the host key is not written.

…ssh connects with

The known_hosts writer keyed every entry on the fixed provider-instance
name local-minvmd0, while the ssh readers (attach and Zed setup) derive
the host alias from the socket's parent directory basename. For a named
VM that basename is the VM name, so session exec/attach/Zed failed with
"No ED25519 host key is known for <name>" and host key verification
failed.

Add a single ssh_host_alias helper in crates/paths and use it in all
three sites so the writer and readers can never disagree on the alias.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@gominimal-aw-bot
gominimal-aw-bot Bot requested a review from a team as a code owner October 3, 2026 02:22
@gominimal-aw-bot gominimal-aw-bot Bot added the agent:fix Agentic fix PR eligible for review iteration; min-aw's worker-iterate gates on it. label Oct 3, 2026
@coderabbitai
coderabbitai Bot commented Oct 3, 2026 •
Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 3ecb8878-ba6e-451e-9491-a745fb620652
📥 Commits

Reviewing files that changed from the base of the PR and between b176b33 and 35353e4.

📒 Files selected for processing (4)
  • crates/minimal-client/src/attach.rs
  • crates/minimal/src/cmd/session.rs
  • crates/minvmd/src/cmd/mod.rs
  • crates/paths/src/lib.rs

Included review availability: This review used your included allowance. 3 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


📝 Walkthrough

Walkthrough

SSH host aliases now come from provider-directory basenames through a shared helper. Attach, Zed session setup, and READY beacon handling use the derived alias. Tests cover default and named VM directory layouts.

Changes

SSH Host Alias Resolution

Layer / File(s) Summary
Define SSH host alias lookup
crates/paths/src/lib.rs
Adds ssh_host_alias, which returns a provider directory’s UTF-8 basename or None. A test covers the default provider directory, a named VM directory, and the filesystem root.
Use derived aliases for SSH
crates/minimal-client/src/attach.rs, crates/minimal/src/cmd/session.rs, crates/minvmd/src/cmd/mod.rs
Attach and Zed setup derive SSH host aliases through the helper. READY beacon handling uses the derived alias to prune and record known_hosts entries. Tests cover default and named VM layouts.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: norrietaylor, 0chroma

Merge Risk: ⚪ Minimal · up to 35353

No merge-blocking issue is identified for named-VM SSH host lookup.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 4 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the named-VM known_hosts alias change. It is specific and related to the main change, though somewhat long.
Description check ✅ Passed The description explains the defect and change, and reports verification commands and results. It covers the Summary and Testing requirements, but omits the template’s Checklist section.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checked the host name twice,
Then found the alias neat and nice.
The keys were placed with care in line,
Named VM paths now resolve fine.
The rabbit hopped beneath the pine.

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

@norrietaylor norrietaylor changed the title fix: fix(minvmd,minimal): key a named VM's known_hosts entry on the alias ssh connects with fix(minvmd,minimal): key a named VM's known_hosts entry on the alias ssh connects with Oct 3, 2026
…r name

A bare VM name (dev, work) as the ssh host argument matches the user's own
~/.ssh/config Host blocks, so options such as ControlMaster or User could
route an attach to a real machine. Named VMs now use <vm>.local-minvmd0;
the default VM keeps local-minvmd0.

A known_hosts path with no provider-dir parent is now a debug assertion,
not a silent normal path.
@gominimal-aw-bot gominimal-aw-bot Bot added the agent:resolve Consent gate: pr-conflict-resolver may rewrite this branch label Oct 3, 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.

Approved per norrie's instruction: CodeRabbit approved, no open threads, independent review applied, lanes green.

@norrietaylor
norrietaylor added this pull request to the merge queue Oct 3, 2026
Merged via the queue into main with commit e1cc07b Oct 3, 2026
34 checks passed
@norrietaylor
norrietaylor deleted the inbox-patch/fix/named-vm-known-hosts-alias-7a21d59cd36339d2 branch October 3, 2026 08:28
yermakoffivan pushed a commit to yermakoffivan/minimal that referenced this pull request Oct 29, 2026
… net forward, as attach does (gominimal#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" (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: gominimal#1843 (the host-key half of the same report)

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:fix Agentic fix PR eligible for review iteration; min-aw's worker-iterate gates on it. agent:resolve Consent gate: pr-conflict-resolver may rewrite this branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0