fix: gate xhigh by model (#444) (thanks @grp06)

This commit is contained in:
Peter Steinberger
2026-01-13 06:47:35 +00:00
parent a3641526ab
commit 18d22aa426
6 changed files with 34 additions and 18 deletions

View File

@@ -7,6 +7,7 @@
- Gateway: add Tailscale binary discovery, custom bind mode, and probe auth retry for password changes. (#740 — thanks @jeffersonwarrior) - 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) - 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). - 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 ### Fixes
- Gateway: honor `CLAWDBOT_LAUNCHD_LABEL` / `CLAWDBOT_SYSTEMD_UNIT` overrides when checking or restarting the daemon. - Gateway: honor `CLAWDBOT_LAUNCHD_LABEL` / `CLAWDBOT_SYSTEMD_UNIT` overrides when checking or restarting the daemon.

View File

@@ -7,7 +7,13 @@ export type ModelRef = {
model: string; model: string;
}; };
export type ThinkLevel = "off" | "minimal" | "low" | "medium" | "high"; export type ThinkLevel =
| "off"
| "minimal"
| "low"
| "medium"
| "high"
| "xhigh";
export type ModelAliasIndex = { export type ModelAliasIndex = {
byAlias: Map<string, { alias: string; ref: ModelRef }>; byAlias: Map<string, { alias: string; ref: ModelRef }>;

View File

@@ -81,9 +81,11 @@ describe("directive behavior", () => {
}, },
{}, {},
{ {
agent: { agents: {
model: "openai-codex/gpt-5.2-codex", defaults: {
workspace: path.join(home, "clawd"), model: "openai-codex/gpt-5.2-codex",
workspace: path.join(home, "clawd"),
},
}, },
whatsapp: { allowFrom: ["*"] }, whatsapp: { allowFrom: ["*"] },
session: { store: storePath }, session: { store: storePath },
@@ -109,9 +111,11 @@ describe("directive behavior", () => {
}, },
{}, {},
{ {
agent: { agents: {
model: "openai/gpt-5.2", defaults: {
workspace: path.join(home, "clawd"), model: "openai/gpt-5.2",
workspace: path.join(home, "clawd"),
},
}, },
whatsapp: { allowFrom: ["*"] }, whatsapp: { allowFrom: ["*"] },
session: { store: storePath }, session: { store: storePath },
@@ -137,9 +141,11 @@ describe("directive behavior", () => {
}, },
{}, {},
{ {
agent: { agents: {
model: "openai/gpt-4.1-mini", defaults: {
workspace: path.join(home, "clawd"), model: "openai/gpt-4.1-mini",
workspace: path.join(home, "clawd"),
},
}, },
whatsapp: { allowFrom: ["*"] }, whatsapp: { allowFrom: ["*"] },
session: { store: storePath }, session: { store: storePath },

View File

@@ -29,7 +29,10 @@ import {
type ClawdbotConfig, type ClawdbotConfig,
loadConfig, loadConfig,
} from "../config/config.js"; } from "../config/config.js";
import { resolveSessionFilePath } from "../config/sessions.js"; import {
resolveSessionFilePath,
saveSessionStore,
} from "../config/sessions.js";
import { logVerbose } from "../globals.js"; import { logVerbose } from "../globals.js";
import { clearCommandLane, getQueueSize } from "../process/command-queue.js"; import { clearCommandLane, getQueueSize } from "../process/command-queue.js";
import { getProviderDock } from "../providers/dock.js"; import { getProviderDock } from "../providers/dock.js";

View File

@@ -1227,8 +1227,8 @@ export async function handleDirectiveOnly(params: {
const nextThinkLevel = directives.hasThinkDirective const nextThinkLevel = directives.hasThinkDirective
? directives.thinkLevel ? directives.thinkLevel
: (sessionEntry?.thinkingLevel as ThinkLevel | undefined) ?? : ((sessionEntry?.thinkingLevel as ThinkLevel | undefined) ??
currentThinkLevel; currentThinkLevel);
const shouldDowngradeXHigh = const shouldDowngradeXHigh =
!directives.hasThinkDirective && !directives.hasThinkDirective &&
nextThinkLevel === "xhigh" && nextThinkLevel === "xhigh" &&

View File

@@ -89,11 +89,11 @@ export function formatThinkingLevels(
} }
export function formatXHighModelHint(): string { export function formatXHighModelHint(): string {
if (XHIGH_MODEL_REFS.length === 1) return XHIGH_MODEL_REFS[0]; const refs = [...XHIGH_MODEL_REFS] as string[];
if (XHIGH_MODEL_REFS.length === 2) { if (refs.length === 0) return "unknown model";
return `${XHIGH_MODEL_REFS[0]} or ${XHIGH_MODEL_REFS[1]}`; if (refs.length === 1) return refs[0];
} if (refs.length === 2) return `${refs[0]} or ${refs[1]}`;
return `${XHIGH_MODEL_REFS.slice(0, -1).join(", ")} or ${XHIGH_MODEL_REFS[XHIGH_MODEL_REFS.length - 1]}`; return `${refs.slice(0, -1).join(", ")} or ${refs[refs.length - 1]}`;
} }
// Normalize verbose flags used to toggle agent verbosity. // Normalize verbose flags used to toggle agent verbosity.