feat(coderd/aibridge): build providers from deployment config without a DB#26605
Draft
pawbana wants to merge 4 commits into
Conversation
This was referenced Jun 23, 2026
Contributor
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Docs preview📖 View docs preview for |
a66f1fe to
c768ef1
Compare
d2902a8 to
a0e84e0
Compare
c768ef1 to
8a51ad7
Compare
a0e84e0 to
0814404
Compare
8a51ad7 to
94f6f0d
Compare
0814404 to
06972b6
Compare
94f6f0d to
0d518d8
Compare
06972b6 to
ce1531b
Compare
… a DB Factor the per-provider-type construction out of buildAIProviderFromRow into a database-neutral buildProvider helper, and add two entry points that share it: - coderd.ProvidersFromConfig normalizes the deployment AI Bridge config (legacy + indexed CODER_AI_GATEWAY_PROVIDER_<N>_* env vars) into a DB-neutral provider list, reusing the same logic as the env seed. - cli.BuildProvidersFromConfig turns that into runtime aibridge.Provider instances with no database access. This lets the upcoming standalone AI Gateway set up providers purely from its configuration. No behavior change for the embedded DB-backed path. Co-authored-by: Coder Agent <agent@coder.com>
Add aibridged.NewWebsocketDialer, which connects to coderd's /api/v2/aibridge/serve endpoint over a WebSocket, multiplexes it with yamux, and returns a DRPCClient exposing the Recorder, MCPConfigurator and Authorizer services. It is the standalone counterpart to the in-memory pipe used by the embedded daemon. Authentication uses the AI Gateway key header; the API version is sent as a query parameter and the build version as a header. Failed upgrades are returned as *codersdk.Error so the daemon's connect loop can tell fatal auth/entitlement failures apart from transient ones. Co-authored-by: Coder Agent <agent@coder.com>
Add the standalone AI Gateway command under the existing 'coder ai-gateway' group. It connects to coderd over DRPC via /api/v2/aibridge/serve for authentication, recording and MCP configuration, builds providers from deployment configuration, and serves incoming LLM client traffic on its own HTTP listener (with optional TLS termination). Request interception and recording behave the same as the embedded daemon, which it reuses directly. The daemon is served at the listener root, with an /api/v2/aibridge alias for parity with the embedded route. Standalone-specific options use the CODER_AI_GATEWAY_* prefix; all other AI Gateway config options are shared with embedded mode. Health endpoints, metrics, tracing, structured logging, live provider reload and E2E tests are intentionally out of scope and will follow. Co-authored-by: Coder Agent <agent@coder.com>
The connect loop warns when a dial fails but previously logged a successful connect at debug, so a standalone gateway recovering from a transient coderd outage produced no visible signal. Log the (re)connection at info so the warning on failure is paired with a clear restoration message. Resolves the long-standing TODO now that external gateways exist. Co-authored-by: Coder Agent <agent@coder.com>
ce1531b to
cfecff6
Compare
0d518d8 to
3ca7c1b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

No description provided.