From b7187cbe5987e68ddfbaa8fddb0caf08dfd8db33 Mon Sep 17 00:00:00 2001 From: Marco Beretta <81851188+berry-13@users.noreply.github.com> Date: Tue, 23 Jun 2026 08:39:21 +0200 Subject: [PATCH] fix: disable the temporary-chat shortcut under forced retention Forced ephemeral retention turns the TEMPORARY_CHAT permission on, which keeps the global toggleTemporaryChat shortcut (Ctrl/Cmd+Shift+Y) registered even though the badge is disabled. Pressing it flipped store.isTemporary off in an enforced chat, so the next submission carried isTemporary false and the client queued title generation and history entries while the server saved the chat as hidden temporary. Gate handleToggleTemporaryChat when retention is enforced so the shortcut is a no-op, matching the disabled badge and keeping the enforced temporary state. --- client/src/hooks/useKeyboardShortcuts.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/client/src/hooks/useKeyboardShortcuts.ts b/client/src/hooks/useKeyboardShortcuts.ts index 203efb7720..959634a43f 100644 --- a/client/src/hooks/useKeyboardShortcuts.ts +++ b/client/src/hooks/useKeyboardShortcuts.ts @@ -4,7 +4,12 @@ import { useToastContext } from '@librechat/client'; import { useQueryClient } from '@tanstack/react-query'; import { useMatch, useNavigate } from 'react-router-dom'; import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'; -import { PermissionTypes, Permissions, QueryKeys } from 'librechat-data-provider'; +import { + PermissionTypes, + Permissions, + QueryKeys, + isForcedTemporaryRetention, +} from 'librechat-data-provider'; import type { ShortcutBinding } from '~/utils/shortcuts'; import type { ShortcutOverride } from '~/store/misc'; import { @@ -15,8 +20,8 @@ import { isMacPlatform, parseBinding, } from '~/utils/shortcuts'; +import { useArchiveConvoMutation, useGetStartupConfig } from '~/data-provider'; import { mainTextareaId, NotificationSeverity } from '~/common'; -import { useArchiveConvoMutation } from '~/data-provider'; import { useHasAccess, useLocalize } from '~/hooks'; import { clearMessagesCache } from '~/utils'; import useNewConvo from './useNewConvo'; @@ -440,6 +445,8 @@ export function useShortcutActions(): ShortcutAction[] { permissionType: PermissionTypes.TEMPORARY_CHAT, permission: Permissions.USE, }); + const { data: startupConfig } = useGetStartupConfig(); + const isRetentionEnforced = isForcedTemporaryRetention(startupConfig?.interface?.retentionMode); const archiveMutation = useArchiveConvoMutation(); @@ -590,7 +597,7 @@ export function useShortcutActions(): ShortcutAction[] { }, []); const handleToggleTemporaryChat = useCallback(() => { - if (hasAccessToTemporaryChat !== true) { + if (hasAccessToTemporaryChat !== true || isRetentionEnforced) { return false; } if (!routeConvoId) { @@ -604,6 +611,7 @@ export function useShortcutActions(): ShortcutAction[] { return true; }, [ hasAccessToTemporaryChat, + isRetentionEnforced, routeConvoId, conversation?.messages, isSubmitting,