mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 08:10:21 +00:00
fix(agents): preserve thinking fallback with model defaults
This commit is contained in:
@@ -492,7 +492,14 @@ describe("model-selection", () => {
|
||||
cfg,
|
||||
provider: "anthropic",
|
||||
model: "claude-opus-4-6",
|
||||
catalog: [{ provider: "anthropic", id: "claude-opus-4-6", reasoning: true }],
|
||||
catalog: [
|
||||
{
|
||||
provider: "anthropic",
|
||||
id: "claude-opus-4-6",
|
||||
name: "Claude Opus 4.6",
|
||||
reasoning: true,
|
||||
},
|
||||
],
|
||||
}),
|
||||
).toBe("high");
|
||||
});
|
||||
|
||||
@@ -388,6 +388,10 @@ export async function resolveReplyDirectives(params: {
|
||||
});
|
||||
provider = modelState.provider;
|
||||
model = modelState.model;
|
||||
const resolvedThinkLevelWithDefault =
|
||||
resolvedThinkLevel ??
|
||||
(await modelState.resolveDefaultThinkingLevel()) ??
|
||||
(agentCfg?.thinkingDefault as ThinkLevel | undefined);
|
||||
|
||||
// When neither directive nor session set reasoning, default to model capability
|
||||
// (e.g. OpenRouter with reasoning: true). Skip auto-enabling when thinking is
|
||||
@@ -396,9 +400,7 @@ export async function resolveReplyDirectives(params: {
|
||||
const reasoningExplicitlySet =
|
||||
directives.reasoningLevel !== undefined ||
|
||||
(sessionEntry?.reasoningLevel !== undefined && sessionEntry?.reasoningLevel !== null);
|
||||
const effectiveThinkingForReasoning =
|
||||
resolvedThinkLevel ?? (await modelState.resolveDefaultThinkingLevel());
|
||||
const thinkingActive = effectiveThinkingForReasoning !== "off";
|
||||
const thinkingActive = resolvedThinkLevelWithDefault !== "off";
|
||||
if (!reasoningExplicitlySet && resolvedReasoningLevel === "off" && !thinkingActive) {
|
||||
resolvedReasoningLevel = await modelState.resolveDefaultReasoningLevel();
|
||||
}
|
||||
@@ -475,7 +477,7 @@ export async function resolveReplyDirectives(params: {
|
||||
elevatedAllowed,
|
||||
elevatedFailures,
|
||||
defaultActivation,
|
||||
resolvedThinkLevel,
|
||||
resolvedThinkLevel: resolvedThinkLevelWithDefault,
|
||||
resolvedVerboseLevel,
|
||||
resolvedReasoningLevel,
|
||||
resolvedElevatedLevel,
|
||||
|
||||
Reference in New Issue
Block a user