fix vm ssh command#219
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
Fixed SSH host key handling by correcting API response field names from camelCase to snake_case and ensuring the known hosts entry uses the same hostname as the HostKeyAlias for proper SSH key verification.
- Changed
ssh_host_keysfield names fromkeyType/base64EncodedKeytokey_type/base64_encoded_keyto match the API schema defined insrc/schema.ts:1808-1811 - Replaced
sshHostnamewith${vmId}.vms.sfcompute.devin the known hosts command to align with theHostKeyAliasconfiguration, ensuring SSH properly validates host keys - Applied identical fixes to both
src/lib/nodes/ssh.tsandsrc/lib/vm/ssh.ts
Confidence Score: 5/5
- This PR is safe to merge with no risk
- The changes fix a bug where API field names were incorrectly using camelCase instead of snake_case, which would have caused runtime errors when accessing undefined properties. The hostname change ensures SSH host key verification works correctly by aligning the known hosts entry with the HostKeyAlias. Both changes are well-defined, match the API schema, and improve system reliability.
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| src/lib/nodes/ssh.ts | 5/5 | Fixed API field names from camelCase to snake_case and aligned known hosts hostname with HostKeyAlias |
| src/lib/vm/ssh.ts | 5/5 | Fixed API field names from camelCase to snake_case and aligned known hosts hostname with HostKeyAlias |
Sequence Diagram
sequenceDiagram
participant User
participant CLI
participant VMs_API
participant SSH_Client
User->>CLI: Execute nodes ssh command
alt VM ID provided
CLI->>CLI: Use VM ID directly
else Node name provided
CLI->>VMs_API: Request node information
VMs_API-->>CLI: Return node with current VM
CLI->>CLI: Extract VM ID
end
CLI->>VMs_API: Request SSH connection details
VMs_API-->>CLI: Return hostname, port, and host keys
Note over CLI: Host keys use snake_case:<br/>key_type, base64_encoded_key
CLI->>CLI: Configure known hosts with VM domain
CLI->>CLI: Set host key alias to VM domain
CLI->>SSH_Client: Establish SSH connection
SSH_Client->>User: Interactive SSH session
2 files reviewed, no comments
sigmachirality
approved these changes
Oct 23, 2025
b3f3cb9 to
d3d9144
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.