fix: gracefully downgrade xhigh thinking level in cron isolated agent (#9363)

When thinkingDefault is set to "xhigh" but the configured model does not
support it (e.g. Claude), the cron isolated-agent path throws a hard error
causing the job to fail. The interactive chat path already handles this by
silently downgrading to "high".

Apply the same graceful downgrade in the cron path: log a warning and
fall back to "high" instead of crashing.

Co-authored-by: hyf0-agent <hyf0-agent@users.noreply.github.com>
This commit is contained in:
hyf0-agent
2026-02-05 12:52:55 +08:00
committed by GitHub
parent 54ddbc4660
commit 8524666454

View File

@@ -232,7 +232,10 @@ export async function runCronIsolatedAgentTurn(params: {
});
}
if (thinkLevel === "xhigh" && !supportsXHighThinking(provider, model)) {
throw new Error(`Thinking level "xhigh" is only supported for ${formatXHighModelHint()}.`);
logWarn(
`[cron:${params.job.id}] Thinking level "xhigh" is not supported for ${provider}/${model}; downgrading to "high".`,
);
thinkLevel = "high";
}
const timeoutMs = resolveAgentTimeoutMs({