fix: persist reasoningLevel 'off' instead of deleting it (#24406)#24559
Merged
steipete merged 1 commit intoopenclaw:mainfrom Feb 24, 2026
Merged
fix: persist reasoningLevel 'off' instead of deleting it (#24406)#24559steipete merged 1 commit intoopenclaw:mainfrom
steipete merged 1 commit intoopenclaw:mainfrom
Conversation
) When a user runs /reasoning off, the session patch handler deleted the reasoningLevel field from the session entry. This caused get-reply-directives to treat reasoning as 'not explicitly set', which triggered resolveDefaultReasoningLevel() to re-enable reasoning for capable models (e.g. Claude Opus). The fix persists 'off' explicitly, matching how directive-handling.persist.ts already handles the inline /reasoning off command. Fixes openclaw#24406 Fixes openclaw#24411
steipete
approved these changes
Feb 24, 2026
Contributor
steipete
left a comment
There was a problem hiding this comment.
Reviewed for correctness and simpler alternatives; this is the best scoped change for the issue.
sagarsaija
pushed a commit
to sagarsaija/openclaw
that referenced
this pull request
Feb 24, 2026
) (openclaw#24559) When a user runs /reasoning off, the session patch handler deleted the reasoningLevel field from the session entry. This caused get-reply-directives to treat reasoning as 'not explicitly set', which triggered resolveDefaultReasoningLevel() to re-enable reasoning for capable models (e.g. Claude Opus). The fix persists 'off' explicitly, matching how directive-handling.persist.ts already handles the inline /reasoning off command. Fixes openclaw#24406 Fixes openclaw#24411 Co-authored-by: echoVic <AkiraVic@outlook.com>
plgs2005
pushed a commit
to plgs2005/openclaw
that referenced
this pull request
Feb 24, 2026
) (openclaw#24559) When a user runs /reasoning off, the session patch handler deleted the reasoningLevel field from the session entry. This caused get-reply-directives to treat reasoning as 'not explicitly set', which triggered resolveDefaultReasoningLevel() to re-enable reasoning for capable models (e.g. Claude Opus). The fix persists 'off' explicitly, matching how directive-handling.persist.ts already handles the inline /reasoning off command. Fixes openclaw#24406 Fixes openclaw#24411 Co-authored-by: echoVic <AkiraVic@outlook.com>
abdelkadermeflahi6-web
referenced
this pull request
Feb 24, 2026
abdelkadermeflahi6-web
referenced
this pull request
Feb 24, 2026
margulans
pushed a commit
to margulans/Neiron-AI-assistant
that referenced
this pull request
Feb 25, 2026
) (openclaw#24559) When a user runs /reasoning off, the session patch handler deleted the reasoningLevel field from the session entry. This caused get-reply-directives to treat reasoning as 'not explicitly set', which triggered resolveDefaultReasoningLevel() to re-enable reasoning for capable models (e.g. Claude Opus). The fix persists 'off' explicitly, matching how directive-handling.persist.ts already handles the inline /reasoning off command. Fixes openclaw#24406 Fixes openclaw#24411 Co-authored-by: echoVic <AkiraVic@outlook.com>
brianleach
pushed a commit
to brianleach/openclaw
that referenced
this pull request
Feb 26, 2026
) (openclaw#24559) When a user runs /reasoning off, the session patch handler deleted the reasoningLevel field from the session entry. This caused get-reply-directives to treat reasoning as 'not explicitly set', which triggered resolveDefaultReasoningLevel() to re-enable reasoning for capable models (e.g. Claude Opus). The fix persists 'off' explicitly, matching how directive-handling.persist.ts already handles the inline /reasoning off command. Fixes openclaw#24406 Fixes openclaw#24411 Co-authored-by: echoVic <AkiraVic@outlook.com>
2 tasks
mylukin
pushed a commit
to mylukin/openclaw
that referenced
this pull request
Feb 26, 2026
) (openclaw#24559) When a user runs /reasoning off, the session patch handler deleted the reasoningLevel field from the session entry. This caused get-reply-directives to treat reasoning as 'not explicitly set', which triggered resolveDefaultReasoningLevel() to re-enable reasoning for capable models (e.g. Claude Opus). The fix persists 'off' explicitly, matching how directive-handling.persist.ts already handles the inline /reasoning off command. Fixes openclaw#24406 Fixes openclaw#24411 Co-authored-by: echoVic <AkiraVic@outlook.com>
r4jiv007
pushed a commit
to r4jiv007/openclaw
that referenced
this pull request
Feb 28, 2026
) (openclaw#24559) When a user runs /reasoning off, the session patch handler deleted the reasoningLevel field from the session entry. This caused get-reply-directives to treat reasoning as 'not explicitly set', which triggered resolveDefaultReasoningLevel() to re-enable reasoning for capable models (e.g. Claude Opus). The fix persists 'off' explicitly, matching how directive-handling.persist.ts already handles the inline /reasoning off command. Fixes openclaw#24406 Fixes openclaw#24411 Co-authored-by: echoVic <AkiraVic@outlook.com>
6 tasks
hughdidit
pushed a commit
to hughdidit/DAISy-Agency
that referenced
this pull request
Mar 1, 2026
) (openclaw#24559) When a user runs /reasoning off, the session patch handler deleted the reasoningLevel field from the session entry. This caused get-reply-directives to treat reasoning as 'not explicitly set', which triggered resolveDefaultReasoningLevel() to re-enable reasoning for capable models (e.g. Claude Opus). The fix persists 'off' explicitly, matching how directive-handling.persist.ts already handles the inline /reasoning off command. Fixes openclaw#24406 Fixes openclaw#24411 Co-authored-by: echoVic <AkiraVic@outlook.com> (cherry picked from commit 52ac763)
hughdidit
pushed a commit
to hughdidit/DAISy-Agency
that referenced
this pull request
Mar 3, 2026
) (openclaw#24559) When a user runs /reasoning off, the session patch handler deleted the reasoningLevel field from the session entry. This caused get-reply-directives to treat reasoning as 'not explicitly set', which triggered resolveDefaultReasoningLevel() to re-enable reasoning for capable models (e.g. Claude Opus). The fix persists 'off' explicitly, matching how directive-handling.persist.ts already handles the inline /reasoning off command. Fixes openclaw#24406 Fixes openclaw#24411 Co-authored-by: echoVic <AkiraVic@outlook.com> (cherry picked from commit 52ac763) # Conflicts: # src/gateway/sessions-patch.ts
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
) (openclaw#24559) When a user runs /reasoning off, the session patch handler deleted the reasoningLevel field from the session entry. This caused get-reply-directives to treat reasoning as 'not explicitly set', which triggered resolveDefaultReasoningLevel() to re-enable reasoning for capable models (e.g. Claude Opus). The fix persists 'off' explicitly, matching how directive-handling.persist.ts already handles the inline /reasoning off command. Fixes openclaw#24406 Fixes openclaw#24411 Co-authored-by: echoVic <AkiraVic@outlook.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a user runs
/reasoning off, reasoning content continues to leak into channel messages (Telegram, Matrix, etc.). The WebUI correctly hides reasoning, but channel delivery paths still include it.Reported in #24406 (Telegram, thinking=low) and #24411 (Matrix, /reasoning off).
Root Cause
In
sessions-patch.ts(the WebSocket/API session patch path), whenreasoningLevelis set to"off", the codedeletes the field from the session entry instead of persisting it:Later, in
get-reply-directives.ts, the code checks whether reasoning was explicitly set:Since the field was deleted (
undefined),reasoningExplicitlySetisfalse. This triggers the auto-enable path:For reasoning-capable models (Claude Opus, etc.), this re-enables reasoning — undoing the user's explicit
/reasoning off.Fix
Persist
"off"explicitly instead of deleting the field, matching howdirective-handling.persist.ts(the inline command path) already handles it correctly:Testing
/reasoning off→sessionEntry.reasoningLevel === 'off'→reasoningExplicitlySet === true→ no auto-enable/reasoning onand/reasoning streamcontinue to work as beforenull(reset) still deletes the field, allowing model defaults to applyFixes #24406
Fixes #24411
Greptile Summary
Fixed reasoning content leak in channel messages (Telegram, Matrix) by persisting
reasoningLevel: "off"explicitly instead of deleting it. The previous implementation deleted the field when set to"off", causingget-reply-directives.ts:396-398to treat it as unset and auto-enable reasoning for capable models (Claude Opus, etc.). The fix aligns with the existing pattern used byelevatedLevel(line 222) anddirective-handling.persist.ts:93-95, ensuring the user's explicit/reasoning offcommand is respected across all delivery paths.Confidence Score: 5/5
elevatedLevelon line 222 of the same file). The change matches the pattern already used indirective-handling.persist.ts:93-95, and the PR description provides clear root cause analysis with references to the specific logic that was broken. The fix ensures consistency across two code paths (WebSocket/API vs inline command) and prevents unintended re-enabling of reasoning.Last reviewed commit: d385867