Repository navigation
feat: use AI provider chat APIs - #25415
Conversation
|
/coder-agents-review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea3c1ab416
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
First-pass review (Netero). This is a mechanical scan; the full review panel has not yet reviewed this PR. 3 P2, 3 P3.
The migration approach is clean: existing query contracts are preserved while the internal implementation switches to AI provider APIs. The Go handler branching for AI-provider-backed vs. legacy configs is straightforward.
The P2 findings are: non-atomic key rotation in the frontend mutation (keys deleted before replacement is confirmed), hardcoded boolean fields that silently swallow UI toggle state, and no Go test coverage for the new validation paths. The P3s cover an N+1 request pattern, stale Storybook spies, and duplicated provider-lookup logic.
These are first-pass findings. The panel will review after they are addressed.
"271 new lines of production code (Go + TS), 3 lines of test changes (story fixture type adjustments)." (Netero)
site/src/pages/AgentsPage/components/ChatModelAdminPanel/ChatModelAdminPanel.stories.tsx:73
P3 [DEREM-5] setupChatSpies still mocks getChatProviderConfigs, createChatProviderConfig, updateChatProviderConfig, deleteChatProviderConfig, but the query functions now call listAIProviders, listAIProviderKeys, createAIProvider, createAIProviderKey, updateAIProvider, deleteAIProvider. The 6 stories using setupChatSpies set up spies that never intercept.
🤖
🤖 This review was automatically generated with Coder Agents.
|
/coder-agents-review |
1 similar comment
|
/coder-agents-review |
There was a problem hiding this comment.
Round 2 is blocked. The three P2 findings (DEREM-1, DEREM-2, DEREM-3) were addressed. The three remaining P3 findings have no author response and no code changes:
- DEREM-4 (P3,
chats.ts:1614): N+1 HTTP requests inchatProviderConfigsquery (1listAIProviders+ NlistAIProviderKeyscalls). Previous implementation was a single call. - DEREM-5 (P3,
ChatModelAdminPanel.stories.tsx:73):setupChatSpiesstill mocks API methods the query functions no longer call. Six stories set up spies that never intercept. - DEREM-6 (P3,
exp_chats.go:7468): AI provider lookup logic duplicated betweencreateChatModelConfigandupdateChatModelConfig.
Further review is blocked until the author responds to or addresses these findings. A response acknowledging, contesting, or deferring each finding is sufficient to unblock.
🤖 This review was automatically generated with Coder Agents.
There was a problem hiding this comment.
Round 3 is still blocked. The three P3 findings from round 1 remain without author response across two consecutive blocked rounds:
- DEREM-4 (P3,
chats.ts:1614): N+1 HTTP requests inchatProviderConfigsquery. - DEREM-5 (P3,
ChatModelAdminPanel.stories.tsx:73):setupChatSpiesmocks methods the query functions no longer call. - DEREM-6 (P3,
exp_chats.go:7468): AI provider lookup logic duplicated between create and update handlers.
A brief acknowledgment, contest, or deferral on each finding is sufficient to unblock the full panel review.
🤖 This review was automatically generated with Coder Agents.
Acknowledging remaining P3s:
|
|
/coder-agents-review |
1 similar comment
|
/coder-agents-review |
There was a problem hiding this comment.
Round 4 first-pass review (Netero). The full review panel has not yet reviewed this PR. 1 P2 (reopened), 1 new P3.
The three P2 findings from R1 were addressed, and the three P3s were acknowledged by the author. However, DEREM-3 is reopened: the tests added in e82b66fb9 and 1a3338cf4 cover AI provider CRUD and subagent resolution, but no test exercises the if req.AIProviderID != nil branch in createChatModelConfig or updateChatModelConfig. The untested paths include: creating a model config linked to an AI provider, rejecting a disabled provider, rejecting a nonexistent provider ID, and the requireChatProviderForModelConfig skip.
New finding: normalizeProviderPolicyDefaults is dead code after this PR removes its only production import.
The panel will review after DEREM-3 is addressed.
"Those commits added TestAIProviderCRUD and subagent resolution tests, but neither exercises the
if req.AIProviderID != nilbranch in createChatModelConfig or updateChatModelConfig." (Netero)
site/src/pages/AgentsPage/components/ChatModelAdminPanel/providerPolicyDefaults.ts:16
P3 [DEREM-7] normalizeProviderPolicyDefaults was the sole production import from this module (via ProviderForm.tsx), and this PR removes that import. The module and its test file (providerPolicyDefaults.test.ts) are now dead code. Delete both files.
🤖
🤖 This review was automatically generated with Coder Agents.
There was a problem hiding this comment.
Round 5 is blocked. Two open findings have no author response:
- DEREM-3 (P2,
exp_chats.go:7494): No tests exercise theAIProviderIDbranch increateChatModelConfigorupdateChatModelConfig. The prior fix (e82b66fb9) covered AI provider CRUD, not the model config handlers. - DEREM-7 (P3,
providerPolicyDefaults.ts:16):normalizeProviderPolicyDefaultsand its test file are dead code after this PR removes the only production import.
A brief acknowledgment, contest, or deferral on each is sufficient to unblock the panel review.
🤖 This review was automatically generated with Coder Agents.
|
/coder-agents-review |
1 similar comment
|
/coder-agents-review |
There was a problem hiding this comment.
Round 6 is blocked. DEREM-7 (dead code) was addressed by deleting providerPolicyDefaults.ts and its test.
One open finding remains without author response:
- DEREM-3 (P2,
exp_chats.go:7494): No tests exercise theAIProviderIDbranch increateChatModelConfigorupdateChatModelConfig. New test commits since R4 added coverage for AI provider CRUD (input normalization, base URL validation, delete missing, large key) and user key flows (reject disabled provider), but none setAIProviderIDonCreateChatModelConfigRequestorUpdateChatModelConfigRequest. The specific model config handler paths remain uncovered.
A brief acknowledgment, contest, or deferral is sufficient to unblock the panel review.
🤖 This review was automatically generated with Coder Agents.
There was a problem hiding this comment.
Round 7 is blocked (3rd consecutive blocked round). The sole remaining open finding has no author response:
- DEREM-3 (P2,
exp_chats.go:7494): No tests exercise theAIProviderIDbranch increateChatModelConfigorupdateChatModelConfig. Commits since R4 added AI provider CRUD tests, user key tests, and docs edits, but none setAIProviderIDonCreateChatModelConfigRequestorUpdateChatModelConfigRequest.
This finding has been open since R1 (reopened R4) and blocked since R5. A brief acknowledgment, contest, or deferral unblocks the panel.
🤖 This review was automatically generated with Coder Agents.
|
/coder-agents-review |
There was a problem hiding this comment.
Round 8 is blocked (4th consecutive). DEREM-3 (P2) remains the sole open finding with no author response since it was reopened in R4.
- DEREM-3 (P2,
exp_chats.go:7494): No tests exercise theAIProviderIDbranch increateChatModelConfigorupdateChatModelConfig.
This has been raised in every review since R4. An acknowledgment, contest, or deferral unblocks the panel.
🤖 This review was automatically generated with Coder Agents.
|
/coder-agents-review |
Response to the remaining frontend-cutover finding:
|
|
/coder-agents-review |
7 similar comments
|
/coder-agents-review |
|
/coder-agents-review |
|
/coder-agents-review |
|
/coder-agents-review |
|
/coder-agents-review |
|
/coder-agents-review |
|
/coder-agents-review |
77974aa to
9548275
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9548275f18
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
9548275 to
88405e8
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 88405e8d13
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
88405e8 to
43d83ca
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 43d83ca9f4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
43d83ca to
0adf570
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0adf570860
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
0adf570 to
b2fe994
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b2fe99418e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b5a2ebfff2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
/coder-agents-review |
There was a problem hiding this comment.
Full re-review after major restructure (35 files, 4147 diff lines vs 15 files at R12). Prior DEREM-1 through DEREM-14 all closed.
The restructuring does a lot well: the new AsAIProviderMetadataReader actor is correctly scoped to a single read permission, the user AI provider key lifecycle has thorough test coverage (six subtests, full round-trip through the database), the AddProviderFromMenu story exercises the new dropdown-to-form flow end-to-end, and the dead providerPolicyDefaults module was cleanly removed with zero orphaned references. The RBAC, SDK types, and frontend state machine are solid.
One P1 blocker: DEREM-15 (re-raise of DEREM-9). The frontend write path was rewired to ai_providers, but the runtime read path (GetEnabledChatModelConfigs) still INNER JOINs on chat_providers. On fresh deployments or for new provider types, non-admin users see zero models. 10 of 20 reviewers independently identified this. As ryosuke put it: "Like a car with a new fuel line that bypasses the engine."
Severity count: 1 P1. Prior acknowledged findings (DEREM-4, 5, 6, 14) not re-raised.
🤖 This review was automatically generated with Coder Agents.
|
/coder-agents-review |
There was a problem hiding this comment.
R18 re-review verifies the R17 P1 fix (DEREM-15, ea355175dd). All 3 panelists confirmed the LEFT JOIN on both ai_providers and chat_providers with conditional WHERE correctly routes AI-provider-backed and legacy model configs. The dedicated test (TestGetEnabledChatModelConfigsUsesAIProviders) covers enabled, disabled-provider, disabled-model, and legacy paths against real Postgres.
No new findings.
Across 18 rounds: 15 findings (3 P1, 4 P2, 8 P3). 11 fixed, 4 author-accepted. All closed.
🤖 This review was automatically generated with Coder Agents.
Stack Context
This stack now starts from
main. PR #25412 and PR #25414 were merged intomain, so this PR contains only the API, SDK, frontend, and test cutover work.Active Stack
mike/ai-providers/frontend-cutovermainmike/ai-providers/legacy-cleanupmike/ai-providers/frontend-cutoverWhat?
/api/v2/ai/providersREST API and embeddedapi_keysmutations for admin provider configs./api/experimental/users/{user}/ai-provider-keysand updates SDK/frontend callers.Follow-up
Validation
go test ./enterprise/coderd -run 'TestChatStreamRelay|TestChatModelConfigDefault|TestCreateChatNonDefaultOrg|TestListChats_OrgAdminOnlySeesOwnChats' -count=1go test ./coderd/x/chatd -run 'TestResolveUserProviderAPIKeys_AIProvider|TestProviderAPIKeysFromAIProviders|TestSubagentChatExcludesWorkspaceProvisioningTools|TestPlanModeSubagentChatExcludesAskUserQuestion|TestExploreSubagentIsReadOnly|TestCreateWorkspaceTool_EndToEnd|TestStartWorkspaceTool_EndToEnd|TestAgentContextFilesAndSkillsLoadedIntoChat' -count=1make pre-commit