Skip to content

refactor: move aibridged out of enterprise to AGPL#25570

Merged
dannykopping merged 1 commit into
mainfrom
dk/aibridged-to-agpl
May 22, 2026
Merged

refactor: move aibridged out of enterprise to AGPL#25570
dannykopping merged 1 commit into
mainfrom
dk/aibridged-to-agpl

Conversation

@dannykopping
Copy link
Copy Markdown
Contributor

@dannykopping dannykopping commented May 21, 2026

In order to allow Coder Agents to use AI Gateway in OSS, we need to rehome the aibridged-related code into the AGPL path.

The HTTP API is only registered under enterprise so will still require the AI Governance Add-on to be present in order to use it, whereas Coder Agents uses an in-memory pipe to the same handlers.

Copy link
Copy Markdown
Contributor Author

dannykopping commented May 21, 2026

@dannykopping dannykopping changed the base branch from dk/aibridge-providers-env-migration to graphite-base/25570 May 21, 2026 15:30
@dannykopping dannykopping force-pushed the dk/aibridged-to-agpl branch from 1cb1201 to 5d05a00 Compare May 21, 2026 15:30
@dannykopping dannykopping changed the base branch from graphite-base/25570 to dk/aibridge-enable-default May 21, 2026 15:30
@dannykopping dannykopping changed the base branch from dk/aibridge-enable-default to graphite-base/25570 May 21, 2026 16:31
@dannykopping dannykopping force-pushed the dk/aibridged-to-agpl branch from 5d05a00 to 7cef6fd Compare May 21, 2026 16:32
@dannykopping dannykopping force-pushed the graphite-base/25570 branch from dc4e5d1 to 1183a22 Compare May 21, 2026 16:32
@dannykopping dannykopping changed the base branch from graphite-base/25570 to dk/aibridge-enable-default May 21, 2026 16:32
@dannykopping dannykopping marked this pull request as ready for review May 21, 2026 16:49
@dannykopping dannykopping force-pushed the dk/aibridged-to-agpl branch from 61fe7c4 to c51efb0 Compare May 21, 2026 18:38
@dannykopping dannykopping force-pushed the dk/aibridge-enable-default branch from 1183a22 to 0982edf Compare May 21, 2026 18:38
Copy link
Copy Markdown
Contributor Author

dannykopping commented May 22, 2026

Merge activity

  • May 22, 6:37 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • May 22, 6:59 AM UTC: Graphite rebased this pull request as part of a merge.
  • May 22, 7:11 AM UTC: @dannykopping merged this pull request with Graphite.

@dannykopping dannykopping changed the base branch from dk/aibridge-enable-default to graphite-base/25570 May 22, 2026 06:38
@dannykopping dannykopping changed the base branch from graphite-base/25570 to main May 22, 2026 06:57
Move enterprise/aibridged and enterprise/aibridgedserver under coderd/
so the daemon can run on AGPL builds, and so chatd can route LLM traffic
through aibridge without depending on enterprise code.

The aibridged daemon has no enterprise-only dependencies (the only
runtime touchpoint, aiseats.SeatTracker, is already exposed through the
AGPL coderd.API as an interface). Moving it does not OSS any
license-gated feature: the /api/v2/aibridge HTTP route stays registered
only by enterprise/coderd and remains gated by
RequireFeatureMW(codersdk.FeatureAIBridge).

Net effect by build:
- AGPL: daemon starts when CODER_AIBRIDGE_*_ENABLED; the HTTP route is
  never registered, so curl /api/v2/aibridge returns 404.
- Unlicensed enterprise binary: daemon starts; HTTP route returns 403
  via RequireFeatureMW.
- Licensed enterprise: unchanged.

Files moved (with import-path rewrites):
- enterprise/aibridged              -> coderd/aibridged
- enterprise/aibridgedserver        -> coderd/aibridgedserver
- enterprise/coderd/aibridged.go    -> coderd/aibridged.go
  (RegisterInMemoryAIBridgedHTTPHandler and CreateInMemoryAIBridgeServer
   become methods on the AGPL API)
- enterprise/cli/aibridged.go       -> cli/aibridged.go
  (buildProviders is exported as BuildProviders so enterprise/cli can
   still build the proxy daemon's provider list; TestDomainsFromProviders
   moves with the proxy to enterprise/cli/aibridgeproxyd_internal_test.go)

The aibridged integration test stays enterprise-only since it uses
coderdenttest; it moves to enterprise/aibridged_integration_test.go.

In-place edits:
- enterprise/cli/server.go drops the bridge-daemon start block and the
  outdated TODO about lifecycle being enterprise-owned; only the proxy
  daemon start remains here. cli/server.go (AGPL) now constructs the
  bridge daemon next to the env-seed step.
- enterprise/coderd/coderd.go drops the aibridgedHandler field
  (now on the AGPL API) and reads it through api.AGPL.GetAIBridgedHandler.
- enterprise/coderd/aibridge.go reads api.AGPL.GetAIBridgedHandler().

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dannykopping dannykopping force-pushed the dk/aibridged-to-agpl branch from c51efb0 to a02a9bd Compare May 22, 2026 06:58
@dannykopping dannykopping merged commit ddec110 into main May 22, 2026
27 checks passed
@dannykopping dannykopping deleted the dk/aibridged-to-agpl branch May 22, 2026 07:11
@github-actions github-actions Bot locked and limited conversation to collaborators May 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants