fix: persist reasoningLevel 'off' instead of deleting it (#24406) (#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 #24406
Fixes #24411

Co-authored-by: echoVic <AkiraVic@outlook.com>
This commit is contained in:
青雲
2026-02-24 11:33:30 +08:00
committed by GitHub
parent 04bcabcbae
commit 52ac7634db

View File

@@ -186,11 +186,9 @@ export async function applySessionsPatchToStore(params: {
if (!normalized) {
return invalid('invalid reasoningLevel (use "on"|"off"|"stream")');
}
if (normalized === "off") {
delete next.reasoningLevel;
} else {
next.reasoningLevel = normalized;
}
// Persist "off" explicitly so that resolveDefaultReasoningLevel()
// does not re-enable reasoning for capable models (#24406).
next.reasoningLevel = normalized;
}
}