fix(keyword-detector): respect ultrawork config variant instead of hardcoding "max"
Closes #1966
This commit is contained in:
@@ -279,6 +279,30 @@ describe("applyUltraworkModelOverrideOnMessage", () => {
|
||||
)
|
||||
})
|
||||
|
||||
test("should override keyword-detector variant with configured ultrawork variant on deferred path", () => {
|
||||
//#given
|
||||
const config = createConfig("sisyphus", {
|
||||
model: "anthropic/claude-opus-4-6",
|
||||
variant: "extended",
|
||||
})
|
||||
const output = createOutput("ultrawork do something", { messageId: "msg_123" })
|
||||
output.message["variant"] = "max"
|
||||
output.message["thinking"] = "max"
|
||||
const tui = createMockTui()
|
||||
|
||||
//#when
|
||||
applyUltraworkModelOverrideOnMessage(config, "sisyphus", output, tui)
|
||||
|
||||
//#then
|
||||
expect(dbOverrideSpy).toHaveBeenCalledWith(
|
||||
"msg_123",
|
||||
{ providerID: "anthropic", modelID: "claude-opus-4-6" },
|
||||
"extended",
|
||||
)
|
||||
expect(output.message["variant"]).toBe("extended")
|
||||
expect(output.message["thinking"]).toBe("extended")
|
||||
})
|
||||
|
||||
test("should NOT mutate output.message.model when message ID present", () => {
|
||||
//#given
|
||||
const sonnetModel = { providerID: "anthropic", modelID: "claude-sonnet-4-6" }
|
||||
|
||||
@@ -114,10 +114,12 @@ export function applyUltraworkModelOverrideOnMessage(
|
||||
const override = resolveUltraworkOverride(pluginConfig, inputAgentName, output, sessionID)
|
||||
if (!override) return
|
||||
|
||||
if (override.variant) {
|
||||
output.message["variant"] = override.variant
|
||||
output.message["thinking"] = override.variant
|
||||
}
|
||||
|
||||
if (!override.providerID || !override.modelID) {
|
||||
if (override.variant) {
|
||||
output.message["variant"] = override.variant
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -131,10 +133,8 @@ export function applyUltraworkModelOverrideOnMessage(
|
||||
if (!messageId) {
|
||||
log("[ultrawork-model-override] No message ID found, falling back to direct mutation")
|
||||
output.message.model = targetModel
|
||||
if (override.variant) {
|
||||
output.message["variant"] = override.variant
|
||||
}
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
const fromModel = (output.message.model as { modelID?: string } | undefined)?.modelID ?? "unknown"
|
||||
|
||||
Reference in New Issue
Block a user