mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 21:10:21 +00:00
fix(agents): don't auto-enable reasoning when thinking is active (#24290)
When thinking is set (e.g. thinking=low), the model produces internal thinking blocks. The reasoning auto-default (based on model capability) was formatting these blocks as "Reasoning:" text and delivering them to WhatsApp/Telegram, leaking internal content to users. Skip auto-enabling reasoning when thinkLevel is already set — the two features serve the same purpose and enabling both causes the model's internal thinking to be exposed as visible chat messages. Users who explicitly set /reasoning on still get reasoning output. Closes #24290 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -390,10 +390,14 @@ export async function resolveReplyDirectives(params: {
|
||||
model = modelState.model;
|
||||
|
||||
// When neither directive nor session set reasoning, default to model capability (e.g. OpenRouter with reasoning: true).
|
||||
// Skip auto-enabling when thinking is already active — the model's internal
|
||||
// thinking blocks would otherwise be formatted and delivered as visible
|
||||
// "Reasoning:" messages, leaking internal content to the user.
|
||||
const reasoningExplicitlySet =
|
||||
directives.reasoningLevel !== undefined ||
|
||||
(sessionEntry?.reasoningLevel !== undefined && sessionEntry?.reasoningLevel !== null);
|
||||
if (!reasoningExplicitlySet && resolvedReasoningLevel === "off") {
|
||||
const thinkingActive = resolvedThinkLevel !== undefined && resolvedThinkLevel !== "off";
|
||||
if (!reasoningExplicitlySet && resolvedReasoningLevel === "off" && !thinkingActive) {
|
||||
resolvedReasoningLevel = await modelState.resolveDefaultReasoningLevel();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user