Skip to content

refactor: clarify chat model resource names - #27958

Merged
ethanndickson merged 3 commits into
ethan/codagt-709-model-config-rbacfrom
ethan/codagt-709-model-config-sdk-rename
Aug 24, 2026
Merged

ethanndickson merged 3 commits into
ethan/codagt-709-model-config-rbacfrom
ethan/codagt-709-model-config-sdk-rename

Conversation

@ethanndickson

@ethanndickson ethanndickson commented Aug 10, 2026 •

Copy link
Copy Markdown
Member

Rename the admin-managed SDK resource from ChatModelConfig to ChatModel. Rename catalog entries from ChatModel to ChatModelCatalogEntry and replace ChatModelsResponse with ChatModelAvailabilityResponse.

API routes and JSON fields do not change. Experimental SDK and OpenAPI schema names do change.

Depends on #27957

This pull request description was generated by Coder Agents.

@linear-code

linear-code Bot commented Aug 10, 2026

Copy link
Copy Markdown

CODAGT-709

@github-actions

github-actions Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Docs preview

Check off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here.

@ethanndickson
ethanndickson force-pushed the ethan/codagt-709-model-config-sdk-rename branch from 12518dc to 9c5e45d Compare August 10, 2026 06:57
@ethanndickson
ethanndickson force-pushed the ethan/codagt-709-model-config-sdk-rename branch 2 times, most recently from 6cd36b0 to af0c8f2 Compare August 10, 2026 13:33
@ethanndickson
ethanndickson force-pushed the ethan/codagt-709-model-config-sdk-rename branch from af0c8f2 to 4eb5220 Compare August 10, 2026 23:52
@ethanndickson
ethanndickson force-pushed the ethan/codagt-709-model-config-sdk-rename branch from 4eb5220 to f1bf90a Compare August 11, 2026 00:02
@ethanndickson
ethanndickson force-pushed the ethan/codagt-709-model-config-sdk-rename branch from f1bf90a to 2e9d79e Compare August 11, 2026 00:14
@ethanndickson
ethanndickson force-pushed the ethan/codagt-709-model-config-sdk-rename branch from 2e9d79e to 8be3571 Compare August 11, 2026 13:18
@ethanndickson
ethanndickson force-pushed the ethan/codagt-709-model-config-sdk-rename branch from 8be3571 to 24a005e Compare August 17, 2026 13:25
@ethanndickson
ethanndickson force-pushed the ethan/codagt-709-model-config-sdk-rename branch from 24a005e to 0e77870 Compare August 18, 2026 06:53
@ethanndickson
ethanndickson force-pushed the ethan/codagt-709-model-config-sdk-rename branch from 0e77870 to 359b944 Compare August 18, 2026 08:18

Copy link
Copy Markdown
Member Author

@codex review

Copy link
Copy Markdown
Member Author

/coder-agents-review

@coder-agents-review

coder-agents-review Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Chat: Review posted | View chat
Requested: 2026-08-19 11:04 UTC by @ethanndickson

Review history
  • R1 (2026-08-18): 17 reviewers, 2 Nit, 1 Note, 4 P2, 3 P3, COMMENT. Review
  • R2 (2026-08-19): 17 reviewers, 7 Nit, 1 Note, 4 P2, 7 P3, COMMENT. Review

deep-review v0.9.0 | Round 2 | 35481a8..b7c10df

Last posted: Round 2, 19 findings (4 P2, 7 P3, 7 Nit, 1 Note), COMMENT. Review

Finding inventory

Finding inventory - PR #27958

Findings

