refactor(models): bump claude-opus-4-6 to claude-opus-4-7 across fallback chains, categories, and hooks
Updates the canonical Anthropic Opus model in every fallback chain (sisyphus, oracle, prometheus, metis, momus, visual-engineering, ultrabrain, deep, artistry, unspecified-high), the unspecified-high category default, the think-mode HIGH_VARIANT_MAP, the Claude Code alias map, the claude-thinking legacy alias, the context-limit GA regex, and event.ts fallback strings. Widens supportsCachedAnthropicLimit to accept both claude-*-4-6 and claude-*-4-7 so the 1M context cache still applies across the bump. Regenerates the bundled model-capabilities snapshot from models.dev and the model-fallback snapshot to match the new source output.
This commit is contained in:
@@ -709,7 +709,7 @@ describe("createChatMessageHandler - TUI variant passthrough", () => {
|
||||
shouldOverride: false,
|
||||
pluginConfig: {
|
||||
agents: {
|
||||
sisyphus: { model: "anthropic/claude-opus-4-6" },
|
||||
sisyphus: { model: "anthropic/claude-opus-4-7" },
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -733,7 +733,7 @@ describe("createChatMessageHandler - TUI variant passthrough", () => {
|
||||
shouldOverride: false,
|
||||
pluginConfig: {
|
||||
agents: {
|
||||
prometheus: { model: "anthropic/claude-opus-4-6" },
|
||||
prometheus: { model: "anthropic/claude-opus-4-7" },
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -753,7 +753,7 @@ describe("createChatMessageHandler - TUI variant passthrough", () => {
|
||||
test("respects a mid-conversation model switch instead of reusing the previous stored model", async () => {
|
||||
//#given
|
||||
setMainSession("test-session")
|
||||
setSessionModel("test-session", { providerID: "anthropic", modelID: "claude-opus-4-6" })
|
||||
setSessionModel("test-session", { providerID: "anthropic", modelID: "claude-opus-4-7" })
|
||||
const args = createMockHandlerArgs({ shouldOverride: false })
|
||||
const handler = createChatMessageHandler(args)
|
||||
const nextModel = { providerID: "openai", modelID: "gpt-5.4" }
|
||||
|
||||
@@ -48,7 +48,7 @@ describe("createChatParamsHandler", () => {
|
||||
const input = {
|
||||
sessionID: "ses_chat_params",
|
||||
agent: { name: "sisyphus" },
|
||||
model: { providerID: "opencode", modelID: "claude-opus-4-6" },
|
||||
model: { providerID: "opencode", modelID: "claude-opus-4-7" },
|
||||
provider: { id: "opencode" },
|
||||
message: {},
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ describe("createEventHandler compaction agent filtering", () => {
|
||||
role: "user",
|
||||
agent: "compaction",
|
||||
time: { created: Date.now() },
|
||||
model: { providerID: "anthropic", modelID: "claude-opus-4-6" },
|
||||
model: { providerID: "anthropic", modelID: "claude-opus-4-7" },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -85,12 +85,12 @@ describe("createEventHandler - model fallback", () => {
|
||||
name: "APIError",
|
||||
data: {
|
||||
message:
|
||||
"Bad Gateway: {\"error\":{\"message\":\"unknown provider for model claude-opus-4-6-thinking\"}}",
|
||||
"Bad Gateway: {\"error\":{\"message\":\"unknown provider for model claude-opus-4-7-thinking\"}}",
|
||||
isRetryable: true,
|
||||
},
|
||||
},
|
||||
parentID: "msg_user_1",
|
||||
modelID: "claude-opus-4-6-thinking",
|
||||
modelID: "claude-opus-4-7-thinking",
|
||||
providerID: "anthropic",
|
||||
mode: "Sisyphus - Ultraworker",
|
||||
agent: "Sisyphus - Ultraworker",
|
||||
@@ -125,7 +125,7 @@ describe("createEventHandler - model fallback", () => {
|
||||
data: {
|
||||
error: {
|
||||
message:
|
||||
"Bad Gateway: {\"error\":{\"message\":\"unknown provider for model claude-opus-4-6-thinking\"}}",
|
||||
"Bad Gateway: {\"error\":{\"message\":\"unknown provider for model claude-opus-4-7-thinking\"}}",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -182,7 +182,7 @@ describe("createEventHandler - model fallback", () => {
|
||||
role: "user",
|
||||
time: { created: 1 },
|
||||
content: [],
|
||||
modelID: "claude-opus-4-6-thinking",
|
||||
modelID: "claude-opus-4-7-thinking",
|
||||
providerID: "anthropic",
|
||||
agent: "Sisyphus - Ultraworker",
|
||||
path: { cwd: "/tmp", root: "/tmp" },
|
||||
@@ -201,7 +201,7 @@ describe("createEventHandler - model fallback", () => {
|
||||
type: "retry",
|
||||
attempt: 1,
|
||||
message:
|
||||
"Bad Gateway: {\"error\":{\"message\":\"unknown provider for model claude-opus-4-6-thinking\"}}",
|
||||
"Bad Gateway: {\"error\":{\"message\":\"unknown provider for model claude-opus-4-7-thinking\"}}",
|
||||
next: 1234,
|
||||
},
|
||||
},
|
||||
@@ -213,7 +213,7 @@ describe("createEventHandler - model fallback", () => {
|
||||
{
|
||||
sessionID,
|
||||
agent: "sisyphus",
|
||||
model: { providerID: "anthropic", modelID: "claude-opus-4-6-thinking" },
|
||||
model: { providerID: "anthropic", modelID: "claude-opus-4-7-thinking" },
|
||||
},
|
||||
output,
|
||||
)
|
||||
@@ -244,7 +244,7 @@ describe("createEventHandler - model fallback", () => {
|
||||
id: "msg_user_status_dedup",
|
||||
sessionID,
|
||||
role: "user",
|
||||
modelID: "claude-opus-4-6-thinking",
|
||||
modelID: "claude-opus-4-7-thinking",
|
||||
providerID: "anthropic",
|
||||
agent: "Sisyphus - Ultraworker",
|
||||
},
|
||||
@@ -262,7 +262,7 @@ describe("createEventHandler - model fallback", () => {
|
||||
type: "retry",
|
||||
attempt: 1,
|
||||
message:
|
||||
"All credentials for model claude-opus-4-6-thinking are cooling down [retrying in ~5 days attempt #1]",
|
||||
"All credentials for model claude-opus-4-7-thinking are cooling down [retrying in ~5 days attempt #1]",
|
||||
next: 300,
|
||||
},
|
||||
},
|
||||
@@ -277,7 +277,7 @@ describe("createEventHandler - model fallback", () => {
|
||||
type: "retry",
|
||||
attempt: 1,
|
||||
message:
|
||||
"All credentials for model claude-opus-4-6-thinking are cooling down [retrying in ~4 days attempt #1]",
|
||||
"All credentials for model claude-opus-4-7-thinking are cooling down [retrying in ~4 days attempt #1]",
|
||||
next: 299,
|
||||
},
|
||||
},
|
||||
@@ -312,7 +312,7 @@ describe("createEventHandler - model fallback", () => {
|
||||
id: "msg_user_status_runtime_enabled",
|
||||
sessionID,
|
||||
role: "user",
|
||||
modelID: "claude-opus-4-6",
|
||||
modelID: "claude-opus-4-7",
|
||||
providerID: "quotio",
|
||||
agent: "Sisyphus - Ultraworker",
|
||||
},
|
||||
@@ -330,7 +330,7 @@ describe("createEventHandler - model fallback", () => {
|
||||
type: "retry",
|
||||
attempt: 1,
|
||||
message:
|
||||
"All credentials for model claude-opus-4-6 are cooling down [retrying in 7m 56s attempt #1]",
|
||||
"All credentials for model claude-opus-4-7 are cooling down [retrying in 7m 56s attempt #1]",
|
||||
next: 476,
|
||||
},
|
||||
},
|
||||
@@ -393,7 +393,7 @@ describe("createEventHandler - model fallback", () => {
|
||||
role: "user",
|
||||
time: { created: 1 },
|
||||
content: [],
|
||||
modelID: "claude-opus-4-6",
|
||||
modelID: "claude-opus-4-7",
|
||||
providerID: "quotio",
|
||||
agent: "Sisyphus - Ultraworker",
|
||||
path: { cwd: "/tmp", root: "/tmp" },
|
||||
@@ -412,7 +412,7 @@ describe("createEventHandler - model fallback", () => {
|
||||
type: "retry",
|
||||
attempt: 1,
|
||||
message:
|
||||
"All credentials for model claude-opus-4-6-thinking are cooling down [retrying in ~5 days attempt #1]",
|
||||
"All credentials for model claude-opus-4-7-thinking are cooling down [retrying in ~5 days attempt #1]",
|
||||
next: 300,
|
||||
},
|
||||
},
|
||||
@@ -424,7 +424,7 @@ describe("createEventHandler - model fallback", () => {
|
||||
{
|
||||
sessionID,
|
||||
agent: "sisyphus",
|
||||
model: { providerID: "quotio", modelID: "claude-opus-4-6" },
|
||||
model: { providerID: "quotio", modelID: "claude-opus-4-7" },
|
||||
},
|
||||
output,
|
||||
)
|
||||
@@ -520,13 +520,13 @@ describe("createEventHandler - model fallback", () => {
|
||||
properties: {
|
||||
sessionID,
|
||||
providerID: "anthropic",
|
||||
modelID: "claude-opus-4-6-thinking",
|
||||
modelID: "claude-opus-4-7-thinking",
|
||||
error: {
|
||||
name: "UnknownError",
|
||||
data: {
|
||||
error: {
|
||||
message:
|
||||
"Bad Gateway: {\"error\":{\"message\":\"unknown provider for model claude-opus-4-6-thinking\"}}",
|
||||
"Bad Gateway: {\"error\":{\"message\":\"unknown provider for model claude-opus-4-7-thinking\"}}",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -539,7 +539,7 @@ describe("createEventHandler - model fallback", () => {
|
||||
{
|
||||
sessionID,
|
||||
agent: "sisyphus",
|
||||
model: { providerID: "anthropic", modelID: "claude-opus-4-6-thinking" },
|
||||
model: { providerID: "anthropic", modelID: "claude-opus-4-7-thinking" },
|
||||
},
|
||||
output,
|
||||
)
|
||||
@@ -549,7 +549,7 @@ describe("createEventHandler - model fallback", () => {
|
||||
//#when - first retry cycle
|
||||
const first = await triggerRetryCycle()
|
||||
|
||||
//#then - first fallback entry applied (no-op skip: claude-opus-4-6 matches current model after normalization)
|
||||
//#then - first fallback entry applied (no-op skip: claude-opus-4-7 matches current model after normalization)
|
||||
expect(first.message["model"]).toMatchObject({
|
||||
providerID: "opencode-go",
|
||||
modelID: "kimi-k2.5",
|
||||
@@ -590,12 +590,12 @@ describe("createEventHandler - model fallback", () => {
|
||||
name: "APIError",
|
||||
data: {
|
||||
message:
|
||||
"Bad Gateway: {\"error\":{\"message\":\"unknown provider for model claude-opus-4-6-thinking\"}}",
|
||||
"Bad Gateway: {\"error\":{\"message\":\"unknown provider for model claude-opus-4-7-thinking\"}}",
|
||||
isRetryable: true,
|
||||
},
|
||||
},
|
||||
parentID: "msg_user_disabled_1",
|
||||
modelID: "claude-opus-4-6-thinking",
|
||||
modelID: "claude-opus-4-7-thinking",
|
||||
providerID: "anthropic",
|
||||
agent: "Sisyphus - Ultraworker",
|
||||
path: { cwd: "/tmp", root: "/tmp" },
|
||||
@@ -617,7 +617,7 @@ describe("createEventHandler - model fallback", () => {
|
||||
data: {
|
||||
error: {
|
||||
message:
|
||||
"Bad Gateway: {\"error\":{\"message\":\"unknown provider for model claude-opus-4-6-thinking\"}}",
|
||||
"Bad Gateway: {\"error\":{\"message\":\"unknown provider for model claude-opus-4-7-thinking\"}}",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -826,7 +826,7 @@ describe("createEventHandler - retry dedupe lifecycle", () => {
|
||||
const retryStatus = {
|
||||
type: "retry",
|
||||
attempt: 1,
|
||||
message: "All credentials for model claude-opus-4-6-thinking are cooling down [retrying in 7m 56s attempt #1]",
|
||||
message: "All credentials for model claude-opus-4-7-thinking are cooling down [retrying in 7m 56s attempt #1]",
|
||||
next: 476,
|
||||
} as const
|
||||
|
||||
@@ -838,7 +838,7 @@ describe("createEventHandler - retry dedupe lifecycle", () => {
|
||||
id: "msg_user_retry_rearm",
|
||||
sessionID,
|
||||
role: "user",
|
||||
modelID: "claude-opus-4-6-thinking",
|
||||
modelID: "claude-opus-4-7-thinking",
|
||||
providerID: "anthropic",
|
||||
agent: "Sisyphus - Ultraworker",
|
||||
},
|
||||
@@ -862,7 +862,7 @@ describe("createEventHandler - retry dedupe lifecycle", () => {
|
||||
{
|
||||
sessionID,
|
||||
agent: "sisyphus",
|
||||
model: { providerID: "anthropic", modelID: "claude-opus-4-6-thinking" },
|
||||
model: { providerID: "anthropic", modelID: "claude-opus-4-7-thinking" },
|
||||
},
|
||||
firstOutput,
|
||||
)
|
||||
|
||||
+3
-3
@@ -515,7 +515,7 @@ export function createEventHandler(args: {
|
||||
sessionID,
|
||||
info?.providerID as string | undefined,
|
||||
);
|
||||
const rawModel = (info?.modelID as string | undefined) ?? "claude-opus-4-6";
|
||||
const rawModel = (info?.modelID as string | undefined) ?? "claude-opus-4-7";
|
||||
const currentModel = normalizeFallbackModelID(rawModel);
|
||||
applyUserConfiguredFallbackChain(sessionID, agentName, currentProvider, args.pluginConfig);
|
||||
|
||||
@@ -578,7 +578,7 @@ export function createEventHandler(args: {
|
||||
const parsed = extractProviderModelFromErrorMessage(retryMessage);
|
||||
const lastKnown = lastKnownModelBySession.get(sessionID);
|
||||
const currentProvider = resolveFallbackProviderID(sessionID, parsed.providerID);
|
||||
let currentModel = parsed.modelID ?? lastKnown?.modelID ?? "claude-opus-4-6";
|
||||
let currentModel = parsed.modelID ?? lastKnown?.modelID ?? "claude-opus-4-7";
|
||||
currentModel = normalizeFallbackModelID(currentModel);
|
||||
applyUserConfiguredFallbackChain(sessionID, agentName, currentProvider, args.pluginConfig);
|
||||
|
||||
@@ -664,7 +664,7 @@ export function createEventHandler(args: {
|
||||
sessionID,
|
||||
(props?.providerID as string | undefined) || parsed.providerID,
|
||||
);
|
||||
let currentModel = (props?.modelID as string) || parsed.modelID || "claude-opus-4-6";
|
||||
let currentModel = (props?.modelID as string) || parsed.modelID || "claude-opus-4-7";
|
||||
currentModel = normalizeFallbackModelID(currentModel);
|
||||
applyUserConfiguredFallbackChain(sessionID, agentName, currentProvider, args.pluginConfig);
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ function createChatMessageHandlerHooks(
|
||||
|
||||
const PRIMARY_MODEL = {
|
||||
providerID: PROVIDER_ID,
|
||||
modelID: "claude-opus-4-6",
|
||||
modelID: "claude-opus-4-7",
|
||||
}
|
||||
|
||||
const PRIMARY_MODEL_STRING = `${PRIMARY_MODEL.providerID}/${PRIMARY_MODEL.modelID}`
|
||||
@@ -313,7 +313,7 @@ async function triggerSessionStatusRetry(
|
||||
type: "retry",
|
||||
attempt: 1,
|
||||
message:
|
||||
"All credentials for model claude-opus-4-6 are cooling down [retrying in 7m 56s attempt #1]",
|
||||
"All credentials for model claude-opus-4-7 are cooling down [retrying in 7m 56s attempt #1]",
|
||||
next: 476,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -112,13 +112,13 @@ describe("scheduleDeferredModelOverride", () => {
|
||||
//#when
|
||||
scheduleDeferredModelOverride(
|
||||
"msg_001",
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-6" },
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-7" },
|
||||
)
|
||||
await flushMicrotasks(5)
|
||||
|
||||
//#then
|
||||
const model = readMessageModel("msg_001")
|
||||
expect(model).toEqual({ providerID: "anthropic", modelID: "claude-opus-4-6" })
|
||||
expect(model).toEqual({ providerID: "anthropic", modelID: "claude-opus-4-7" })
|
||||
})
|
||||
|
||||
test("should update variant and thinking fields when variant provided", async () => {
|
||||
@@ -128,7 +128,7 @@ describe("scheduleDeferredModelOverride", () => {
|
||||
//#when
|
||||
scheduleDeferredModelOverride(
|
||||
"msg_002",
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-6" },
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-7" },
|
||||
"max",
|
||||
)
|
||||
await flushMicrotasks(5)
|
||||
@@ -144,7 +144,7 @@ describe("scheduleDeferredModelOverride", () => {
|
||||
//#when
|
||||
scheduleDeferredModelOverride(
|
||||
"msg_nonexistent",
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-6" },
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-7" },
|
||||
)
|
||||
await flushWithTimeout()
|
||||
|
||||
@@ -162,13 +162,13 @@ describe("scheduleDeferredModelOverride", () => {
|
||||
//#when
|
||||
scheduleDeferredModelOverride(
|
||||
"msg_003",
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-6" },
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-7" },
|
||||
)
|
||||
await flushMicrotasks(5)
|
||||
|
||||
//#then
|
||||
const model = readMessageModel("msg_003")
|
||||
expect(model).toEqual({ providerID: "anthropic", modelID: "claude-opus-4-6" })
|
||||
expect(model).toEqual({ providerID: "anthropic", modelID: "claude-opus-4-7" })
|
||||
expect(readMessageField("msg_003", "variant")).toBeNull()
|
||||
expect(readMessageField("msg_003", "thinking")).toBeNull()
|
||||
})
|
||||
@@ -180,7 +180,7 @@ describe("scheduleDeferredModelOverride", () => {
|
||||
//#when
|
||||
scheduleDeferredModelOverride(
|
||||
"msg_004",
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-6" },
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-7" },
|
||||
)
|
||||
await flushMicrotasks(5)
|
||||
|
||||
@@ -200,7 +200,7 @@ describe("scheduleDeferredModelOverride", () => {
|
||||
//#when
|
||||
scheduleDeferredModelOverride(
|
||||
"msg_corrupt",
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-6" },
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-7" },
|
||||
)
|
||||
await flushMicrotasks(5)
|
||||
|
||||
|
||||
@@ -79,19 +79,19 @@ describe("resolveUltraworkOverride", () => {
|
||||
|
||||
test("should resolve override when ultrawork keyword detected", () => {
|
||||
//#given
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-6", variant: "max" })
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-7", variant: "max" })
|
||||
const output = createOutput("ultrawork do something")
|
||||
|
||||
//#when
|
||||
const result = resolveUltraworkOverride(config, "sisyphus", output)
|
||||
|
||||
//#then
|
||||
expect(result).toEqual({ providerID: "anthropic", modelID: "claude-opus-4-6", variant: "max" })
|
||||
expect(result).toEqual({ providerID: "anthropic", modelID: "claude-opus-4-7", variant: "max" })
|
||||
})
|
||||
|
||||
test("should return null when no keyword detected", () => {
|
||||
//#given
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-6" })
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-7" })
|
||||
const output = createOutput("just do something normal")
|
||||
|
||||
//#when
|
||||
@@ -103,7 +103,7 @@ describe("resolveUltraworkOverride", () => {
|
||||
|
||||
test("should return null when agent name is undefined", () => {
|
||||
//#given
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-6" })
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-7" })
|
||||
const output = createOutput("ultrawork do something")
|
||||
|
||||
//#when
|
||||
@@ -115,14 +115,14 @@ describe("resolveUltraworkOverride", () => {
|
||||
|
||||
test("should use message.agent when input agent is undefined", () => {
|
||||
//#given
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-6" })
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-7" })
|
||||
const output = createOutput("ultrawork do something", "sisyphus")
|
||||
|
||||
//#when
|
||||
const result = resolveUltraworkOverride(config, undefined, output)
|
||||
|
||||
//#then
|
||||
expect(result).toEqual({ providerID: "anthropic", modelID: "claude-opus-4-6", variant: undefined })
|
||||
expect(result).toEqual({ providerID: "anthropic", modelID: "claude-opus-4-7", variant: undefined })
|
||||
})
|
||||
|
||||
test("should return null when agents config is missing", () => {
|
||||
@@ -189,19 +189,19 @@ describe("resolveUltraworkOverride", () => {
|
||||
|
||||
test("should resolve display name to config key", () => {
|
||||
//#given
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-6", variant: "max" })
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-7", variant: "max" })
|
||||
const output = createOutput("ulw do something")
|
||||
|
||||
//#when
|
||||
const result = resolveUltraworkOverride(config, "Sisyphus - Ultraworker", output)
|
||||
|
||||
//#then
|
||||
expect(result).toEqual({ providerID: "anthropic", modelID: "claude-opus-4-6", variant: "max" })
|
||||
expect(result).toEqual({ providerID: "anthropic", modelID: "claude-opus-4-7", variant: "max" })
|
||||
})
|
||||
|
||||
test("should handle multiple text parts by joining them", () => {
|
||||
//#given
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-6" })
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-7" })
|
||||
const output = {
|
||||
message: {} as Record<string, unknown>,
|
||||
parts: [
|
||||
@@ -215,12 +215,12 @@ describe("resolveUltraworkOverride", () => {
|
||||
const result = resolveUltraworkOverride(config, "sisyphus", output)
|
||||
|
||||
//#then
|
||||
expect(result).toEqual({ providerID: "anthropic", modelID: "claude-opus-4-6", variant: undefined })
|
||||
expect(result).toEqual({ providerID: "anthropic", modelID: "claude-opus-4-7", variant: undefined })
|
||||
})
|
||||
|
||||
test("should use session agent when input and message agents are undefined", () => {
|
||||
//#given
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-6", variant: "max" })
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-7", variant: "max" })
|
||||
const output = createOutput("ultrawork do something")
|
||||
const getSessionAgentSpy = spyOn(sessionStateModule, "getSessionAgent")
|
||||
getSessionAgentSpy.mockReturnValue("sisyphus")
|
||||
@@ -230,7 +230,7 @@ describe("resolveUltraworkOverride", () => {
|
||||
|
||||
//#then
|
||||
expect(getSessionAgentSpy).toHaveBeenCalledWith("ses_test")
|
||||
expect(result).toEqual({ providerID: "anthropic", modelID: "claude-opus-4-6", variant: "max" })
|
||||
expect(result).toEqual({ providerID: "anthropic", modelID: "claude-opus-4-7", variant: "max" })
|
||||
|
||||
getSessionAgentSpy.mockRestore()
|
||||
})
|
||||
@@ -287,7 +287,7 @@ describe("applyUltraworkModelOverrideOnMessage", () => {
|
||||
|
||||
test("should schedule deferred DB override without variant when SDK unavailable", () => {
|
||||
//#given
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-6", variant: "max" })
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-7", variant: "max" })
|
||||
const output = createOutput("ultrawork do something", { messageId: "msg_123" })
|
||||
const tui = createMockTui()
|
||||
|
||||
@@ -297,7 +297,7 @@ describe("applyUltraworkModelOverrideOnMessage", () => {
|
||||
//#then - variant should NOT be applied without SDK validation
|
||||
expect(dbOverrideSpy).toHaveBeenCalledWith(
|
||||
"msg_123",
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-6" },
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-7" },
|
||||
undefined,
|
||||
)
|
||||
})
|
||||
@@ -305,7 +305,7 @@ describe("applyUltraworkModelOverrideOnMessage", () => {
|
||||
test("should NOT override variant when SDK unavailable even if config specifies variant", () => {
|
||||
//#given
|
||||
const config = createConfig("sisyphus", {
|
||||
model: "anthropic/claude-opus-4-6",
|
||||
model: "anthropic/claude-opus-4-7",
|
||||
variant: "extended",
|
||||
})
|
||||
const output = createOutput("ultrawork do something", { messageId: "msg_123" })
|
||||
@@ -319,7 +319,7 @@ describe("applyUltraworkModelOverrideOnMessage", () => {
|
||||
//#then - existing variant preserved, not overridden to "extended"
|
||||
expect(dbOverrideSpy).toHaveBeenCalledWith(
|
||||
"msg_123",
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-6" },
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-7" },
|
||||
undefined,
|
||||
)
|
||||
expect(output.message["variant"]).toBe("max")
|
||||
@@ -329,7 +329,7 @@ describe("applyUltraworkModelOverrideOnMessage", () => {
|
||||
test("should NOT mutate output.message.model when message ID present", () => {
|
||||
//#given
|
||||
const sonnetModel = { providerID: "anthropic", modelID: "claude-sonnet-4-6" }
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-6" })
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-7" })
|
||||
const output = createOutput("ultrawork do something", {
|
||||
existingModel: sonnetModel,
|
||||
messageId: "msg_123",
|
||||
@@ -345,7 +345,7 @@ describe("applyUltraworkModelOverrideOnMessage", () => {
|
||||
|
||||
test("should fall back to direct model mutation without variant when no message ID and no SDK", () => {
|
||||
//#given
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-6", variant: "max" })
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-7", variant: "max" })
|
||||
const output = createOutput("ultrawork do something")
|
||||
const tui = createMockTui()
|
||||
|
||||
@@ -353,7 +353,7 @@ describe("applyUltraworkModelOverrideOnMessage", () => {
|
||||
applyUltraworkModelOverrideOnMessage(config, "sisyphus", output, tui)
|
||||
|
||||
//#then - model is set but variant is NOT applied without SDK validation
|
||||
expect(output.message.model).toEqual({ providerID: "anthropic", modelID: "claude-opus-4-6" })
|
||||
expect(output.message.model).toEqual({ providerID: "anthropic", modelID: "claude-opus-4-7" })
|
||||
expect(output.message["variant"]).toBeUndefined()
|
||||
expect(dbOverrideSpy).not.toHaveBeenCalled()
|
||||
})
|
||||
@@ -375,7 +375,7 @@ describe("applyUltraworkModelOverrideOnMessage", () => {
|
||||
|
||||
test("should not apply override when no keyword detected", () => {
|
||||
//#given
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-6" })
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-7" })
|
||||
const output = createOutput("just do something normal", { messageId: "msg_123" })
|
||||
const tui = createMockTui()
|
||||
|
||||
@@ -388,7 +388,7 @@ describe("applyUltraworkModelOverrideOnMessage", () => {
|
||||
|
||||
test("should log the model transition with deferred DB tag", () => {
|
||||
//#given
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-6" })
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-7" })
|
||||
const existingModel = { providerID: "anthropic", modelID: "claude-sonnet-4-6" }
|
||||
const output = createOutput("ultrawork do something", {
|
||||
existingModel,
|
||||
@@ -408,7 +408,7 @@ describe("applyUltraworkModelOverrideOnMessage", () => {
|
||||
|
||||
test("should call showToast on override", () => {
|
||||
//#given
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-6" })
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-7" })
|
||||
const output = createOutput("ultrawork do something", { messageId: "msg_123" })
|
||||
let toastCalled = false
|
||||
const tui = {
|
||||
@@ -426,7 +426,7 @@ describe("applyUltraworkModelOverrideOnMessage", () => {
|
||||
|
||||
test("should resolve display name to config key with deferred path", () => {
|
||||
//#given
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-6", variant: "max" })
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-7", variant: "max" })
|
||||
const output = createOutput("ulw do something", { messageId: "msg_123" })
|
||||
const tui = createMockTui()
|
||||
|
||||
@@ -436,16 +436,16 @@ describe("applyUltraworkModelOverrideOnMessage", () => {
|
||||
//#then
|
||||
expect(dbOverrideSpy).toHaveBeenCalledWith(
|
||||
"msg_123",
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-6" },
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-7" },
|
||||
undefined,
|
||||
)
|
||||
})
|
||||
|
||||
test("should skip override trigger when current model already matches ultrawork model", () => {
|
||||
//#given
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-6", variant: "max" })
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-7", variant: "max" })
|
||||
const output = createOutput("ultrawork do something", {
|
||||
existingModel: { providerID: "anthropic", modelID: "claude-opus-4-6" },
|
||||
existingModel: { providerID: "anthropic", modelID: "claude-opus-4-7" },
|
||||
messageId: "msg_123",
|
||||
})
|
||||
let toastCalled = false
|
||||
@@ -465,13 +465,13 @@ describe("applyUltraworkModelOverrideOnMessage", () => {
|
||||
|
||||
test("should apply validated variant when SDK confirms model supports it", async () => {
|
||||
//#given
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-6", variant: "max" })
|
||||
const config = createConfig("sisyphus", { model: "anthropic/claude-opus-4-7", variant: "max" })
|
||||
const output = createOutput("ultrawork do something", { messageId: "msg_123" })
|
||||
const tui = createMockTui()
|
||||
const mockClient = {
|
||||
provider: {
|
||||
list: async () => ({
|
||||
data: { all: [{ id: "anthropic", models: { "claude-opus-4-6": { variants: { max: {} } } } }] },
|
||||
data: { all: [{ id: "anthropic", models: { "claude-opus-4-7": { variants: { max: {} } } } }] },
|
||||
}),
|
||||
},
|
||||
}
|
||||
@@ -482,7 +482,7 @@ describe("applyUltraworkModelOverrideOnMessage", () => {
|
||||
//#then - SDK confirmed max exists, so variant is applied
|
||||
expect(dbOverrideSpy).toHaveBeenCalledWith(
|
||||
"msg_123",
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-6" },
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-7" },
|
||||
"max",
|
||||
)
|
||||
})
|
||||
|
||||
@@ -23,7 +23,7 @@ describe("resolveValidUltraworkVariant", () => {
|
||||
// given
|
||||
const client = createClient({
|
||||
anthropic: {
|
||||
"claude-opus-4-6": {
|
||||
"claude-opus-4-7": {
|
||||
variants: {
|
||||
max: {},
|
||||
high: {},
|
||||
@@ -35,7 +35,7 @@ describe("resolveValidUltraworkVariant", () => {
|
||||
// when
|
||||
const result = await resolveValidUltraworkVariant(
|
||||
client,
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-6" },
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-7" },
|
||||
"max",
|
||||
)
|
||||
|
||||
@@ -47,7 +47,7 @@ describe("resolveValidUltraworkVariant", () => {
|
||||
// given
|
||||
const client = createClient({
|
||||
anthropic: {
|
||||
"claude-opus-4-6": {
|
||||
"claude-opus-4-7": {
|
||||
variants: {
|
||||
high: {},
|
||||
},
|
||||
@@ -58,7 +58,7 @@ describe("resolveValidUltraworkVariant", () => {
|
||||
// when
|
||||
const result = await resolveValidUltraworkVariant(
|
||||
client,
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-6" },
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-7" },
|
||||
"max",
|
||||
)
|
||||
|
||||
@@ -87,7 +87,7 @@ describe("applyUltraworkModelOverrideOnMessage variant guard", () => {
|
||||
// given
|
||||
const client = createClient({
|
||||
anthropic: {
|
||||
"claude-opus-4-6": {
|
||||
"claude-opus-4-7": {
|
||||
variants: {
|
||||
high: {},
|
||||
},
|
||||
@@ -100,7 +100,7 @@ describe("applyUltraworkModelOverrideOnMessage variant guard", () => {
|
||||
agents: {
|
||||
sisyphus: {
|
||||
ultrawork: {
|
||||
model: "anthropic/claude-opus-4-6",
|
||||
model: "anthropic/claude-opus-4-7",
|
||||
variant: "max",
|
||||
},
|
||||
},
|
||||
@@ -130,7 +130,7 @@ describe("applyUltraworkModelOverrideOnMessage variant guard", () => {
|
||||
expect(output.message["thinking"]).toBeUndefined()
|
||||
expect(dbOverrideSpy).toHaveBeenCalledWith(
|
||||
"msg_123",
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-6" },
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-7" },
|
||||
undefined,
|
||||
)
|
||||
dbOverrideSpy.mockRestore()
|
||||
|
||||
Reference in New Issue
Block a user