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

+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,
};
}