# Sev Status Location Summary Round Reviewer Posted
CRF-1 P2 Author fixed (b7c10df) codersdk/chats.go:712 MinimalChatModel breaks the codersdk Minimal* embedding convention R1 Pariston P2, Ryosuke P2, Kite Nit, Meruem Nit Yes
CRF-2 P2 Author fixed (b7c10df) codersdk/chats.go:2181 Half-renamed SDK surface: type identity of codersdk.ChatModel inverted while methods, DB, routes, helpers, TS paths and mocks keep Config R1 Ryosuke P2, Mafuuu P3, Knov P3, Pariston P3, Gon P3, Chopper Note, Meruem Note, Kite Note, Razor Note, Mafu-san Note Yes
CRF-3 P2 Author fixed (b7c10df) codersdk/chats.go:1535 Doc comments on CreateChatModelRequest and UpdateChatModelRequest still say "chat model config" R1 Gon P2, Leorio Nit, Kite Nit, Razor Nit Yes
CRF-4 P2 Author fixed (b7c10df) codersdk/chats.go:712 Doc comments on ChatModel and MinimalChatModel do not cross-reference or contrast the two types R1 Leorio P2 Yes
CRF-5 P3 Author fixed (b7c10df) .claude/docs/FRONTEND_PATTERNS.md:74 FE2 "Correct" example imports the deleted ChatModelConfig type R1 Nami P3, Hisoka Nit, Chopper Nit, Meruem Nit, Razor Nit Yes
CRF-6 P3 Author fixed (b7c10df) coderd/apidoc/swagger.json:16544 Swagger schema-name churn not disclosed in PR description R1 Ryosuke P3 Yes
CRF-7 P3 Author fixed (b7c10df) coderd/exp_chats_test.go:4003 Intermediate commit 41bedf490c does not compile R1 Leorio P3, Mafu-san Nit Yes
CRF-8 Nit Author fixed (b7c10df) coderd/x/chatd/chatprovider/chatprovider.go:644 newChatModel / sortChatModels construct catalog entries but keep the ChatModel stem R1 Netero, Mafu-san, Knov, Meruem Yes
CRF-9 Nit Author fixed (b7c10df) site/src/testHelpers/chatModels.ts:8 MockChatModelConfig typed as ChatModel breaks the FE9 Mock<Type> convention R1 Netero, Gon, Meruem, Nami, Ryosuke, Razor (Note) Yes
CRF-10 Note Author fixed (b7c10df) codersdk/chats.go:727 ChatModelAvailabilityResponse name/doc mismatch R1 Leorio Yes
CRF-11 P3 Open codersdk/chats.go:1540 R1 CRF-3 fix replaced stale wording with a factually wrong contract: doc claims only ContextLimit is required, but the create handler also rejects nil AIProviderID and empty Model with 400 R2 Hisoka P3, Leorio P3, Ryosuke P3 Yes
CRF-12 P3 Open codersdk/chats.go:1553 R1 CRF-3 fix replaced stale wording with an incomplete contract on UpdateChatModelRequest: doc says only nil pointer fields preserve, but the handler also preserves empty/whitespace Model and DisplayName, so callers cannot clear DisplayName R2 Hisoka P3, Leorio Note Yes
CRF-13 P3 Open site/src/modules/aiModels/providerStates.ts:13 ProviderState.modelConfigs: ChatModel[] field name collides with ChatModel.model_config sub-object, reintroducing the ambiguity CRF-4 disambiguated at the type. Propagates through pages/components/tests R2 Zoro P3 Yes
CRF-14 P3 Open codersdk/chats.go:2203 UpdateChatModel(ctx, modelConfigID uuid.UUID, ...) and DeleteChatModel(ctx, modelConfigID uuid.UUID) parameter names lag the type rename; TS mirrors carry the same modelConfigId R2 Gon P3, Mafuuu Nit, Pariston Nit, Zoro Nit Yes
CRF-15 Nit Open site/src/pages/AgentsPage/components/ChatElements/tools/Tool.stories.tsx:748 Local mockChatModelConfig const kept old name after shared fixture was renamed to MockChatModel; four references at :775, :805, :837, :865 R2 Netero, Bisky, Mafu-san, Pariston, Knov, Meruem, Nami, Razor Yes
CRF-16 Nit Open coderd/exp_chats_test.go:12644 Go test helpers keep ChatModelConfig stem while returning codersdk.ChatModel: createChatModelConfig* family in coderd/exp_chats_test.go, containsChatModelConfig in coderd/exp_chats_model_config_list_test.go, findChatModelConfigByID and TestChatModelConfigDefault in enterprise/coderd/exp_chats_test.go R2 Netero, Bisky, Mafuuu, Pariston, Meruem Yes
CRF-17 Nit Open scaletest/chat/client.go:24 scaletest package retains chatModelConfigClient interface, EnsureScaletestModelConfig / ensureScaletestChatModelConfig helpers, and matching log fields / error strings after their methods were renamed R2 Netero, Mafuuu, Ryosuke Yes
CRF-18 Nit Open codersdk/chats.go:930 AdvisorConfig.ModelConfigID doc says "chat model config" three times; sibling of CRF-3 the rename sweep missed R2 Leorio Yes
CRF-19 Nit Open coderd/coderdtest/chat.go:50 CreateOpenAICompatChatModel doc still describes returned value as "model config" after the return type became codersdk.ChatModel R2 Gon Yes
CRF-20 Nit Open (PR description) PR description says codersdk.MinimalChatModel is replaced by codersdk.ChatModelCatalogEntry, but MinimalChatModel never existed on the base branch; the missing bullet is that ChatModelConfig is removed and its shape now lives under ChatModel R2 Leorio Nit, Pariston Note Yes (body)
CRF-21 Note Open codersdk/chats.go:2014 ChatModelAvailability() and ChatModels() diverge from this file's List<Resource>() convention (ListChats, ListChatProviders, ListUserAIProviderKeyConfigs, ListUserChatProviderConfigs) R2 Pariston Note Yes (body)

