From 7677af52a40eb97021bc0b24067d524b044188b6 Mon Sep 17 00:00:00 2001 From: Guilhem Lemouel Date: Tue, 8 Sep 2026 09:31:10 +0200 Subject: [PATCH] fix(ai-chat): resolve the chat manager at init so sending in a session works Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01Hw1yzWHyqqZmQrviUEhr5b --- frontend/src/lib/components/copilot/chat/AIChatInput.svelte | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/components/copilot/chat/AIChatInput.svelte b/frontend/src/lib/components/copilot/chat/AIChatInput.svelte index 75e6a2634d..574b9b6cac 100644 --- a/frontend/src/lib/components/copilot/chat/AIChatInput.svelte +++ b/frontend/src/lib/components/copilot/chat/AIChatInput.svelte @@ -55,6 +55,9 @@ } from '$lib/components/common/image/ExpandableImage.svelte' const chatHost = getChatViewHost() + // Resolved here, not where it is used: getContext is only legal during component + // initialisation, and the mention consumer below runs inside the send gesture. + const chatManager = getAiChatManager() interface Props { availableContext: ContextElement[] @@ -758,7 +761,7 @@ if (chatHost.mode !== AIMode.GLOBAL) return // The mention context belongs to the copilot's own ContextManager, which only // the manager has — the GLOBAL guard above means this host is always it. - getAiChatManager().contextManager?.consumeMentionContext() + chatManager.contextManager?.consumeMentionContext() } function sendRequest() {