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:
YeonGyu-Kim
2026-02-25 16:16:48 +09:00
committed by GitHub
3 changed files with 17 additions and 8 deletions

View File

@@ -589,20 +589,22 @@ describe("createBuiltinAgents with requiresProvider gating (hephaestus)", () =>
}
})
test("hephaestus is created when github-copilot provider is connected", async () => {
// #given - github-copilot provider has models available
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, but no cache
const fetchSpy = spyOn(shared, "fetchAvailableModels").mockResolvedValue(
new Set(["github-copilot/gpt-5.3-codex"])
)
const cacheSpy = spyOn(connectedProvidersCache, "readConnectedProvidersCache").mockReturnValue(null)
try {
// #when
const agents = await createBuiltinAgents([], {}, undefined, TEST_DEFAULT_MODEL, undefined, undefined, [], {})
// #then
expect(agents.hephaestus).toBeDefined()
// #then - hephaestus requires openai/opencode, github-copilot alone is insufficient
expect(agents.hephaestus).toBeUndefined()
} finally {
fetchSpy.mockRestore()
cacheSpy.mockRestore()
}
})

View File

@@ -308,7 +308,10 @@ describe("applyUltraworkModelOverrideOnMessage", () => {
//#then
expect(output.message.model).toEqual({ providerID: "anthropic", modelID: "claude-opus-4-6" })
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()
})
@@ -324,7 +327,10 @@ describe("applyUltraworkModelOverrideOnMessage", () => {
//#then
expect(output.message.model).toBeUndefined()
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()
})

View File

@@ -8,6 +8,7 @@ import { scheduleDeferredModelOverride } from "./ultrawork-db-model-override"
const CODE_BLOCK = /```[\s\S]*?```/g
const INLINE_CODE = /`[^`]+`/g
const ULTRAWORK_PATTERN = /\b(ultrawork|ulw)\b/i
const ULTRAWORK_THINKING_CONFIG = { type: "enabled", budgetTokens: 16000 } as const
export function detectUltrawork(text: string): boolean {
const clean = text.replace(CODE_BLOCK, "").replace(INLINE_CODE, "")
@@ -117,7 +118,7 @@ export function applyUltraworkModelOverrideOnMessage(
if (!override.providerID || !override.modelID) {
if (override.variant) {
output.message["variant"] = override.variant
output.message["thinking"] = override.variant
output.message["thinking"] = { ...ULTRAWORK_THINKING_CONFIG }
}
return
}
@@ -134,7 +135,7 @@ export function applyUltraworkModelOverrideOnMessage(
output.message.model = targetModel
if (override.variant) {
output.message["variant"] = override.variant
output.message["thinking"] = override.variant
output.message["thinking"] = { ...ULTRAWORK_THINKING_CONFIG }
}
return
}