Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
2ba8b5f
feat(coderd): let admins choose the AI provider used for computer use
ibetitsmike Oct 26, 2026
45d8fec
docs(docs/ai-coder/agents/platform-controls): describe choosing the c…
ibetitsmike Oct 26, 2026
94f1ba1
refactor(site/src/pages): address frontend review of the computer use…
ibetitsmike Oct 26, 2026
5dc74a1
fix(site/src/pages): keep the computer use provider hint accurate for…
ibetitsmike Oct 26, 2026
539f170
fix(site/src/pages): show a fallback label and loading state in the c…
ibetitsmike Oct 26, 2026
694336a
fix(site/src/pages): tidy the computer use provider picker labels and…
ibetitsmike Oct 26, 2026
a8a1c58
fix(site/src/pages): dedupe the computer use provider option label an…
ibetitsmike Oct 26, 2026
322e013
fix(coderd): report a malformed computer use AI provider ID clearly
ibetitsmike Oct 26, 2026
996f3f1
fix(site/src/pages): keep the stored computer use provider and guard …
ibetitsmike Oct 26, 2026
cf2b515
docs(docs/ai-coder/agents/platform-controls): fix the computer use pr…
ibetitsmike Oct 26, 2026
cee2e8d
test: tighten computer use AI provider test setup and naming
ibetitsmike Oct 26, 2026
14dea8d
docs(docs/ai-coder/agents/platform-controls): clarify computer use pr…
ibetitsmike Oct 26, 2026
7fa61bc
fix(coderd): read the computer use provider type and AI provider ID f…
ibetitsmike Oct 26, 2026
b296445
test(coderd/x/chatd): assert the computer use config switch committed
ibetitsmike Oct 26, 2026
65f70c1
revert: drop computer use AI provider selection backend
ibetitsmike Oct 26, 2026
43bdd21
feat(coderd/database): allow computer_use chat model override context
ibetitsmike Oct 27, 2026
fea9107
feat: select the computer use model per organization
ibetitsmike Oct 27, 2026
cd566fd
chore(coderd/x/chatd): format imports
ibetitsmike Oct 27, 2026
a8d0c17
feat(site/src/modules/aiModels/knownModels): add curated computer use…
ibetitsmike Oct 27, 2026
98a76fd
refactor(site/src): remove deployment-wide computer use provider setting
ibetitsmike Oct 27, 2026
836911c
docs(docs/ai-coder/agents): document the per-organization computer us…
ibetitsmike Oct 27, 2026
b608e9b
feat(site/src): choose the computer use model per organization
ibetitsmike Oct 27, 2026
10977da
fix(coderd/x/chatd): read the computer use default model under the ow…
ibetitsmike Oct 27, 2026
90b6b43
feat(coderd/database/migrations): drop the deployment-wide computer u…
ibetitsmike Oct 27, 2026
b72d34c
refactor(coderd/x/chatd): drop unreachable disabled checks from the c…
ibetitsmike Oct 27, 2026
478b99e
docs: clarify when computer use is unavailable
ibetitsmike Oct 27, 2026
1af5189
fix: use the default computer use model when the override's AI provid…
ibetitsmike Oct 27, 2026
d28f4d7
fix: describe an unavailable computer use model accurately
ibetitsmike Oct 27, 2026
d0f9fcb
docs(docs/ai-coder/agents): describe computer use fallbacks precisely
ibetitsmike Oct 27, 2026
6573b41
fix(coderd/telemetry): report unsupported computer use overrides as t…
ibetitsmike Oct 27, 2026
9e63457
fix(coderd/telemetry): report unreadable computer use overrides as null
ibetitsmike Oct 27, 2026
271ec9e
fix: warn when the computer use model disables the OpenAI Responses API
ibetitsmike Oct 27, 2026
9fa0d2f
test(site/src/pages/AISettingsPage/CoderAgentsPage): cover the Respon…
ibetitsmike Oct 27, 2026
93bf796
docs(docs/ai-coder/agents/platform-controls): explain the Responses A…
ibetitsmike Oct 27, 2026
23019da
test(site/src/pages/AISettingsPage/CoderAgentsPage): prefix computer …
ibetitsmike Oct 27, 2026
d18b8e2
test(site/src/pages/AISettingsPage/CoderAgentsPage): base the Respons…
ibetitsmike Oct 27, 2026
9e7aa33
docs(docs/ai-coder/agents/platform-controls): list the steps to turn …
ibetitsmike Oct 27, 2026
fccb775
fix(coderd/x/chatd): name a skipped computer use model in unavailable…
ibetitsmike Oct 27, 2026
047b815
docs(docs/ai-coder/agents/platform-controls): name the computer use m…
ibetitsmike Oct 27, 2026
a5a9bfc
docs(docs/ai-coder/agents/platform-controls): point the Responses API…
ibetitsmike Oct 27, 2026
39e6850
fix: address review feedback on computer use model settings
ibetitsmike Oct 27, 2026
8a34dee
fix(site/src/pages/AISettingsPage/CoderAgentsPage): separate query an…
ibetitsmike Oct 28, 2026
b4e4065
Merge origin/main into mike/computer-use-ai-provider
ibetitsmike Oct 28, 2026
15bb4d0
fix(site/src/pages/AISettingsPage/CoderAgentsPage): assign organizati…
ibetitsmike Oct 28, 2026
127c2ac
docs(coderd/x/chatd): describe computer use model routing in ARCHITEC…
ibetitsmike Oct 28, 2026
9006d98
test(coderd/database/migrations): run the 000635 migration test as a …
ibetitsmike Oct 29, 2026
ee05ca4
chore: separate steps in computer use model code and drop a self-evid…
ibetitsmike Oct 29, 2026
c763bb8
chore: human edit of architecture docs
ibetitsmike Oct 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions coderd/apidoc/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions coderd/apidoc/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions coderd/chat_routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,6 @@ func (api *API) registerExperimentalChatRoutes(r chi.Router, apiKeyMiddleware fu
r.Use(apiKeyMiddleware)
r.Get("/projects", api.listChatProjects)
r.Route("/config", func(r chi.Router) {
Comment thread
ibetitsmike marked this conversation as resolved.
Resolved
r.Group(func(r chi.Router) {
r.Use(httpmw.RequireExperimentWithDevBypass(api.Experiments, codersdk.ExperimentChatVirtualDesktop))
r.Get("/computer-use-provider", api.getChatComputerUseProvider)
r.Put("/computer-use-provider", api.putChatComputerUseProvider)
})
r.Group(func(r chi.Router) {
r.Use(httpmw.RequireExperimentWithDevBypass(api.Experiments, codersdk.ExperimentChatAdvisor))
r.Get("/advisor", api.getChatAdvisorConfig)
Expand Down
1 change: 0 additions & 1 deletion coderd/chat_routes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ func TestChatRouteMounts(t *testing.T) {
// Never-promoted routes are absent from /api/v2.
{http.MethodGet, "/api/v2/chats/model-configs"},
{http.MethodPost, "/api/v2/chats/model-configs"},
{http.MethodGet, "/api/v2/chats/config/computer-use-provider"},
{http.MethodGet, "/api/v2/chats/config/advisor"},
{http.MethodGet, "/api/v2/chats/projects"},
{http.MethodGet, fmt.Sprintf("/api/v2/organizations/%s/chats/projects", firstUser.OrganizationID)},
Expand Down
19 changes: 0 additions & 19 deletions coderd/database/dbauthz/dbauthz.go
Original file line number Diff line number Diff line change
Expand Up @@ -3365,18 +3365,6 @@ func (q *querier) GetChatByIDForUpdate(ctx context.Context, id uuid.UUID) (datab
return fetch(q.log, q.auth, q.db.GetChatByIDForUpdate)(ctx, id)
}

func (q *querier) GetChatComputerUseProvider(ctx context.Context) (string, error) {
// The computer-use provider is a deployment-wide runtime chat setting
// read by authenticated chat users and chatd. Feature and experiment
// access is enforced at caller and API boundaries where applicable, so
// this matches peer runtime config getters and only requires an explicit
// actor so unauthenticated calls fail closed.
if _, ok := ActorFromContext(ctx); !ok {
return "", ErrNoActor
}
return q.db.GetChatComputerUseProvider(ctx)
}

func (q *querier) GetChatDebugLoggingAllowUsers(ctx context.Context) (bool, error) {
// The allow-users flag is a deployment-wide setting read by any
// authenticated chat user. We only require that an explicit actor
Expand Down Expand Up @@ -9505,13 +9493,6 @@ func (q *querier) UpsertChatAutoArchiveDays(ctx context.Context, autoArchiveDays
return q.db.UpsertChatAutoArchiveDays(ctx, autoArchiveDays)
}

func (q *querier) UpsertChatComputerUseProvider(ctx context.Context, provider string) error {
if err := q.authorizeContext(ctx, policy.ActionUpdate, rbac.ResourceDeploymentConfig); err != nil {
return err
}
return q.db.UpsertChatComputerUseProvider(ctx, provider)
}

func (q *querier) UpsertChatDebugLoggingAllowUsers(ctx context.Context, allowUsers bool) error {
if err := q.authorizeContext(ctx, policy.ActionUpdate, rbac.ResourceDeploymentConfig); err != nil {
return err
Expand Down
8 changes: 0 additions & 8 deletions coderd/database/dbauthz/dbauthz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1515,10 +1515,6 @@ func (s *MethodTestSuite) TestChats() {
dbm.EXPECT().GetChatDesktopEnabled(gomock.Any()).Return(false, nil).AnyTimes()
check.Args().Asserts()
}))
s.Run("GetChatComputerUseProvider", s.Mocked(func(dbm *dbmock.MockStore, _ *gofakeit.Faker, check *expects) {
dbm.EXPECT().GetChatComputerUseProvider(gomock.Any()).Return("anthropic", nil).AnyTimes()
check.Args().Asserts()
}))
s.Run("GetChatOrganizationModelOverride", s.Mocked(func(dbm *dbmock.MockStore, _ *gofakeit.Faker, check *expects) {
orgID := uuid.New()
arg := database.GetChatOrganizationModelOverrideParams{OrganizationID: orgID, Context: "general"}
Expand Down Expand Up @@ -2089,10 +2085,6 @@ func (s *MethodTestSuite) TestChats() {
dbm.EXPECT().UpsertChatDesktopEnabled(gomock.Any(), false).Return(nil).AnyTimes()
check.Args(false).Asserts(rbac.ResourceDeploymentConfig, policy.ActionUpdate)
}))
s.Run("UpsertChatComputerUseProvider", s.Mocked(func(dbm *dbmock.MockStore, _ *gofakeit.Faker, check *expects) {
dbm.EXPECT().UpsertChatComputerUseProvider(gomock.Any(), "anthropic").Return(nil).AnyTimes()
check.Args("anthropic").Asserts(rbac.ResourceDeploymentConfig, policy.ActionUpdate)
}))
s.Run("UpsertChatOrganizationModelOverride", s.Mocked(func(dbm *dbmock.MockStore, _ *gofakeit.Faker, check *expects) {
orgID := uuid.New()
arg := database.UpsertChatOrganizationModelOverrideParams{
Expand Down
16 changes: 0 additions & 16 deletions coderd/database/dbmetrics/querymetrics.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 0 additions & 29 deletions coderd/database/dbmock/dbmock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion coderd/database/dump.sql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DELETE FROM chat_organization_model_overrides WHERE context = 'computer_use';

ALTER TABLE chat_organization_model_overrides
DROP CONSTRAINT chat_organization_model_overrides_context_check;

ALTER TABLE chat_organization_model_overrides
ADD CONSTRAINT chat_organization_model_overrides_context_check
CHECK (context IN ('general', 'explore', 'title_generation', 'compaction', 'advisor'));
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ALTER TABLE chat_organization_model_overrides
DROP CONSTRAINT chat_organization_model_overrides_context_check;

ALTER TABLE chat_organization_model_overrides
ADD CONSTRAINT chat_organization_model_overrides_context_check
CHECK (context IN ('general', 'explore', 'title_generation', 'compaction', 'advisor', 'computer_use'));

-- The per-organization computer_use override replaces the deployment-wide
-- provider setting.
DELETE FROM site_configs WHERE key = 'agents_computer_use_provider';
Comment thread
ibetitsmike marked this conversation as resolved.
Resolved
92 changes: 92 additions & 0 deletions coderd/database/migrations/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ func TestMigrationChain(t *testing.T) {
{"Migration000606ChatDiffStatusOriginCredentials", 606, testMigration000606ChatDiffStatusOriginCredentials},
{"Migration000621Skills", 621, testMigration000621Skills},
{"Migration000625TemplateVersionScriptOrderUsage", 625, testMigration000625TemplateVersionScriptOrderUsage},
{"Migration000635ChatModelOverrideComputerUse", 635, testMigration000635ChatModelOverrideComputerUse},
}
for _, step := range steps {
stepTo(step.version - 1)
Expand Down Expand Up @@ -4668,3 +4669,94 @@ func TestMigration000627WorkspaceAgentScriptTimingSkippedCanceled(t *testing.T)
require.NoError(t, err)
require.Equal(t, []string{"ok", "exit_failure", "timed_out", "pipes_left_open", "skipped", "canceled"}, enumValues())
}

func testMigration000635ChatModelOverrideComputerUse(t *testing.T, sqlDB *sql.DB, next migrationStepper) {
const migrationVersion = 635

orgID, providerID, modelID := uuid.New(), uuid.New(), uuid.New()
ctx := testutil.Context(t, testutil.WaitLong)
for _, fixture := range []struct {
query string
args []any
}{
{
"INSERT INTO organizations (id, name, display_name, description, created_at, updated_at, default_org_member_roles) VALUES ($1, $2, '', '', NOW(), NOW(), '{}')",
[]any{orgID, orgID.String()},
},
{
"INSERT INTO ai_providers (id, type, name, base_url) VALUES ($1, 'anthropic', $2, 'https://example.com')",
[]any{providerID, providerID.String()},
},
{
"INSERT INTO chat_model_configs (id, model, context_limit, compression_threshold, ai_provider_id, organization_id) VALUES ($1, 'claude-opus-5', 128000, 70, $2, $3)",
[]any{modelID, providerID, orgID},
},
{
"INSERT INTO site_configs (key, value) VALUES ('agents_computer_use_provider', 'openai'), ('migration000635_control', 'kept')",
nil,
},
} {
_, err := sqlDB.ExecContext(ctx, fixture.query, fixture.args...)
require.NoError(t, err)
}

insertOverride := func(overrideContext string) error {
_, err := sqlDB.ExecContext(ctx,
"INSERT INTO chat_organization_model_overrides (organization_id, context, model_config_id) VALUES ($1, $2, $3)",
orgID, overrideContext, modelID)
return err
}
requireCheckViolation := func(err error) {
t.Helper()
require.True(t, database.IsCheckViolation(err, database.CheckChatOrganizationModelOverridesContextCheck), "unexpected error: %v", err)
}
overrideContexts := func() []string {
t.Helper()
rows, err := sqlDB.QueryContext(ctx,
"SELECT context FROM chat_organization_model_overrides WHERE organization_id = $1", orgID)
require.NoError(t, err)
defer rows.Close()

var contexts []string
for rows.Next() {
var overrideContext string
require.NoError(t, rows.Scan(&overrideContext))
contexts = append(contexts, overrideContext)
}
require.NoError(t, rows.Err())
return contexts
}

requireCheckViolation(insertOverride("computer_use"))
require.NoError(t, insertOverride("advisor"))

version, _, err := next()
require.NoError(t, err)
require.EqualValues(t, migrationVersion, version)

require.NoError(t, insertOverride("computer_use"))
require.ElementsMatch(t, []string{"advisor", "computer_use"}, overrideContexts())

var legacyRows, controlRows int
require.NoError(t, sqlDB.QueryRowContext(ctx, `
SELECT count(*) FILTER (WHERE key = 'agents_computer_use_provider'),
count(*) FILTER (WHERE key = 'migration000635_control')
FROM site_configs`).Scan(&legacyRows, &controlRows))
require.Zero(t, legacyRows)
require.Equal(t, 1, controlRows)

// The down migration must delete computer_use rows before it restores the
// old constraint.
downSQL, err := os.ReadFile("000635_chat_model_override_computer_use.down.sql")
require.NoError(t, err)
_, err = sqlDB.ExecContext(ctx, string(downSQL))
require.NoError(t, err)
require.Equal(t, []string{"advisor"}, overrideContexts())
requireCheckViolation(insertOverride("computer_use"))

// Reapply the migration so the chain stays at this version.
upSQL, err := os.ReadFile("000635_chat_model_override_computer_use.up.sql")
require.NoError(t, err)
_, err = sqlDB.ExecContext(ctx, string(upSQL))
require.NoError(t, err)
}
2 changes: 0 additions & 2 deletions coderd/database/querier.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading