Merge pull request #2977 from code-yeongyu/fix/issue-2967-glm-thinking
fix: skip thinking param injection for GLM models in sisyphus-junior
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
||||
"name": "oh-my-opencode",
|
||||
"version": "3.14.0",
|
||||
"description": "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
||||
"main": "dist/index.js",
|
||||
"main": "./dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
||||
@@ -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 },
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, test, expect } from "bun:test";
|
||||
import { isGptModel, isGeminiModel, isGpt5_4Model, isMiniMaxModel } from "./types";
|
||||
import { isGptModel, isGeminiModel, isGlmModel, isGpt5_4Model, isMiniMaxModel } from "./types";
|
||||
|
||||
describe("isGpt5_4Model", () => {
|
||||
test("detects gpt-5.4 models", () => {
|
||||
@@ -101,6 +101,26 @@ describe("isMiniMaxModel", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("isGlmModel", () => {
|
||||
test("#given GLM models with provider prefix #then returns true", () => {
|
||||
expect(isGlmModel("z-ai/glm-5")).toBe(true);
|
||||
expect(isGlmModel("opencode/glm-5")).toBe(true);
|
||||
expect(isGlmModel("opencode-go/glm-5-turbo")).toBe(true);
|
||||
expect(isGlmModel("opencode/glm-4.6v")).toBe(true);
|
||||
});
|
||||
|
||||
test("#given GLM models without provider prefix #then returns true", () => {
|
||||
expect(isGlmModel("glm-5")).toBe(true);
|
||||
expect(isGlmModel("glm-5-turbo")).toBe(true);
|
||||
});
|
||||
|
||||
test("#given non-GLM models #then returns false", () => {
|
||||
expect(isGlmModel("openai/gpt-5.4")).toBe(false);
|
||||
expect(isGlmModel("anthropic/claude-opus-4-6")).toBe(false);
|
||||
expect(isGlmModel("google/gemini-3.1-pro")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("isGeminiModel", () => {
|
||||
test("#given google provider models #then returns true", () => {
|
||||
expect(isGeminiModel("google/gemini-3.1-pro")).toBe(true);
|
||||
|
||||
@@ -96,6 +96,11 @@ export function isMiniMaxModel(model: string): boolean {
|
||||
return modelName.includes("minimax");
|
||||
}
|
||||
|
||||
export function isGlmModel(model: string): boolean {
|
||||
const modelName = extractModelName(model).toLowerCase();
|
||||
return modelName.includes("glm");
|
||||
}
|
||||
|
||||
export function isGeminiModel(model: string): boolean {
|
||||
if (GEMINI_PROVIDERS.some((prefix) => model.startsWith(prefix))) return true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user