-
Notifications
You must be signed in to change notification settings - Fork 21
RFD 189: Console Access - Add WebSocket console endpoint #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Add GET /:account/machines/:machine/console endpoint for WebSocket-based console access to all VM brands. Changes: - Add lib/endpoints/console.js with ConsoleConnectionFSM - Add MachineHasNoConsoleError error type - Mount console endpoint in app.js - WebSocket upgrade with binary protocol - TCP proxy to console (vmadmd) via CNAPI - Support for all brands (KVM serial console, zone console for others) Console connections: - Upgrade HTTP to WebSocket (binary protocol) - Query CNAPI for console host/port - Establish TCP connection to vmadmd console proxy - Bidirectional byte stream proxying - Proper error handling and cleanup API version: 9.0.0 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements WebSocket console access functionality for CloudAPI as part of RFD 189. The change enables remote access to instance consoles without requiring SSH access to compute nodes, supporting all instance types including KVM, Bhyve, SmartOS native zones, and LX.
Key changes include:
- New WebSocket endpoint for console connections at
GET /:account/machines/:machine/console - FSM-based connection management with TCP proxy to vmadmd console via CNAPI
- Console-specific error handling for unsupported instance types
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lib/errors.js | Adds MachineHasNoConsoleError for instances that don't support console connections |
| lib/endpoints/console.js | New WebSocket console endpoint with FSM-based connection management and TCP proxy |
| lib/app.js | Registers the new console endpoint in the server routing |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| // All brands support console access | ||
| // KVM: serial console, others: zone console |
Copilot
AI
Oct 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment claims all brands support console access, but the code imports and exports MachineHasNoConsoleError, suggesting some brands may not support console access. This creates a contradiction between the comment and the available error handling.
| // All brands support console access | |
| // KVM: serial console, others: zone console | |
| // Most brands support console access (KVM: serial console, others: zone console), | |
| // but some brands may not. Handle accordingly. |
| this.ws = shed.accept(this.req, this.upgrade.socket, this.upgrade.head, | ||
| false, ['binary', 'console']); | ||
| } catch (ex) { | ||
| this.log.error(ex, 'websocket upgrade failed'); |
Copilot
AI
Oct 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The this.log property is undefined at this point since it's only initialized in the start() method on line 293. This will cause a runtime error when the websocket upgrade fails.
|
1.) Thank you for the draft PR. 2.) Copilot does not count as an official reviewer for our purposes. It'll be interesting to see if its feedback is helpful or distracting. |
Summary
Adds WebSocket console endpoint to CloudAPI to support RFD 189 Console Access Through CloudAPI.
Enables users to access instance consoles remotely without requiring SSH access to compute nodes. Supports all instance types: KVM, Bhyve, SmartOS native zones, and LX.
Changes
GET /:account/machines/:machine/consolelib/app.js- Endpoint registrationlib/endpoints/console.js- WebSocket console endpoint implementationlib/errors.js- Console-specific error typesFeatures
Related PRs
Dependencies
Requires: