Merge pull request #2106 from code-yeongyu/fix/issue-2049-ultrawork-thinking-config
fix(ultrawork-model-override): fix thinking config when upgrading variant
This commit is contained in:
commit
cf0d157673
@ -589,20 +589,22 @@ describe("createBuiltinAgents with requiresProvider gating (hephaestus)", () =>
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
test("hephaestus is created when github-copilot provider is connected", async () => {
|
test("hephaestus is NOT created when only github-copilot is connected (gpt-5.3-codex unavailable via github-copilot)", async () => {
|
||||||
// #given - github-copilot provider has models available
|
// #given - github-copilot provider has models available, but no cache
|
||||||
const fetchSpy = spyOn(shared, "fetchAvailableModels").mockResolvedValue(
|
const fetchSpy = spyOn(shared, "fetchAvailableModels").mockResolvedValue(
|
||||||
new Set(["github-copilot/gpt-5.3-codex"])
|
new Set(["github-copilot/gpt-5.3-codex"])
|
||||||
)
|
)
|
||||||
|
const cacheSpy = spyOn(connectedProvidersCache, "readConnectedProvidersCache").mockReturnValue(null)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// #when
|
// #when
|
||||||
const agents = await createBuiltinAgents([], {}, undefined, TEST_DEFAULT_MODEL, undefined, undefined, [], {})
|
const agents = await createBuiltinAgents([], {}, undefined, TEST_DEFAULT_MODEL, undefined, undefined, [], {})
|
||||||
|
|
||||||
// #then
|
// #then - hephaestus requires openai/opencode, github-copilot alone is insufficient
|
||||||
expect(agents.hephaestus).toBeDefined()
|
expect(agents.hephaestus).toBeUndefined()
|
||||||
} finally {
|
} finally {
|
||||||
fetchSpy.mockRestore()
|
fetchSpy.mockRestore()
|
||||||
|
cacheSpy.mockRestore()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -308,7 +308,10 @@ describe("applyUltraworkModelOverrideOnMessage", () => {
|
|||||||
//#then
|
//#then
|
||||||
expect(output.message.model).toEqual({ providerID: "anthropic", modelID: "claude-opus-4-6" })
|
expect(output.message.model).toEqual({ providerID: "anthropic", modelID: "claude-opus-4-6" })
|
||||||
expect(output.message["variant"]).toBe("max")
|
expect(output.message["variant"]).toBe("max")
|
||||||
expect(output.message["thinking"]).toBe("max")
|
expect(output.message["thinking"]).toEqual({
|
||||||
|
type: "enabled",
|
||||||
|
budgetTokens: 16000,
|
||||||
|
})
|
||||||
expect(dbOverrideSpy).not.toHaveBeenCalled()
|
expect(dbOverrideSpy).not.toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -324,7 +327,10 @@ describe("applyUltraworkModelOverrideOnMessage", () => {
|
|||||||
//#then
|
//#then
|
||||||
expect(output.message.model).toBeUndefined()
|
expect(output.message.model).toBeUndefined()
|
||||||
expect(output.message["variant"]).toBe("high")
|
expect(output.message["variant"]).toBe("high")
|
||||||
expect(output.message["thinking"]).toBe("high")
|
expect(output.message["thinking"]).toEqual({
|
||||||
|
type: "enabled",
|
||||||
|
budgetTokens: 16000,
|
||||||
|
})
|
||||||
expect(dbOverrideSpy).not.toHaveBeenCalled()
|
expect(dbOverrideSpy).not.toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import { scheduleDeferredModelOverride } from "./ultrawork-db-model-override"
|
|||||||
const CODE_BLOCK = /```[\s\S]*?```/g
|
const CODE_BLOCK = /```[\s\S]*?```/g
|
||||||
const INLINE_CODE = /`[^`]+`/g
|
const INLINE_CODE = /`[^`]+`/g
|
||||||
const ULTRAWORK_PATTERN = /\b(ultrawork|ulw)\b/i
|
const ULTRAWORK_PATTERN = /\b(ultrawork|ulw)\b/i
|
||||||
|
const ULTRAWORK_THINKING_CONFIG = { type: "enabled", budgetTokens: 16000 } as const
|
||||||
|
|
||||||
export function detectUltrawork(text: string): boolean {
|
export function detectUltrawork(text: string): boolean {
|
||||||
const clean = text.replace(CODE_BLOCK, "").replace(INLINE_CODE, "")
|
const clean = text.replace(CODE_BLOCK, "").replace(INLINE_CODE, "")
|
||||||
@ -117,7 +118,7 @@ export function applyUltraworkModelOverrideOnMessage(
|
|||||||
if (!override.providerID || !override.modelID) {
|
if (!override.providerID || !override.modelID) {
|
||||||
if (override.variant) {
|
if (override.variant) {
|
||||||
output.message["variant"] = override.variant
|
output.message["variant"] = override.variant
|
||||||
output.message["thinking"] = override.variant
|
output.message["thinking"] = { ...ULTRAWORK_THINKING_CONFIG }
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -134,7 +135,7 @@ export function applyUltraworkModelOverrideOnMessage(
|
|||||||
output.message.model = targetModel
|
output.message.model = targetModel
|
||||||
if (override.variant) {
|
if (override.variant) {
|
||||||
output.message["variant"] = override.variant
|
output.message["variant"] = override.variant
|
||||||
output.message["thinking"] = override.variant
|
output.message["thinking"] = { ...ULTRAWORK_THINKING_CONFIG }
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user