Conversation
WalkthroughEnhanced SSH connection handling with timeout-based server type detection, JWT token support for authentication, and improved error state management. Updated default WASM client version and refined error logging messages across the remote access module. Changes
Sequence DiagramsequenceDiagram
participant User
participant SSH Handler
participant Detection Service
participant SSH Connection
User->>SSH Handler: Initiate SSH connection
activate SSH Handler
SSH Handler->>Detection Service: detectSSHServerType(timeout: 20s)
activate Detection Service
alt Detection succeeds
Detection Service-->>SSH Handler: Server type + JWT requirement
else Detection fails/times out
Detection Service-->>SSH Handler: Error
SSH Handler->>SSH Handler: Fall back to pubkey
end
deactivate Detection Service
alt JWT required
SSH Handler->>SSH Handler: Check access token
alt Token available
SSH Handler->>SSH Connection: createSSHConnection(token)
else Token missing
SSH Handler->>SSH Handler: Log error, set error state
SSH Handler->>SSH Handler: Disconnect & reset
Note over SSH Handler: Operation aborted
end
else No JWT required
SSH Handler->>SSH Connection: createSSHConnection(no token)
end
SSH Connection-->>SSH Handler: Connection result
deactivate SSH Handler
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
src/app/(remote-access)/peer/ssh/page.tsx (1)
124-126: Align connection log wording for easier debuggingThis path now logs
"Connection error:"while other SSH paths use"Reconnection failed:"(here) and"Connection failed:"(inuseSSH). Not a blocker, but consider standardizing the prefix to make log filtering/alerting simpler.src/modules/remote-access/ssh/useSSH.ts (1)
27-27: SSH detection timeout and JWT guard look solid; consider minor polishThe new flow looks correct:
- 20s
SSH_DETECTION_TIMEOUT_MSis consistently used when detecting the SSH server type.- Detection failures fall back to pubkey without aborting the attempt.
- When JWT is required but
accessTokenis missing, you short‑circuit, reset state, and surface a clear error, andsetError("")prevents stale messages on subsequent attempts.Two small optional tweaks:
- The
"No access token available"message is technically accurate but a bit low‑level; you might want a more user‑actionable string (e.g., hinting at re‑auth/logging in).- This path logs
"Connection failed:"whereas the page logs"Connection error:"; aligning wording across paths would simplify log analysis.Also applies to: 43-67, 86-91
src/modules/remote-access/useNetBirdClient.ts (1)
211-218: SSH wrapper updates are correct; consider adding TypeScript interface for improved type safetyThe call sites in
src/modules/remote-access/ssh/useSSH.tsconfirm both methods use the updated signatures correctly:
detectSSHServerType(host, port, timeoutMs)at line 48 ✓createSSHConnection(host, port, username, jwtToken?)at line 69 ✓The wrapper implementations forward all parameters correctly. To prevent future signature drift, consider introducing a TypeScript interface for the NetBird client instead of using
any, so signature changes are caught at compile time.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/app/(remote-access)/peer/ssh/page.tsx(2 hunks)src/modules/remote-access/ssh/useSSH.ts(3 hunks)src/modules/remote-access/useNetBirdClient.ts(2 hunks)src/utils/config.ts(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build_n_push
Summary by CodeRabbit
Bug Fixes
Chores
✏️ Tip: You can customize this high-level summary in your review settings.