Repository navigation
Show why the gateway refused an exec, attached run or log stream - #199
Conversation
…tream
The Convox SDK drops the response to a refused WebSocket handshake, so any refusal of exec, an attached
run or logs printed only "websocket: bad handshake". The CLI's websocket dialers now wrap each connection
so it records the gateway's response to a refused handshake (and stops at an accepted one's headers, so
nothing from the stream is kept). Execute turns websocket.ErrBadHandshake into the status and the
gateway's reason, for example:
the gateway refused the connection (429 Too Many Requests): too many MFA attempts, try again in a few minutes
Closes #196
Moves the deployer and viewer stages into roles.sh: stages.sh was at the 500-line limit.
|
Warning Review limit reached
This review includes 15 billable files and costs up to $3.75.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 11 minutes for your next included review. View limit details
Comment |
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| JavaScript | Oct 27, 2026 11:07p.m. | Review ↗ | |
| Go | Oct 27, 2026 11:07p.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
Closes #196.
What changes
The Convox SDK (
stdsdk.Client.Websocket) drops the response gorilla returns withwebsocket.ErrBadHandshake. So whenever the gateway refused anexec, an attachedrunorlogs(401, 403, 429, 400), the CLI printed only:The CLI already owns both websocket dialers (
secureConvoxSDKsetsNetDialTLSContextto verify the gateway's certificate). Each connection is now wrapped in ahandshakeRecordingConn:101 Switching Protocols), it stops at the headers and drops what it has, so nothing from the stream is kept.Executethen turnsErrBadHandshakeinto the status and the gateway's reason, throughRenderGatewayError, so JSONerrorfields are unwrapped and control characters are neutralised:With no body, it shows just the status. If nothing was recorded, the SDK's error stands, and the new error still unwraps to
ErrBadHandshake. The plainws://dialer (a gateway on this machine) records too, viaNetDialContext.The CLI's early checks stay: a command too long for the audit log, or a missing justification, is still refused before any MFA prompt. Their comments no longer say the gateway's refusal can't be shown. Also updated:
internal/cli/AGENTS.md("Exec and log streams") and the audit logging page.Testing
-race, andnofido), through stdsdk's realWebsocketcall against httptest gateways:exec. The gateway refuses it at the handshake, and the CLI now printsError: the gateway refused the connection (403 Forbidden): You don't have permission to run processes.The full suite passed locally. The deployer and viewer stages moved toscripts/lib/cli-e2e/roles.sh, becausestages.shhit the 500-line limit.