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:
1 parent
a8fbc08df6
commit
7c291cf7a7
5 files changed
+60
-13
No files matched your search
@@ -105,8 +105,14 @@ test("onboards, hires, and creates work in the Electron shell", async () => {
|
||||
await expect(editModel).toHaveAttribute("placeholder", "gpt-5.4");
|
||||
const editProvider = page.locator(".modal select[name=modelProviderId]");
|
||||
const savedProvider = await editProvider.inputValue();
|
||||
// Suggestions come from the picked provider only, and switching provider clears the model.
|
||||
await expect(page.locator("#edit-model-suggestions option").first()).toHaveAttribute("value", /.+/);
|
||||
await expect(page.locator("#edit-model-suggestions option[value^=claude]")).toHaveCount(0);
|
||||
await editModel.fill("gpt-5.4");
|
||||
await editProvider.selectOption("");
|
||||
await expect(editModel).toHaveAttribute("placeholder", "");
|
||||
await expect(editModel).toHaveValue("");
|
||||
await expect(editModel).toBeDisabled();
|
||||
await editProvider.selectOption(savedProvider);
|
||||
await page.locator(".modal").getByRole("button", { name: "Save" }).click();
|
||||
await expect(page.getByText("Alex Turing").first()).toBeVisible();
|
||||
|
||||
@@ -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.");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user