diff --git a/CHANGELOG.md b/CHANGELOG.md index 179c404cb..7e2b5fae3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Gateway: add Tailscale binary discovery, custom bind mode, and probe auth retry for password changes. (#740 — thanks @jeffersonwarrior) - Agents: add compaction mode config with optional safeguard summarization for long histories. (#700 — thanks @thewilloftheshadow) - Tools: add tool profiles plus group shorthands for tool policy allow/deny (global, per-agent, sandbox). +- Thinking: allow xhigh for GPT-5.2 + Codex models and downgrade on unsupported switches. (#444 — thanks @grp06) ### Fixes - Gateway: honor `CLAWDBOT_LAUNCHD_LABEL` / `CLAWDBOT_SYSTEMD_UNIT` overrides when checking or restarting the daemon. diff --git a/src/agents/model-selection.ts b/src/agents/model-selection.ts index d98260583..c1a5b02cc 100644 --- a/src/agents/model-selection.ts +++ b/src/agents/model-selection.ts @@ -7,7 +7,13 @@ export type ModelRef = { model: string; }; -export type ThinkLevel = "off" | "minimal" | "low" | "medium" | "high"; +export type ThinkLevel = + | "off" + | "minimal" + | "low" + | "medium" + | "high" + | "xhigh"; export type ModelAliasIndex = { byAlias: Map; diff --git a/src/auto-reply/reply.directive.test.ts b/src/auto-reply/reply.directive.test.ts index 27d1d335b..fc499fd02 100644 --- a/src/auto-reply/reply.directive.test.ts +++ b/src/auto-reply/reply.directive.test.ts @@ -81,9 +81,11 @@ describe("directive behavior", () => { }, {}, { - agent: { - model: "openai-codex/gpt-5.2-codex", - workspace: path.join(home, "clawd"), + agents: { + defaults: { + model: "openai-codex/gpt-5.2-codex", + workspace: path.join(home, "clawd"), + }, }, whatsapp: { allowFrom: ["*"] }, session: { store: storePath }, @@ -109,9 +111,11 @@ describe("directive behavior", () => { }, {}, { - agent: { - model: "openai/gpt-5.2", - workspace: path.join(home, "clawd"), + agents: { + defaults: { + model: "openai/gpt-5.2", + workspace: path.join(home, "clawd"), + }, }, whatsapp: { allowFrom: ["*"] }, session: { store: storePath }, @@ -137,9 +141,11 @@ describe("directive behavior", () => { }, {}, { - agent: { - model: "openai/gpt-4.1-mini", - workspace: path.join(home, "clawd"), + agents: { + defaults: { + model: "openai/gpt-4.1-mini", + workspace: path.join(home, "clawd"), + }, }, whatsapp: { allowFrom: ["*"] }, session: { store: storePath }, diff --git a/src/auto-reply/reply.ts b/src/auto-reply/reply.ts index a5b67d8b8..94403c00d 100644 --- a/src/auto-reply/reply.ts +++ b/src/auto-reply/reply.ts @@ -29,7 +29,10 @@ import { type ClawdbotConfig, loadConfig, } from "../config/config.js"; -import { resolveSessionFilePath } from "../config/sessions.js"; +import { + resolveSessionFilePath, + saveSessionStore, +} from "../config/sessions.js"; import { logVerbose } from "../globals.js"; import { clearCommandLane, getQueueSize } from "../process/command-queue.js"; import { getProviderDock } from "../providers/dock.js"; diff --git a/src/auto-reply/reply/directive-handling.ts b/src/auto-reply/reply/directive-handling.ts index 034215277..1ae1b0831 100644 --- a/src/auto-reply/reply/directive-handling.ts +++ b/src/auto-reply/reply/directive-handling.ts @@ -1227,8 +1227,8 @@ export async function handleDirectiveOnly(params: { const nextThinkLevel = directives.hasThinkDirective ? directives.thinkLevel - : (sessionEntry?.thinkingLevel as ThinkLevel | undefined) ?? - currentThinkLevel; + : ((sessionEntry?.thinkingLevel as ThinkLevel | undefined) ?? + currentThinkLevel); const shouldDowngradeXHigh = !directives.hasThinkDirective && nextThinkLevel === "xhigh" && diff --git a/src/auto-reply/thinking.ts b/src/auto-reply/thinking.ts index 92c072f22..7af93dd40 100644 --- a/src/auto-reply/thinking.ts +++ b/src/auto-reply/thinking.ts @@ -89,11 +89,11 @@ export function formatThinkingLevels( } export function formatXHighModelHint(): string { - if (XHIGH_MODEL_REFS.length === 1) return XHIGH_MODEL_REFS[0]; - if (XHIGH_MODEL_REFS.length === 2) { - return `${XHIGH_MODEL_REFS[0]} or ${XHIGH_MODEL_REFS[1]}`; - } - return `${XHIGH_MODEL_REFS.slice(0, -1).join(", ")} or ${XHIGH_MODEL_REFS[XHIGH_MODEL_REFS.length - 1]}`; + const refs = [...XHIGH_MODEL_REFS] as string[]; + if (refs.length === 0) return "unknown model"; + if (refs.length === 1) return refs[0]; + if (refs.length === 2) return `${refs[0]} or ${refs[1]}`; + return `${refs.slice(0, -1).join(", ")} or ${refs[refs.length - 1]}`; } // Normalize verbose flags used to toggle agent verbosity.