feat(config): add model variant support

Allow optional model variant config for agents and categories.
Propagate category variants into task model payloads so
category-driven runs inherit provider-specific variants.

Closes: #647
This commit is contained in:
Jason Kölker
2026-01-10 21:44:20 +00:00
parent f9fce50144
commit 2b8853cbac
18 changed files with 452 additions and 12 deletions
+83
View File
@@ -0,0 +1,83 @@
import { describe, expect, test } from "bun:test"
import type { OhMyOpenCodeConfig } from "../config"
import { applyAgentVariant, resolveAgentVariant } from "./agent-variant"
describe("resolveAgentVariant", () => {
test("returns undefined when agent name missing", () => {
// #given
const config = {} as OhMyOpenCodeConfig
// #when
const variant = resolveAgentVariant(config)
// #then
expect(variant).toBeUndefined()
})
test("returns agent override variant", () => {
// #given
const config = {
agents: {
Sisyphus: { variant: "low" },
},
} as OhMyOpenCodeConfig
// #when
const variant = resolveAgentVariant(config, "Sisyphus")
// #then
expect(variant).toBe("low")
})
test("returns category variant when agent uses category", () => {
// #given
const config = {
agents: {
Sisyphus: { category: "ultrabrain" },
},
categories: {
ultrabrain: { model: "openai/gpt-5.2", variant: "xhigh" },
},
} as OhMyOpenCodeConfig
// #when
const variant = resolveAgentVariant(config, "Sisyphus")
// #then
expect(variant).toBe("xhigh")
})
})
describe("applyAgentVariant", () => {
test("sets variant when message is undefined", () => {
// #given
const config = {
agents: {
Sisyphus: { variant: "low" },
},
} as OhMyOpenCodeConfig
const message: { variant?: string } = {}
// #when
applyAgentVariant(config, "Sisyphus", message)
// #then
expect(message.variant).toBe("low")
})
test("does not override existing variant", () => {
// #given
const config = {
agents: {
Sisyphus: { variant: "low" },
},
} as OhMyOpenCodeConfig
const message = { variant: "max" }
// #when
applyAgentVariant(config, "Sisyphus", message)
// #then
expect(message.variant).toBe("max")
})
})