fix: skip thinking param injection for GLM models in sisyphus-junior (#2967)

GLM-5 has native reasoning built-in. Injecting thinking: {type: 'enabled'}
causes a param conflict (400 error). Add isGlmModel() check to return base
config without thinking/reasoningEffort for GLM models.

- Add isGlmModel() helper to types.ts
- Early return in createSisyphusJuniorAgentWithOverrides for GLM models
- Add tests for isGlmModel and GLM reasoning config behavior
This commit is contained in:
YeonGyu-Kim
2026-03-31 16:32:32 +09:00
parent fece331736
commit 71c60e1be4
4 changed files with 69 additions and 2 deletions
+5 -1
View File
@@ -12,7 +12,7 @@
import type { AgentConfig } from "@opencode-ai/sdk"
import type { AgentMode } from "../types"
import { isGptModel, isGeminiModel } from "../types"
import { isGlmModel, isGptModel, isGeminiModel } from "../types"
import type { AgentOverrideConfig } from "../../config/schema"
import {
createAgentToolRestrictions,
@@ -123,6 +123,10 @@ export function createSisyphusJuniorAgentWithOverrides(
return { ...base, reasoningEffort: "medium" } as AgentConfig
}
if (isGlmModel(model)) {
return base as AgentConfig
}
return {
...base,
thinking: { type: "enabled", budgetTokens: 32000 },
+38
View File
@@ -143,6 +143,44 @@ describe("createSisyphusJuniorAgentWithOverrides", () => {
})
})
describe("reasoning configuration", () => {
test("#given GPT model #when agent is created #then uses reasoningEffort", () => {
// given
const override = { model: "openai/gpt-5.4" }
// when
const result = createSisyphusJuniorAgentWithOverrides(override)
// then
expect(result.reasoningEffort).toBe("medium")
expect(result.thinking).toBeUndefined()
})
test("#given Claude model #when agent is created #then injects thinking", () => {
// given
const override = { model: "anthropic/claude-sonnet-4-6" }
// when
const result = createSisyphusJuniorAgentWithOverrides(override)
// then
expect(result.reasoningEffort).toBeUndefined()
expect(result.thinking).toEqual({ type: "enabled", budgetTokens: 32000 })
})
test("#given GLM reasoning model #when agent is created #then skips injected thinking", () => {
// given
const override = { model: "z-ai/glm-5" }
// when
const result = createSisyphusJuniorAgentWithOverrides(override)
// then
expect(result.reasoningEffort).toBeUndefined()
expect(result.thinking).toBeUndefined()
})
})
describe("tool safety (task blocked, call_omo_agent allowed)", () => {
test("task remains blocked, call_omo_agent is allowed via tools format", () => {
// given