Files
coder/enterprise/cli
Paweł Banaszewski 0a34a37314 test(enterprise/cli): add standalone AI Gateway tests against a live coderd (#27863)
Stacked on #27860.

Adds four connection tests that run the real `ai-gateway start` against
`coderdenttest` and assert only what an operator or LLM client can
observe. A `chaosProxy` between the gateway and coderd simulates outages
by answering 503 and closing the connections it accepted, the latter
because the DRPC websocket is hijacked and so out of reach of
`httptest.Server`.

- `RevokedKey`: revoking an in-use key closes the session, and the 401
on redial terminates the command.
- `ReconnectAfterDisconnect`: LLM traffic and interception recording
resume after a coderd outage, with no intervention.
- `RequestWhileDisconnected`: a request arriving while disconnected is
parked until the connection returns, not failed. The pre-flight DRPC
calls block with the caller's context as the only bound, which is
intentional: a caller willing to wait is served on reconnect, and
`/readyz` has already withdrawn the replica. The RFC's "fails with 503
if pre-flight DRPC calls cannot complete" does not describe this and
needs correcting.
- `InFlightRequestSurvivesDisconnect`: a stream whose first chunk
already reached the caller completes after the DRPC connection drops.

No production code is changed.

Refs https://linear.app/codercom/issue/AIGOV-320/write-connection-tests

---

Generated with Coder Agents.
2026-08-18 14:03:41 +00:00
..