diff --git a/apps/desktop/src/app/contrib/hooks/use-desktop-integrations.test.tsx b/apps/desktop/src/app/contrib/hooks/use-desktop-integrations.test.tsx index fdfa65c57e..0633d6f50f 100644 --- a/apps/desktop/src/app/contrib/hooks/use-desktop-integrations.test.tsx +++ b/apps/desktop/src/app/contrib/hooks/use-desktop-integrations.test.tsx @@ -3,6 +3,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { setApiRequestConnection, setApiRequestProfile } from '@/hermes' import { createClientSessionState } from '@/lib/chat-runtime' +import { adoptNewSessionDraft, stashSessionDraft, takeSessionDraft } from '@/store/composer' import { $confirmRequest, runConfirm, settleConfirm } from '@/store/confirm' import { $hubInstalledOverride } from '@/store/hub-actions' import { requestMcpInstallFromDeepLink } from '@/store/mcp-deeplink-install' @@ -171,6 +172,19 @@ describe('useDesktopIntegrations', () => { expect(navigate).toHaveBeenCalledWith('/remembered-session', { replace: true }) }) + it('announces the restored session so the pre-session draft follows the cold-start navigation', () => { + window.localStorage.setItem('hermes.desktop.lastRoute.profile.default', '/remembered-session') + // Typed on the fresh chat while the backend was still coming up. + stashSessionDraft(null, 'typed while booting', []) + + render({ profileReady: true, sessions: [session({ id: 'remembered-session', profile: 'default' })] }) + + expect(navigate).toHaveBeenCalledWith('/remembered-session', { replace: true }) + // The composer's scope swap may only carry the draft when the restore announced this key. + expect(adoptNewSessionDraft('remembered-session')).toBe(true) + expect(takeSessionDraft('remembered-session').text).toBe('typed while booting') + }) + it('waits for sessions before validating a remembered session route', () => { window.localStorage.setItem('hermes.desktop.lastRoute.profile.default', '/remembered-session')