Contested and acknowledged

None.

Round log

Round 1

Panel round. Netero found 2 Nit + 1 Note (all mechanical helper/mock naming, absorbed into CRF-8 / CRF-9 and the SDK-method Note absorbed into CRF-2). Panel converged strongly on the half-rename design decision: 10 findings from 17 reviewers, 4 P2 (naming convention violation, half-renamed SDK surface, stale request-type doc comments, doc comments that do not disambiguate ChatModel vs MinimalChatModel), 3 P3 (frontend patterns doc rot, swagger schema disclosure, broken intermediate commit), 2 Nit, 1 Note. Reviewed against 722e64a..359b944.

Round 2

Churn guard: PROCEED. All 10 R1 findings addressed. Author took Path 3 of CRF-1 (MinimalChatModel -> ChatModelCatalogEntry) and Path 1 of CRF-2 (complete rename across SDK methods, frontend fixtures, and internal helpers). Database row type and HTTP route intentionally unchanged; the author scoped that exception in the PR description. Diff regrew (+485/-492 -> +694/-686) because the rename now reaches SDK method names, frontend queries, and mock/helper identifiers. Rebased onto new base 35481a8 as a single commit b7c10df.

Panel R2 (17 reviewers) verified R1 fixes and found 11 new items: 4 P3 (two new-problem regressions on the CRF-3 doc rewrite for Create/Update semantics, one FE derived-state field name that reintroduces the CRF-4 ambiguity, and SDK parameter names modelConfigID that lag the type rename), 6 Nit (rename-sweep siblings on frontend story locals, Go test helpers, scaletest package identifiers, SDK doc comments, coderdtest doc comment, PR description compatibility list), 1 Note (SDK method naming convention divergence). Reviewed against 35481a8..b7c10df.

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 359b9444c5

ℹ️ 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".

Comment thread site/src/api/typesGenerated.ts Resolved

Copy link
Copy Markdown
Member Author

CRF-21 does not require a code change. ChatModelAvailability names the availability lookup, while ChatModels names the administrative model collection. Renaming these exported methods again would add API churn without a correctness gain.

This response was generated by Coder Agents.

