Repository navigation
feat: let custom agent definitions name a model by alias - #100
Conversation
|
@codex review
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review
|
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ 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". |
UAT: PASS on 9c519f4. It ran in Colima on a slim binary with a mock provider and two AI providers. P1 has mock-a (no aliases) and mock-b (
|
…es-r12-2-model-aliases # Conflicts: # docs/fork/pstack-adapter.md
Merged How the doc resolution works: it keeps main's citation lines, including #95's
Validation on
Because the merge changes no behavior, the earlier UAT verdict still holds. @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 72ae96c124
ℹ️ 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".
…es-r12-2-model-aliases # Conflicts: # docs/fork/pstack-adapter.md
Merged The one Codex finding on @codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ 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". |
Closing and reopening only to make GitHub recompute the merge ref against current main ( |
The merge ref now points at current main ( |
Merge evidence for head
|
Part of #7
With
fork-agent-definitionson, a custom agent definition'smodelcan now name an alias, such asfast, that an admin lists on a model config (brief item R12.2). Before this change,modelhad to match a model config ID, model or display name, so a definition written for one deployment broke on another that named its models differently.Change
codersdk.ChatModelCallConfiggetsaliases, stored in the existingoptionsJSONB, so there is no migration. The admin model form shows it as a generated field.validateChatModelAliases(coderd/fork_chat_model_aliases.go) runs on model config create and update, inside the existing transaction. Each alias must be 1 to 32 lowercase letters, digits or hyphens, must not beinherit, must be listed once, and must not belong to another model config of the same AI provider in the organization. Failures return 400Invalid model aliases.with the reason.resolveCustomAgentModeltries the model config ID, model and display name first, as before, then falls back toresolveCustomAgentModelAlias(coderd/x/chatd/fork_model_aliases.go). The alias match ignores case. One match wins. When models on several providers share the alias, the one on the parent chat's AI provider wins; otherwise the spawn fails and lists the matches.list_subagent_modelsshows each model'saliases, so the parent agent can see them. With it off, the tool output stays as upstream.docs/fork/pstack-adapter.mdmaps model slugs to aliases and updates the line citations that moved.With the experiment off, spawns and
list_subagent_modelsbehave as upstream. An admin can still store aliases, which only take effect with the experiment on.Tests
TestForkChatModelAliases(coderd): create with aliases, a duplicate on the same provider, reuse on another provider,inherit, uppercase, a repeated alias, a config keeping its own alias on update, and an update that moves a config onto a provider where its alias is taken.TestIsZeroChatModelCallConfigCoversEveryFieldnow samplesAliases, so an aliases-only config is stored.TestForkAgentDefinitionModelAlias(chatd): the parent's provider wins, a single match on another provider, an exact model name beating an alias, an alias on two other providers failing with both listed, andlist_subagent_modelsshowing aliases.TestForkModelAliasesHiddenWithoutExperiment(chatd): with the experiment off,list_subagent_modelslists the aliased model withoutaliases.inherit, allowing a repeated alias, skipping the uniqueness check, ignoring the provider in it, not skipping the config being saved, skipping validation on update and on create, removing the alias fallback, removing the parent-provider tie-break, matching case-sensitively, sending a single match to the tie-break, not listing aliases, checking aliases before exact model names, and listing aliases with the experiment off. Each one turns its test red.go test ./coderd/x/chatd/...ok, andgo test ./coderd -run 'ChatModel|ForkChatModelAliases'ok. golangci-lint reports nothing in the touched files. Vitest unit tests forsrc/apiandsrc/modules/aiModelspass.UAT
Ran in Colima on a slim binary of
9c519f4abdwith a mock provider and two AI providers. An admin's invalid aliases (duplicate on the same provider,inherit, uppercase, over 32 characters, repeated, and a provider change onto a taken alias) return 400 and store nothing. A member's personal agent definitions withmodel: fast,FAST,deepand an exact model name spawn on the expected models, the parent's provider wins forfast, and an unknown alias fails with no child. With the experiment off, the definitions don't exist andlist_subagent_modelsshows no aliases.Size
About 405 changed lines: about 170 implementation, about 170 tests, 18 doc lines, and about 47 generated lines (API docs, Swagger, TypeScript types and the model options schema).