Q167: the model in effect and what a default change reaches are shown

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-09 03:44:23 -04:00
1 parent e8722cd815
commit 26c3365896
10 files changed
+97 -19

No files matched your search

+11 -1
View File
@@ -89,7 +89,9 @@ test("onboards, hires, and creates work in the Electron shell", async () => {
};
});
expect(hiredAgent.modelProviderId).toBeTruthy();
expect(hiredAgent.modelId).toBe("gpt-5.4");
// A hire without its own model follows the provider default, and the roster says so.
expect(hiredAgent.modelId).toBeNull();
await expect(page.getByText("gpt-5.4 (provider default)").first()).toBeVisible();
expect(hiredAgent.workspaceId).toBe(hiredAgent.primaryWorkspaceId);
expect(hiredAgent.heartbeatEnabled).toBe(true);
expect(hiredAgent.heartbeatIntervalSec).toBe(120);
@@ -98,6 +100,14 @@ test("onboards, hires, and creates work in the Electron shell", async () => {
await page.getByRole("button", { name: "Edit Alex Chen" }).click();
await page.locator(".modal").getByLabel("Name", { exact: true }).fill("Alex Turing");
await page.getByLabel("Avatar emoji").fill("🚀");
// The blank model field names the default of whichever provider is picked now.
const editModel = page.locator(".modal").getByLabel("Model", { exact: true });
await expect(editModel).toHaveAttribute("placeholder", "gpt-5.4");
const editProvider = page.locator(".modal select[name=modelProviderId]");
const savedProvider = await editProvider.inputValue();
await editProvider.selectOption("");
await expect(editModel).toHaveAttribute("placeholder", "");
await editProvider.selectOption(savedProvider);
await page.locator(".modal").getByRole("button", { name: "Save" }).click();
await expect(page.getByText("Alex Turing").first()).toBeVisible();
await expect(page.locator(".table-row", { hasText: "Alex Turing" }).locator(".avatar", { hasText: "🚀" })).toBeVisible();
+24
View File
@@ -0,0 +1,24 @@
import { describe, expect, it } from "vitest";
import { agentModel, defaultModelReach } from "../../src/shared/agent-model";
import { effectiveModel } from "../../src/main/services/task-run-preparation";
describe("agent model", () => {
it("names the model in effect and where it comes from", () => {
expect(agentModel("gpt-6", "gpt-5")).toEqual({ model: "gpt-6", source: "agent" });
expect(agentModel(" ", "gpt-5")).toEqual({ model: "gpt-5", source: "provider_default" });
expect(agentModel(null, null)).toEqual({ model: null, source: "none" });
// Runs start with exactly the model the UI shows.
expect(effectiveModel(" gpt-6 ", "gpt-5")).toBe("gpt-6");
expect(effectiveModel(null, "gpt-5")).toBe("gpt-5");
});
it("counts the agents a default-model change reaches", () => {
const agents = [
{ modelProviderId: "p1", modelId: null },
{ modelProviderId: "p1", modelId: "" },
{ modelProviderId: "p1", modelId: "own" },
{ modelProviderId: "p2", modelId: null },
];
expect(defaultModelReach(agents, "p1")).toEqual({ following: 2, ownModel: 1 });
});
});
+1 -1
View File
@@ -6,7 +6,7 @@ function run(agentId: string | null, contextJson: string | null): TaskRunRecord
return {
id: `run_${Math.random()}`, orgId: "org", taskId: "tsk", agentId, providerId: null, providerRequestId: null,
executionContextId: null, serviceIdentityId: null, workspaceMountJson: "[]", secretScopeJson: "{}",
trigger: "chat_mention", state: "completed", createdAt: "", startedAt: null, completedAt: null, errorMessage: null, contextJson, capabilityWarnings: null,
trigger: "chat_mention", state: "completed", createdAt: "", startedAt: null, completedAt: null, errorMessage: null, contextJson, capabilityWarnings: null, runModel: null,
};
}