Skip to content

Conversation

@sigmachirality
Copy link
Member

@sigmachirality sigmachirality commented Feb 12, 2026

Summary

  • Try the new v2/nodes/{id}/ssh endpoint first for SSH info, falling back to the v0/vms/ssh endpoint if it fails (including 401)
  • Use apiClient for the v0 fallback instead of raw fetch + getApiUrl
  • Extract inline SSH response type into a named SshInfo type
  • Use distinct host key aliases per endpoint version (*.v2.nodes.sfcompute.dev vs *.vms.sfcompute.dev)

Context

This is a stepping stone toward supporting sf nodes ssh for the new capacities API. The v2 endpoint will serve capacities nodes going forward, while the v0/vms fallback keeps existing Nodes API users working during the deprecation window. Once the Nodes API is fully deprecated, the v0 fallback can be removed. For capacities nodes, we can use the nano ID prefix to route to the correct endpoint, avoiding ambiguity with legacy node names/IDs.

Test plan

  • sf nodes ssh root@<node-name> connects successfully via v2 endpoint
  • sf nodes ssh root@<vm-id> falls back to v0 endpoint and connects
  • sf nodes ssh root@<node-name> --json returns SSH info JSON
  • 401 from v2 endpoint falls through to v0 flow instead of quitting

🤖 Generated with Claude Code

Try the v2 nodes SSH endpoint first, falling back to the v0/vms/ssh
path. Extract SshInfo type, use apiClient for the v0 fallback, and
use distinct host key aliases per endpoint version.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@semanticdiff-com
Copy link

semanticdiff-com bot commented Feb 12, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  src/lib/nodes/ssh.ts  46% smaller

process.exit(1);
if (v2Response.ok) {
data = await v2Response.json();
hostKeyAlias = `${nodeOrVmId}.v2.nodes.sfcompute.dev`;
Copy link
Member Author

Choose a reason for hiding this comment

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

@coffinsfcompute to double check this is fine

sigmachirality and others added 3 commits February 11, 2026 19:47
vm_ IDs are always legacy VMs, so go straight to the v0 endpoint
to avoid an unnecessary round-trip to v2.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@sigmachirality sigmachirality merged commit df7178d into main Feb 12, 2026
1 check passed
@sigmachirality sigmachirality deleted the dt/read-ssh-changes branch February 12, 2026 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants