fix: detect GPT models behind proxy providers (litellm, ollama) in isGptModel

isGptModel only matched openai/ and github-copilot/gpt- prefixes, causing
models like litellm/gpt-5.2 to fall into the Claude code path. This
injected Claude-specific thinking config, which the opencode runtime
translated into a reasoningSummary API parameter — rejected by OpenAI.

Extract model name after provider prefix and match against GPT model
name patterns (gpt-*, o1, o3, o4).

Closes #1788

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
HyunJun CHOI
2026-02-12 18:24:28 +09:00
parent dbe84688e3
commit 2fa94e8ef8
3 changed files with 65 additions and 12 deletions
@@ -7,6 +7,8 @@
* 3. Everything else (Claude, etc.) → default.ts
*/
import { isGptModel } from "../../../agents/types"
/**
* Checks if agent is a planner-type agent.
* Planners don't need ultrawork injection (they ARE the planner).
@@ -20,15 +22,7 @@ export function isPlannerAgent(agentName?: string): boolean {
return /\bplan\b/.test(normalized)
}
/**
* Checks if model is GPT 5.2 series.
* GPT models benefit from specific prompting patterns.
*/
export function isGptModel(modelID?: string): boolean {
if (!modelID) return false
const lowerModel = modelID.toLowerCase()
return lowerModel.includes("gpt")
}
export { isGptModel }
/** Ultrawork message source type */
export type UltraworkSource = "planner" | "gpt" | "default"
@@ -45,8 +39,8 @@ export function getUltraworkSource(
return "planner"
}
// Priority 2: GPT 5.2 models
if (isGptModel(modelID)) {
// Priority 2: GPT models
if (modelID && isGptModel(modelID)) {
return "gpt"
}