Skip to content

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

Merged
mafredri merged 1 commit into
mainfrom
mathias/codagt-627-copilot-provider-and-model-do-not-unlock-agents-page
Jun 30, 2026
Merged

mafredri merged 1 commit into
mainfrom
mathias/codagt-627-copilot-provider-and-model-do-not-unlock-agents-page

Conversation

@mafredri

@mafredri mafredri commented Jun 29, 2026 •

Copy link
Copy Markdown
Member

A deployment whose only AI provider is GitHub Copilot got stuck on the Agents page: it kept showing "set up a provider then add a model" even with a provider and models configured, and adding a throwaway Anthropic provider was the only way to unlock it. The model catalog silently dropped any provider type it did not recognize, so a Copilot-only setup looked identical to an empty one.

The Agents harness cannot use Copilot, which authenticates with a per-request token only an official Copilot client can mint. So instead of dropping the provider, this surfaces it. Whether Agents can use a provider is derived from its type (no migration), and that one signal drives the UI: the empty state now says the configured providers are not supported by Agents and points to AI Settings, the model picker omits them, and AI Settings labels them. Unsupported providers keep working through the AI Gateway proxy, and nothing is blocked.

Copilot-only: the empty state names the reason instead of asking to set up a provider

1-agents-empty-state

AI Settings labels the unsupported provider; supported providers are untouched

With a supported provider, the picker works and omits Copilot

Real Copilot support in Agents needs a swappable harness running an official client and is out of scope (CODAGT-256).

Closes CODAGT-627. Refs CODAGT-256, CODAGT-682.

🤖 This PR was created with the help of Coder Agents, and will be reviewed by a human. 🏂🏻

@linear-code

linear-code Bot commented Jun 29, 2026 •

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Docs preview

📖 View docs preview for docs/ai-coder/agents/models.md

@mafredri
mafredri force-pushed the mathias/codagt-627-copilot-provider-and-model-do-not-unlock-agents-page branch 3 times, most recently from 3b373fa to 421a5e9 Compare June 30, 2026 09:30
@mafredri mafredri changed the title fix(coderd/x/chatd): stop Agents dead-ending on unservable providers fix(coderd/x/chatd): stop Agents dead-ending on unsupported providers Jun 30, 2026
@mafredri mafredri changed the title fix(coderd/x/chatd): stop Agents dead-ending on unsupported providers fix: stop Agents dead-ending on unservable providers Jun 30, 2026
@mafredri
mafredri force-pushed the mathias/codagt-627-copilot-provider-and-model-do-not-unlock-agents-page branch 2 times, most recently from ed6ecfb to 8d8b388 Compare June 30, 2026 10:50
@mafredri

Copy link
Copy Markdown
Member Author

/coder-agents-review

@coder-agents-review

coder-agents-review Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Chat: Review posted | View chat
Requested: 2026-06-30 14:10 UTC by @mafredri
Spend: $58.77 / $100.00

Review history
  • R1 (2026-06-30): 16 reviewers, 2 Nit, 2 P3, COMMENT. Review
  • R2 (2026-06-30): 8 reviewers, 3 Nit, 2 P3, COMMENT. Review

deep-review v0.9.0 | Round 2 | ce94d42..a0eb562

Last posted: Round 2, 5 findings (2 P3, 3 Nit), COMMENT. Review

Finding inventory

Findings

# Sev Status Location Summary Round Reviewer Posted
CRF-1 P3 Author fixed (3876730) chatprovider.go:87 UnsupportedProviders returns nil; JSON serializes as null not [] R1 Ryosuke P3, Kite P3 Yes
CRF-2 P3 Author contested; panel closed R2 (5/5 accept) db2sdk.go:578 ~30 lines of drive-by modernization in unrelated functions R1 Mafu-san P3 Yes
CRF-3 Nit Author fixed (3876730) chatprovider.go:78 Comment restates the preceding if block R1 Gon P2 (downgraded) Yes
CRF-4 Nit Author fixed (3876730) AgentSetupNotice.tsx:31 hasOnlyUnsupportedProviders checks "any" but name says "only" R1 Razor Nit, Meruem Note Yes
CRF-5 P4 Dropped by orchestrator (single-element callers, trivially correct) AgentSetupNotice.tsx:13 formatProviderList 2-item and 3+ branches untested R1 Bisky P4 No
CRF-6 Note Dropped by orchestrator (design observation, not a defect) chatprovider.go:71 AgentsSupportsProvider couples "normalizes" with "can serve" R1 Ryosuke, Meruem, Razor No
CRF-7 Note Dropped by orchestrator (alternative, not a defect) AgentSetupNotice.tsx:13 formatProviderList hand-rolls Intl.ListFormat R1 Ging-React No
CRF-8 Nit Open chatprovider.go:67 Doc comment second sentence restates the 3-line body R2 Gon P2 (downgraded) Yes

