Commit Graph
4 Commits
Author SHA1 Message Date
McKayla はな 5ca0143992 refactor: upgrade golangci-lint to v2.0.2 (#28416) 2026-08-21 23:46:27 -06:00
Paweł Banaszewski a441b03d70 feat: add yaml config option to standalone AI gateway (#28258)
`coder ai-gateway start` now accepts a `--config` / `-c` flag (and
`CODER_CONFIG_PATH`) to load configuration from a YAML file.
2026-08-19 10:07:22 +00:00
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
Paweł Banaszewski 94f487b890 test(enterprise/cli): add standalone AI Gateway connection tests (#27860)
Adds two tests that run the real `ai-gateway start` command against a
real coderd over the production websocket dialer.
`TestAIGatewayStartE2E`: the gateway completes the handshake, loads
providers over DRPC, proxies an OpenAI chat completion on its own
listener, and the interception is recorded in coderd.
`TestAIGatewayStartE2E_InvalidKey`: a key rejected by the handshake is
fatal rather than retried, and the command reports it.

Also tidies the existing tests: `TestAIGatewayStart_HealthBeforeReady`
moves to the external package and reuses the new helpers, the two fake
reloaders collapse into one `mockReloader`.

---

Generated with Coder Agents.
2026-08-17 20:48:09 +00:00