Merge pull request #2093 from code-yeongyu/fix/issue-1966-ultrawork-variant
fix(keyword-detector): respect ultrawork config variant instead of hardcoding "max"
This commit is contained in:
commit
58201220cc
@ -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", () => {
|
test("should NOT mutate output.message.model when message ID present", () => {
|
||||||
//#given
|
//#given
|
||||||
const sonnetModel = { providerID: "anthropic", modelID: "claude-sonnet-4-6" }
|
const sonnetModel = { providerID: "anthropic", modelID: "claude-sonnet-4-6" }
|
||||||
|
|||||||
@ -114,10 +114,12 @@ export function applyUltraworkModelOverrideOnMessage(
|
|||||||
const override = resolveUltraworkOverride(pluginConfig, inputAgentName, output, sessionID)
|
const override = resolveUltraworkOverride(pluginConfig, inputAgentName, output, sessionID)
|
||||||
if (!override) return
|
if (!override) return
|
||||||
|
|
||||||
|
if (override.variant) {
|
||||||
|
output.message["variant"] = override.variant
|
||||||
|
output.message["thinking"] = override.variant
|
||||||
|
}
|
||||||
|
|
||||||
if (!override.providerID || !override.modelID) {
|
if (!override.providerID || !override.modelID) {
|
||||||
if (override.variant) {
|
|
||||||
output.message["variant"] = override.variant
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,10 +133,8 @@ export function applyUltraworkModelOverrideOnMessage(
|
|||||||
if (!messageId) {
|
if (!messageId) {
|
||||||
log("[ultrawork-model-override] No message ID found, falling back to direct mutation")
|
log("[ultrawork-model-override] No message ID found, falling back to direct mutation")
|
||||||
output.message.model = targetModel
|
output.message.model = targetModel
|
||||||
if (override.variant) {
|
|
||||||
output.message["variant"] = override.variant
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const fromModel = (output.message.model as { modelID?: string } | undefined)?.modelID ?? "unknown"
|
const fromModel = (output.message.model as { modelID?: string } | undefined)?.modelID ?? "unknown"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user