@ethanndickson
ethanndickson force-pushed the ethan/codagt-709-model-config-sdk-rename branch from 5897e81 to 42f4d7a Compare August 20, 2026 12:03
@ethanndickson
ethanndickson force-pushed the ethan/codagt-709-model-config-sdk-rename branch from 42f4d7a to 2552123 Compare August 21, 2026 18:24
@ethanndickson
ethanndickson force-pushed the ethan/codagt-709-model-config-sdk-rename branch from 2552123 to 393fbc5 Compare August 21, 2026 18:50
@ethanndickson
ethanndickson force-pushed the ethan/codagt-709-model-config-sdk-rename branch from 393fbc5 to 6ba3f15 Compare August 21, 2026 19:11
@ethanndickson
ethanndickson marked this pull request as ready for review August 22, 2026 08:27

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 415e08de2f

ℹ️ 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".

Comment thread codersdk/chats.go Resolved
@ethanndickson
ethanndickson force-pushed the ethan/codagt-709-model-config-sdk-rename branch from 415e08d to 7179c61 Compare August 23, 2026 10:40

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 7179c61e99

ℹ️ 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".

@ethanndickson
ethanndickson force-pushed the ethan/codagt-709-model-config-sdk-rename branch from 7179c61 to ad11ae6 Compare August 24, 2026 09:05
@coderagents

coderagents Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Documentation Check

Updates Needed

  • docs/ai-coder/agents/models.md - The Set a default model section only documents the manual star-icon method and states "Only one model can be the default at a time." This PR's codersdk change (commit ad11ae6) clarifies user-visible behavior that is not reflected in the docs: the first model created in an organization is automatically promoted to default. Add a note to this section so admins know the first model becomes the default without manual action.

Note: The SDK/schema renames (ChatModelConfig → ChatModel, ChatModelsResponse → ChatModelAvailabilityResponse, catalog → ChatModelCatalogEntry) touch only auto-generated API reference docs (docs/reference/api/chats.md, docs/reference/api/schemas.md), which are regenerated by make gen and don't require manual edits. API routes and JSON fields are unchanged.


Automated review via Coder Agents

@ethanndickson
ethanndickson force-pushed the ethan/codagt-709-model-config-sdk-rename branch from ad11ae6 to 153ecba Compare August 24, 2026 09:30
@ethanndickson
ethanndickson merged commit 9bd8899 into main Aug 24, 2026
29 of 52 checks passed
@ethanndickson
ethanndickson deleted the ethan/codagt-709-model-config-sdk-rename branch August 24, 2026 09:43
ethanndickson added a commit that referenced this pull request Aug 24, 2026
## Summary

Move chat model management and runtime availability to
organization-scoped API routes. The API now identifies the organization
in every model-management operation, applies chat model RBAC and ACLs
within that organization, and returns only models the caller can use
there.

Depends on #27958.

## Problem

Chat model configurations now belong to organizations, but the existing
experimental management and discovery APIs are deployment-shaped. Their
routes do not identify an organization, SDK methods do not accept an
organization ID, and item operations address a model configuration by ID
alone.

That contract cannot safely expose organization-owned model
configurations. It also does not provide the organization-specific
provider information, authorization behavior, ACL management, or
recovery guidance needed by the settings and chat clients later in the
stack.

## Fix

Add organization-scoped chat model endpoints under:

```text
/api/experimental/organizations/{organization}/chats/models
```

The new API provides:

- Organization-scoped model listing and creation.
- Model get, update, and delete operations scoped by both organization
and model ID.
- Model ACL read and update operations.
- Organization-scoped runtime availability and provider status.
- Redacted provider descriptors for model-management clients.
- Chat model RBAC and row ACL enforcement for writes, runtime discovery,
and Chatd model selection.
- Recovery guidance when a chat's organization has no usable local
model.

Historical chats can retain a model reference owned by another
organization, but runtime selection uses an authorized local default
when one is available. Foreign, inaccessible, disabled, and otherwise
unusable models are not exposed as usable selections for the
organization.

The existing collection and availability routes remain as
default-organization compatibility endpoints in this layer:

```text
GET  /api/experimental/chats/model-configs
POST /api/experimental/chats/model-configs
GET  /api/experimental/chats/models
```

These compatibility routes do not provide access to models in
non-default organizations. The previous unscoped item update and delete
routes are removed because item operations must include the owning
organization.

## Breaking change

