fix(agents): prioritize per-model thinking defaults (#30439)

* fix(agents): honor per-model thinking defaults

* fix(agents): preserve thinking fallback with model defaults

---------

Co-authored-by: Mark L <73659136+markliuyuxiang@users.noreply.github.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
Mark L
2026-03-02 12:00:02 +08:00
committed by GitHub
parent 3fc19ed7d7
commit 0f2dce0483
9 changed files with 123 additions and 31 deletions

View File

@@ -299,16 +299,15 @@ export async function runCronIsolatedAgentTurn(params: {
}
}
// Resolve thinking level - job thinking > hooks.gmail.thinking > agent default
// Resolve thinking level - job thinking > hooks.gmail.thinking > model/global defaults
const hooksGmailThinking = isGmailHook
? normalizeThinkLevel(params.cfg.hooks?.gmail?.thinking)
: undefined;
const thinkOverride = normalizeThinkLevel(agentCfg?.thinkingDefault);
const jobThink = normalizeThinkLevel(
(params.job.payload.kind === "agentTurn" ? params.job.payload.thinking : undefined) ??
undefined,
);
let thinkLevel = jobThink ?? hooksGmailThinking ?? thinkOverride;
let thinkLevel = jobThink ?? hooksGmailThinking;
if (!thinkLevel) {
thinkLevel = resolveThinkingDefault({
cfg: cfgWithAgentDefaults,