Round log

Round 1

Panel. 2 P3, 2 Nit, 1 P4, 2 Note. 3 dropped. Reviewed against ce94d42..8d8b38836942.

Round 2

Panel. CRF-1/3/4 fixed, CRF-2 panel-closed. 1 new Nit. Reviewed against ce94d42..a0eb56250fe7.

Contested and acknowledged

CRF-2 (P3, db2sdk.go:578) - Drive-by modernization

  • Finding: ~30 lines of mechanical modernization in functions unrelated to the fix, violating "No drive-by changes" project rule.
  • Author defense: "Not initially, I wanted it to modernize all additions but it went from narrow -> expanded scope. I think the changes are mild enough to ride this PR but can be split out if requested."
  • Panel closure (R2, 5/5): Ryosuke verified all changes are behavior-preserving and independently reviewable. Kite noted the chatprovider.go changes are in files already modified for feature work, db2sdk.go touches unrelated converters but consequence is minor diff noise. Meruem confirmed no structural risk. Pariston and Mafuuu found no domain-specific concerns. Whether the scope expansion is acceptable is a human reviewer call.
About deep-review

CRF = Coder Review Finding (P0-P4, Nit, Note)

Reviewer Focus
Bisky tests
Chopper ops/errors
Churn-guard change verification
Ging language modernization
Gon naming
Hisoka edge cases
Killua perf
Kite change integrity
Knov contracts
Knuckle SQL
Komugi flake/determinism
Kurapika security
Law decomposition
Leorio docs
Luffy product
Mafu-san process
Mafuuu contracts
Melody dispatch/pairing
Meruem structural
Nami frontend
Netero mechanical checks
Pariston premise testing
Pen-botter product gaps
Razor verification
Robin duplication
Ryosuke Go arch
Takumi concurrency
Zoro shape

🤖 Managed by Coder Agents.

@mafredri
mafredri requested a review from Copilot June 30, 2026 10:56
@mafredri
mafredri force-pushed the mathias/codagt-627-copilot-provider-and-model-do-not-unlock-agents-page branch from 8d8b388 to 4b0e18b Compare June 30, 2026 10:59
@mafredri mafredri changed the title fix: stop Agents dead-ending on unservable providers fix: stop Agents dead-ending on unsupported providers Jun 30, 2026

@DanielleMaywood DanielleMaywood left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a quick comment but this PR has random unrelated code changes in it. Intended?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Prevents the Agents UI from dead-ending when the only configured AI providers are unservable by the Agents harness (notably GitHub Copilot) by explicitly surfacing “unsupported providers” in the model catalog and updating the UI to explain the situation.

Changes:

  • Adds agents_supported / agents_unsupported_reason to AI provider API responses and labels unsupported providers in AI Settings.
  • Extends the chat model catalog response with unsupported_providers and uses it to drive an improved Agents empty state and omit unsupported providers from the picker.
  • Updates Storybook stories and unit tests across site + Go to cover the new “unsupported provider” behavior.

Reviewed changes