This changes the experimental HTTP API and Go SDK contracts for chat
model management.

Clients must migrate model-management and availability requests to the
organization-scoped routes and provide an organization identifier. In
the Go SDK, the following methods now require an organization ID:

- `ChatModelAvailability`
- `ChatModels`
- `CreateChatModel`
- `UpdateChatModel`
- `DeleteChatModel`

`ChatModels` also changes its return value from `[]ChatModel` to
`OrganizationChatModelsResponse`, which includes the organization models
and the redacted provider descriptors required by management clients.
New item and ACL methods likewise require both the organization ID and
model ID.

The default-organization compatibility routes reduce the immediate
impact for collection and availability callers, but they do not preserve
the previous item API or SDK method signatures. Generated clients and
direct consumers of the experimental API must be updated before adopting
this change.

_This pull request description was generated by Coder Agents._
aslilac pushed a commit that referenced this pull request Aug 24, 2026
Rename the admin-managed SDK resource from `ChatModelConfig` to
`ChatModel`. Rename catalog entries from `ChatModel` to
`ChatModelCatalogEntry` and replace `ChatModelsResponse` with
`ChatModelAvailabilityResponse`.

API routes and JSON fields do not change. Experimental SDK and OpenAPI
schema names do change.

Depends on #27957

_This pull request description was generated by Coder Agents._
aslilac pushed a commit that referenced this pull request Aug 24, 2026
## Summary

Move chat model management and runtime availability to
organization-scoped API routes. The API now identifies the organization
in every model-management operation, applies chat model RBAC and ACLs
within that organization, and returns only models the caller can use
there.

Depends on #27958.

## Problem

Chat model configurations now belong to organizations, but the existing
experimental management and discovery APIs are deployment-shaped. Their
routes do not identify an organization, SDK methods do not accept an
organization ID, and item operations address a model configuration by ID
alone.

That contract cannot safely expose organization-owned model
configurations. It also does not provide the organization-specific
provider information, authorization behavior, ACL management, or
recovery guidance needed by the settings and chat clients later in the
stack.

## Fix

Add organization-scoped chat model endpoints under:

```text
/api/experimental/organizations/{organization}/chats/models
```

The new API provides:

- Organization-scoped model listing and creation.
- Model get, update, and delete operations scoped by both organization
and model ID.
- Model ACL read and update operations.
- Organization-scoped runtime availability and provider status.
- Redacted provider descriptors for model-management clients.
- Chat model RBAC and row ACL enforcement for writes, runtime discovery,
and Chatd model selection.
- Recovery guidance when a chat's organization has no usable local
model.

Historical chats can retain a model reference owned by another
organization, but runtime selection uses an authorized local default
when one is available. Foreign, inaccessible, disabled, and otherwise
unusable models are not exposed as usable selections for the
organization.

The existing collection and availability routes remain as
default-organization compatibility endpoints in this layer:

```text
GET  /api/experimental/chats/model-configs
POST /api/experimental/chats/model-configs
GET  /api/experimental/chats/models
```

These compatibility routes do not provide access to models in
non-default organizations. The previous unscoped item update and delete
routes are removed because item operations must include the owning
organization.

## Breaking change

This changes the experimental HTTP API and Go SDK contracts for chat
model management.

Clients must migrate model-management and availability requests to the
organization-scoped routes and provide an organization identifier. In
the Go SDK, the following methods now require an organization ID:

- `ChatModelAvailability`
- `ChatModels`
- `CreateChatModel`
- `UpdateChatModel`
- `DeleteChatModel`

`ChatModels` also changes its return value from `[]ChatModel` to
`OrganizationChatModelsResponse`, which includes the organization models
and the redacted provider descriptors required by management clients.
New item and ACL methods likewise require both the organization ID and
model ID.

The default-organization compatibility routes reduce the immediate
impact for collection and availability callers, but they do not preserve
the previous item API or SDK method signatures. Generated clients and
direct consumers of the experimental API must be updated before adopting
this change.

_This pull request description was generated by Coder Agents._
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants