From 42795b87a36e4a863b1bd916f698e238346f2daf Mon Sep 17 00:00:00 2001 From: Kay-051 Date: Mon, 23 Feb 2026 16:53:49 +0800 Subject: [PATCH] fix(agents): don't auto-enable reasoning when thinking is active (#24290) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/auto-reply/reply/get-reply-directives.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/auto-reply/reply/get-reply-directives.ts b/src/auto-reply/reply/get-reply-directives.ts index f421ed92eae..ba1b1c0656e 100644 --- a/src/auto-reply/reply/get-reply-directives.ts +++ b/src/auto-reply/reply/get-reply-directives.ts @@ -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(); }