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 17dfafefc4
commit 7f67df9bd0
18 changed files with 452 additions and 12 deletions
+55 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, test } from "bun:test"
import { AgentOverrideConfigSchema, BuiltinCategoryNameSchema, OhMyOpenCodeConfigSchema } from "./schema"
import { AgentOverrideConfigSchema, BuiltinCategoryNameSchema, CategoryConfigSchema, OhMyOpenCodeConfigSchema } from "./schema"
describe("disabled_mcps schema", () => {
test("should accept built-in MCP names", () => {
@@ -174,6 +174,33 @@ describe("AgentOverrideConfigSchema", () => {
})
})
describe("variant field", () => {
test("accepts variant as optional string", () => {
// #given
const config = { variant: "high" }
// #when
const result = AgentOverrideConfigSchema.safeParse(config)
// #then
expect(result.success).toBe(true)
if (result.success) {
expect(result.data.variant).toBe("high")
}
})
test("rejects non-string variant", () => {
// #given
const config = { variant: 123 }
// #when
const result = AgentOverrideConfigSchema.safeParse(config)
// #then
expect(result.success).toBe(false)
})
})
describe("skills field", () => {
test("accepts skills as optional string array", () => {
// #given
@@ -303,6 +330,33 @@ describe("AgentOverrideConfigSchema", () => {
})
})
describe("CategoryConfigSchema", () => {
test("accepts variant as optional string", () => {
// #given
const config = { model: "openai/gpt-5.2", variant: "xhigh" }
// #when
const result = CategoryConfigSchema.safeParse(config)
// #then
expect(result.success).toBe(true)
if (result.success) {
expect(result.data.variant).toBe("xhigh")
}
})
test("rejects non-string variant", () => {
// #given
const config = { model: "openai/gpt-5.2", variant: 123 }
// #when
const result = CategoryConfigSchema.safeParse(config)
// #then
expect(result.success).toBe(false)
})
})
describe("BuiltinCategoryNameSchema", () => {
test("accepts all builtin category names", () => {
// #given
+2
View File
@@ -97,6 +97,7 @@ export const BuiltinCommandNameSchema = z.enum([
export const AgentOverrideConfigSchema = z.object({
/** @deprecated Use `category` instead. Model is inherited from category defaults. */
model: z.string().optional(),
variant: z.string().optional(),
/** Category name to inherit model and other settings from CategoryConfig */
category: z.string().optional(),
/** Skill names to inject into agent prompt */
@@ -153,6 +154,7 @@ export const SisyphusAgentConfigSchema = z.object({
export const CategoryConfigSchema = z.object({
model: z.string(),
variant: z.string().optional(),
temperature: z.number().min(0).max(2).optional(),
top_p: z.number().min(0).max(1).optional(),
maxTokens: z.number().optional(),