refactor(ultrawork): remove thinking config injection from model override

Delegate thinking config control to the provider layer rather than
injecting it manually in ultrawork model override.

🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
YeonGyu-Kim 2026-02-26 12:00:25 +09:00
parent 52d366e866
commit 0c59d2dbe7
4 changed files with 10 additions and 14 deletions

View File

@ -960,6 +960,9 @@
} }
}, },
"additionalProperties": false "additionalProperties": false
},
"allow_non_gpt_model": {
"type": "boolean"
} }
}, },
"additionalProperties": false "additionalProperties": false
@ -3248,6 +3251,11 @@
"prompt_append": { "prompt_append": {
"type": "string" "type": "string"
}, },
"max_prompt_tokens": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"is_unstable_agent": { "is_unstable_agent": {
"type": "boolean" "type": "boolean"
}, },

View File

@ -21,11 +21,10 @@ function tryUpdateMessageModel(
) )
const result = stmt.run(targetModel.providerID, targetModel.modelID, messageId) const result = stmt.run(targetModel.providerID, targetModel.modelID, messageId)
if (result.changes === 0) return false if (result.changes === 0) return false
if (variant) { if (variant) {
db.prepare( db.prepare(
`UPDATE message SET data = json_set(data, '$.variant', ?, '$.thinking', ?) WHERE id = ?`, `UPDATE message SET data = json_set(data, '$.variant', ?) WHERE id = ?`,
).run(variant, variant, messageId) ).run(variant, messageId)
} }
return true return true
} }

View File

@ -308,10 +308,6 @@ 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"]).toEqual({
type: "enabled",
budgetTokens: 16000,
})
expect(dbOverrideSpy).not.toHaveBeenCalled() expect(dbOverrideSpy).not.toHaveBeenCalled()
}) })
@ -327,10 +323,6 @@ 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"]).toEqual({
type: "enabled",
budgetTokens: 16000,
})
expect(dbOverrideSpy).not.toHaveBeenCalled() expect(dbOverrideSpy).not.toHaveBeenCalled()
}) })

View File

@ -8,7 +8,6 @@ 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, "")
@ -118,7 +117,6 @@ 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"] = { ...ULTRAWORK_THINKING_CONFIG }
} }
return return
} }
@ -135,7 +133,6 @@ 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"] = { ...ULTRAWORK_THINKING_CONFIG }
} }
return return
} }