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)
- 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.

View File

@@ -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<string, { alias: string; ref: ModelRef }>;

View File

@@ -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 },

View File

@@ -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";

View File

@@ -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" &&

View File

@@ -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.