fix(opencode): scope agent variant to model (#11410)

This commit is contained in:
neavo
2026-02-02 04:12:30 +08:00
committed by GitHub
parent 16145af480
commit f15755684f
5 changed files with 111 additions and 2 deletions

View File

@@ -255,6 +255,37 @@ test("handles agent configuration", async () => {
})
})
test("treats agent variant as model-scoped setting (not provider option)", async () => {
await using tmp = await tmpdir({
init: async (dir) => {
await writeConfig(dir, {
$schema: "https://opencode.ai/config.json",
agent: {
test_agent: {
model: "openai/gpt-5.2",
variant: "xhigh",
max_tokens: 123,
},
},
})
},
})
await Instance.provide({
directory: tmp.path,
fn: async () => {
const config = await Config.get()
const agent = config.agent?.["test_agent"]
expect(agent?.variant).toBe("xhigh")
expect(agent?.options).toMatchObject({
max_tokens: 123,
})
expect(agent?.options).not.toHaveProperty("variant")
},
})
})
test("handles command configuration", async () => {
await using tmp = await tmpdir({
init: async (dir) => {