Q170: agent model suggestions and choices follow the picked provider

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-09 04:08:17 -04:00
1 parent a8fbc08df6
commit 7c291cf7a7
5 files changed
+60 -13

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
import { randomUUID } from "node:crypto";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { describe, expect, test } from "vitest";
import { DatabaseConnection } from "../../src/main/database/connection";
import { OrganizationService } from "../../src/main/services/organization-service";
describe("an agent's model belongs to its provider", () => {
test("a model without a provider is refused on hire and on edit", () => {
const connection = new DatabaseConnection(join(tmpdir(), `ac-agent-model-${randomUUID()}.db`));
const organization = new OrganizationService(connection.db);
let orgId = "";
let agentId = "";
connection.transaction(() => {
orgId = organization.createOrganization({ organizationName: "Acme", employeeName: "Yang", mission: "m", goal: "g" });
});
const hire = (modelId: string | null) => organization.createAgent({
orgId, name: `Ada ${randomUUID().slice(0, 4)}`, role: "Engineer", department: "Engineering", modelProviderId: null, modelId, budgetCents: 1000, managerAgentId: null,
});
expect(() => connection.transaction(() => hire("gpt-5.4"))).toThrow("Pick the provider before its model.");
connection.transaction(() => { agentId = hire(null); });
expect(() => connection.transaction(() => organization.updateAgent({
orgId, agentId, name: "Ada", role: "Engineer", title: "Engineer", roleLevel: "staff", department: "Engineering", budgetCents: 1000, modelProviderId: null, modelId: "gpt-5.4",
}))).toThrow("Pick the provider before its model.");
});
});