Copilot reviewed 30 out of 31 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
site/src/testHelpers/entities.ts Updates AI provider mocks with agents_supported and Copilot unsupported reason.
site/src/pages/AISettingsPage/ProvidersPage/components/ProviderRow.tsx Shows “Not supported in Agents” badge for providers the harness cannot serve.
site/src/pages/AISettingsPage/ProvidersPage/components/ProviderRow.stories.tsx Adds stories and interaction checks for the unsupported badge behavior.
site/src/pages/AgentsPage/utils/modelOptions.ts Adds helper to derive unsupported provider names from the catalog.
site/src/pages/AgentsPage/utils/modelOptions.test.ts Tests getUnsupportedProviderNames behavior across supported/unsupported combinations.
site/src/pages/AgentsPage/components/ChatPageContent.tsx Threads unsupportedProviderNames down into the Agents chat input.
site/src/pages/AgentsPage/components/AgentSetupNotice.tsx Adds an empty-state branch that explains “configured but not supported by Agents”.
site/src/pages/AgentsPage/components/AgentSetupNotice.stories.tsx Adds stories validating the new empty-state messaging for admin and members.
site/src/pages/AgentsPage/components/AgentCreateForm.tsx Passes unsupportedProviderNames to setup notice rendering in create flow.
site/src/pages/AgentsPage/components/AgentCreateForm.stories.tsx Updates model catalog fixtures to include unsupported_providers.
site/src/pages/AgentsPage/components/AgentChatInput.tsx Passes unsupportedProviderNames into setup notice rendering in chat input.
site/src/pages/AgentsPage/AgentsPageView.stories.tsx Updates story fixtures for new catalog shape.
site/src/pages/AgentsPage/AgentCreatePage.tsx Computes unsupportedProviderNames from the chat models query and passes it to the form.
site/src/pages/AgentsPage/AgentChatPageView.tsx Threads unsupportedProviderNames through the chat page view.
site/src/pages/AgentsPage/AgentChatPage.tsx Computes unsupportedProviderNames and passes it into the page view.
site/src/pages/AgentsPage/AgentChatPage.stories.tsx Updates story catalog fixtures to include unsupported_providers.
site/src/modules/aiModels/providerStates.test.ts Updates catalog fixtures for new unsupported_providers field.
site/src/api/typesGenerated.ts Adds generated types for provider Agents support fields and unsupported provider catalog list.
docs/reference/api/schemas.md Documents new AI provider fields and new unsupported_providers schema.
docs/reference/api/chats.md Updates chat models endpoint example to include unsupported_providers.
docs/reference/api/aiproviders.md Documents new AI provider fields in the providers endpoints.
codersdk/chats.go Adds UnsupportedProviders to ChatModelsResponse and introduces ChatUnsupportedProvider.
codersdk/aiproviders.go Adds Agents support fields and unsupported-reason enum to AIProvider.
coderd/x/chatd/chatprovider/chatprovider.go Adds support detection for Agents + builds unsupported provider list; minor sorting/parsing refactors.
coderd/x/chatd/chatprovider/chatprovider_test.go Adds tests for Agents support detection and unsupported provider list behavior.
coderd/exp_chats.go Attaches unsupported providers to the chat model catalog response for UI empty-state use.
coderd/exp_chats_test.go Adds coverage that Copilot does not appear in supported providers and is surfaced as unsupported.
coderd/database/db2sdk/db2sdk.go Populates AgentsSupported / AgentsUnsupportedReason on AIProvider SDK conversions.
coderd/database/db2sdk/db2sdk_test.go Adds test coverage for AgentsSupported mapping in db2sdk conversion.
coderd/apidoc/swagger.json Updates OpenAPI schema with new AI provider fields and chat catalog unsupported providers.
coderd/apidoc/docs.go Updates embedded OpenAPI doc template with the same schema additions.
Files not reviewed (1)
  • coderd/apidoc/docs.go: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread codersdk/aiproviders.go Resolved
Comment thread docs/reference/api/schemas.md Resolved
Comment thread docs/reference/api/aiproviders.md Resolved
Comment thread docs/reference/api/aiproviders.md Resolved
Comment thread docs/reference/api/aiproviders.md Resolved
Comment thread docs/reference/api/aiproviders.md Resolved
Comment thread codersdk/aiproviders.go Resolved
@mafredri

Copy link
Copy Markdown
Member Author

Just a quick comment but this PR has random unrelated code changes in it. Intended?

Not initially, I wanted it to modernize all additions but it went from narrow -> expanded scope. I think the changes are mild enough to ride this PR but can be split out if requested.

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean, well-scoped fix. The single-predicate design is sound: AgentsSupportsProvider wraps the existing NormalizeProvider gate, the parallel UnsupportedProviders field preserves catalog correctness while surfacing what the UI needs, and the three test levels (unit, converter, integration) cover the full stack. Test density at 61% with real play-function stories.

Two P3s, two nits. No blocking issues.

Three reviewers independently noted the coupling between NormalizeProvider and AgentsSupportsProvider: every NormalizeProvider entry must be a type the harness can call without external credential minting. The invariant holds today and the DB enum bounds the risk, but the next editor should know.

Pariston's differential diagnosis is worth quoting: "I tried to build a case against this and couldn't. The premises hold." The four framings (silent drop, conflated abstraction, missing adapter, UI-only fix) each had a clean rebuttal grounded in the code.

🤖 This review was automatically generated with Coder Agents.

Comment thread coderd/database/db2sdk/db2sdk.go Resolved
@mafredri
mafredri force-pushed the mathias/codagt-627-copilot-provider-and-model-do-not-unlock-agents-page branch 4 times, most recently from cf27548 to 5249bb6 Compare June 30, 2026 12:24
Comment thread codersdk/aiproviders.go Resolved
Comment thread coderd/exp_chats_test.go Resolved
@mafredri
mafredri force-pushed the mathias/codagt-627-copilot-provider-and-model-do-not-unlock-agents-page branch from 5249bb6 to 6a4d4ab Compare June 30, 2026 13:19
@mafredri
mafredri force-pushed the mathias/codagt-627-copilot-provider-and-model-do-not-unlock-agents-page branch from 6a4d4ab to a0eb562 Compare June 30, 2026 13:22
@mafredri
mafredri requested a review from Copilot June 30, 2026 14:09
@mafredri

Copy link
Copy Markdown
Member Author

/coder-agents-review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 29 out of 30 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • coderd/apidoc/docs.go: Generated file

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review after significant restructuring. The PR adopted human reviewer feedback well: removed per-provider API fields in favor of a codersdk-level enum, simplified the reason type to a plain bool predicate, and added documentation at docs/ai-coder/agents/models.md.

CRF-1 (nil-vs-empty slice): verified fixed. CRF-3 (restating comment): verified fixed. CRF-4 (misleading variable name): verified fixed. CRF-2 (drive-by modernization): panel closed, 5/5 accept. All changes are behavior-preserving and independently reviewable; whether the scope expansion rides this PR is a human reviewer call.

The AgentsUnsupportedProviderType enum design is clean: one type in codersdk drives both the Go predicate and the generated frontend list. Mafuuu noted the enum/switch sync is manual (adding a const without updating the switch would create a frontend-only badge), but for a single-member enum the risk is minimal.

Kite's observation is worth noting: "If copilot is ever added to NormalizeProvider, the explicit unsupported check still blocks it from the Agents harness. Without the enum, that normalization addition would silently make copilot supported." The two-layer check (explicit enum + NormalizeProvider) is defensive in the right direction.

One new nit. No blocking issues.

🤖 This review was automatically generated with Coder Agents.

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

Copilot is not supported by the Agents harness: it needs a per-request
token only an official Copilot client can mint, and the harness is not
one. Rather than hide that, compute Agents support from the provider
type and surface it. The catalog now reports configured-but-unsupported
providers, the model picker omits them, the empty state explains that
the configured providers are not supported by Agents and links to AI
Settings and the docs, and AI Settings labels them. The providers stay
fully 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: the chatd catalog predicate consults it, and the generated
AgentsUnsupportedProviderTypes list drives the frontend label.

Generated with `coder` agents on behalf of @mafredri.
@mafredri
mafredri force-pushed the mathias/codagt-627-copilot-provider-and-model-do-not-unlock-agents-page branch from a0eb562 to bac9ca5 Compare June 30, 2026 15:20
@mafredri
mafredri marked this pull request as ready for review June 30, 2026 15:43
@mafredri
mafredri merged commit 2fd5ae4 into main Jun 30, 2026
41 of 42 checks passed
@mafredri
mafredri deleted the mathias/codagt-627-copilot-provider-and-model-do-not-unlock-agents-page branch June 30, 2026 15:49
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 30, 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.

4 participants