fix: stop Agents dead-ending on unsupported providers (#26841)

Configuring only a GitHub Copilot provider left the Agents page stuck on
"set up a provider then add a model", even with a provider and models
configured. The catalog dropped any provider type that NormalizeProvider
did not recognize, so a Copilot-only deployment looked identical to an
empty one and never unlocked the page.

The Agents harness cannot use Copilot: it needs a per-request token only
an official Copilot client can mint, and the harness is not one. Instead
of dropping such providers, the catalog now reports them as unsupported
so the UI can explain the dead end and point elsewhere, rather than ask
for setup that already happened. The providers stay usable through the
AI Gateway proxy.

Support is derived from the provider type, not stored, so there is no
migration. codersdk.IsAgentsUnsupportedProviderType is the single source
of truth, consulted by the chatd catalog and, through the generated
AgentsUnsupportedProviderTypes list, the frontend.

The diff also carries unrelated modernization of nearby db2sdk and
chatprovider helpers (slices.SortFunc, strings.Cut, range-over-int).

Closes CODAGT-627
Refs CODAGT-256
Refs CODAGT-682
This commit is contained in:
Mathias Fredriksson
2026-06-30 18:49:50 +03:00
committed by GitHub
parent a79fcd34af
commit 2fd5ae4323
30 changed files with 589 additions and 37 deletions
+6
View File
@@ -35,6 +35,12 @@ models, internal gateways, or third-party proxies like LiteLLM.
Coder Agents route model requests through AI Gateway automatically by using
the provider configuration stored in Coder's database.
Some provider types work as AI Gateway proxy targets but cannot back Coder
Agents. GitHub Copilot, for example, authenticates with a per-request token
that only an official Copilot client can mint, so the server-side Agents
harness cannot use it. Configuring such a provider does not unlock Agents;
add one of the supported provider types above instead.
### Add a provider
LLM providers are managed from the deployment AI settings, not from the Agents
+6
View File
@@ -604,6 +604,12 @@ Experimental: this endpoint is subject to change.
"provider": "string",
"unavailable_reason": "missing_api_key"
}
],
"unsupported_providers": [
{
"display_name": "string",
"provider": "string"
}
]
}
```
+26 -3
View File
@@ -3190,15 +3190,22 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
"provider": "string",
"unavailable_reason": "missing_api_key"
}
],
"unsupported_providers": [
{
"display_name": "string",
"provider": "string"
}
]
}
```
### Properties
| Name | Type | Required | Restrictions | Description |
|-------------|-------------------------------------------------------------------|----------|--------------|-------------|
| `providers` | array of [codersdk.ChatModelProvider](#codersdkchatmodelprovider) | false | | |
| Name | Type | Required | Restrictions | Description |
|-------------------------|-------------------------------------------------------------------------------|----------|--------------|------------------------------------------------------------------------------------------------------------------------|
| `providers` | array of [codersdk.ChatModelProvider](#codersdkchatmodelprovider) | false | | |
| `unsupported_providers` | array of [codersdk.ChatUnsupportedProvider](#codersdkchatunsupportedprovider) | false | | Unsupported providers lists configured providers the Agents harness cannot use, so the UI can explain the empty state. |
## codersdk.ChatPlanMode
@@ -3824,6 +3831,22 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
| `tool_call_id` | string | false | | |
| `tool_name` | string | false | | |
## codersdk.ChatUnsupportedProvider
```json
{
"display_name": "string",
"provider": "string"
}
```
### Properties
| Name | Type | Required | Restrictions | Description |
|----------------|--------|----------|--------------|------------------------------------------------|
| `display_name` | string | false | | |
| `provider` | string | false | | Provider is the provider type, e.g. "copilot". |
## codersdk.ChatUser
```json