Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(chat): a notice about a chat stays with that chat

purple8ec9e347265c
diff --git a/src/components/chat/ChatNotices.tsx b/src/components/chat/ChatNotices.tsx
index 16411e53..3bacfc8d 100644
--- a/src/components/chat/ChatNotices.tsx
+++ b/src/components/chat/ChatNotices.tsx
@@ -13,7 +13,7 @@
*/
import { Bot, FolderOpen, ImageOff, Images, Paperclip } from 'lucide-react'
import { Hinweis } from '../ui/Hinweis'
-import { useChatNoticeStore, type ChatNoticeId } from '../../stores/chatNoticeStore'
+import { useChatNoticeStore, CONVERSATION_BOUND, type ChatNoticeId } from '../../stores/chatNoticeStore'
import { COMPOSER_MAX_W } from './composer-width'
/** Das Symbol je Zeile. Keine eigene Farbe: die traegt der Ton. */
@@ -25,10 +25,6 @@ const ICON: Record<ChatNoticeId, typeof Paperclip> = {
'agent-for-local-files': Bot,
}
-/** Zeilen ueber den Agent-Knopf und seinen Ordner im CHAT. Im Code-Bereich
- * gibt es diesen Knopf nicht, dort waehlt man den Ordner im Dateibaum; die
- * Anleitung stimmte dort nicht (Gegenprobe 01.10.2026). */
-const CHAT_ONLY: ReadonlySet<ChatNoticeId> = new Set(['agent-outside-workspace', 'agent-for-local-files'])
interface Props {
/** Die Dokumentenablage oeffnen, fuer die Zeile ueber den fehlgegangenen
@@ -41,7 +37,9 @@ interface Props {
export function ChatNotices({ onAttachDocs, surface = 'chat' }: Props) {
const all = useChatNoticeStore((s) => s.notices)
const dismiss = useChatNoticeStore((s) => s.dismiss)
- const notices = surface === 'code' ? all.filter((n) => !CHAT_ONLY.has(n.id)) : all
+ // Die Zeilen ueber den Agent-Knopf und seinen Ordner gelten im CHAT. Im
+ // Code-Bereich gibt es diesen Knopf nicht (Gegenprobe 01.10.2026).
+ const notices = surface === 'code' ? all.filter((n) => !CONVERSATION_BOUND.has(n.id)) : all
if (notices.length === 0) return null
diff --git a/src/hooks/useAgentChat.ts b/src/hooks/useAgentChat.ts
index 581e6f86..18f4deb9 100644
--- a/src/hooks/useAgentChat.ts
+++ b/src/hooks/useAgentChat.ts
@@ -2978,7 +2978,9 @@ export function useAgentChat() {
// (Gegenprobe 01.10.2026). file_edit returns its refusal as text, and
// only applyResultToToolCall turned that into the failure read here.
const steps = runState.blocks.flatMap((b) => (b.phase === 'tool_call' && b.toolCall ? [b.toolCall] : []))
- if (hasUnrecoveredOutsideRefusal(steps)) {
+ // Only over the conversation it is about: a run that ends after the user
+ // moved on does not put its line over another chat.
+ if (hasUnrecoveredOutsideRefusal(steps) && useChatStore.getState().activeConversationId === convId) {
useChatNoticeStore.getState().show('agent-outside-workspace', OUTSIDE_WORKSPACE_NOTICE)
}
if (abort.signal.aborted || isRunStopped(convId)) noteStoppedIfEmpty(convId, assistantMessage.id)
diff --git a/src/stores/__tests__/a-chat-notice-stays-with-its-chat.test.ts b/src/stores/__tests__/a-chat-notice-stays-with-its-chat.test.ts
new file mode 100644
index 00000000..684c25a4
--- /dev/null
+++ b/src/stores/__tests__/a-chat-notice-stays-with-its-chat.test.ts
@@ -0,0 +1,45 @@
+/**
+ * 3.0.4 box run: "The agent can only open files in this chat's folder..."
+ * stayed on top of a NEW chat with Agent off. The two lines about a chat's
+ * last message now leave when the conversation changes.
+ *
+ * Run: npx vitest run src/stores/__tests__/a-chat-notice-stays-with-its-chat.test.ts
+ */
+import { describe, it, expect, beforeEach } from 'vitest'
+import { useChatStore } from '../chatStore'
+import { useChatNoticeStore } from '../chatNoticeStore'
+
+const ids = () => useChatNoticeStore.getState().notices.map((n) => n.id)
+
+beforeEach(() => {
+ useChatNoticeStore.getState().clear()
+ useChatStore.setState({ activeConversationId: null })
+})
+
+describe('conversation-bound notices', () => {
+ it('leave when the user opens another chat or starts a new one', () => {
+ useChatStore.setState({ activeConversationId: 'a' })
+ useChatNoticeStore.getState().show('agent-outside-workspace', 'x')
+ useChatNoticeStore.getState().show('agent-for-local-files', 'y')
+ useChatStore.setState({ activeConversationId: 'b' })
+ expect(ids()).toEqual([])
+
+ useChatStore.setState({ activeConversationId: 'a' })
+ useChatNoticeStore.getState().show('agent-outside-workspace', 'x')
+ useChatStore.setState({ activeConversationId: null })
+ expect(ids()).toEqual([])
+ })
+
+ it('stay when the first message creates the chat they are about', () => {
+ useChatNoticeStore.getState().show('agent-for-local-files', 'y')
+ useChatStore.setState({ activeConversationId: 'new' })
+ expect(ids()).toEqual(['agent-for-local-files'])
+ })
+
+ it('NEGATIVE CONTROL: a line about the model or an attachment is not bound to a chat', () => {
+ useChatStore.setState({ activeConversationId: 'a' })
+ useChatNoticeStore.getState().show('model-cannot-see-images', 'z')
+ useChatStore.setState({ activeConversationId: 'b' })
+ expect(ids()).toEqual(['model-cannot-see-images'])
+ })
+})
diff --git a/src/stores/chatNoticeStore.ts b/src/stores/chatNoticeStore.ts
index 719b0e78..f0bd5f29 100644
--- a/src/stores/chatNoticeStore.ts
+++ b/src/stores/chatNoticeStore.ts
@@ -30,6 +30,7 @@
import { create } from 'zustand'
import type { HinweisTon } from '../lib/hinweis'
+import { useChatStore } from './chatStore'
/** Die Zeilen, die es gibt. Kein freier Schluessel: eine Aufzaehlung laesst
* sich nachzaehlen, ein String-Schluessel waechst unbemerkt. */
@@ -91,3 +92,17 @@ export const useChatNoticeStore = create<ChatNoticeState>((set, get) => ({
set({ notices: [] })
},
}))
+
+/**
+ * Zeilen ueber die LETZTE Nachricht einer Unterhaltung. Sie gehoeren zu dieser
+ * Unterhaltung: in der 3.0.4-Box blieb "The agent can only open files in this
+ * chat's folder" in einem neuen Chat mit ausgeschaltetem Agent stehen.
+ */
+export const CONVERSATION_BOUND: ReadonlySet<ChatNoticeId> = new Set(['agent-outside-workspace', 'agent-for-local-files'])
+
+// Wechselt die Unterhaltung, gehen sie. Von "keine" zur gerade angelegten
+// nicht: das ist dieselbe Unterhaltung, die erste Nachricht legt sie erst an.
+useChatStore.subscribe((s, prev) => {
+ if (prev.activeConversationId === null || s.activeConversationId === prev.activeConversationId) return
+ for (const id of CONVERSATION_BOUND) useChatNoticeStore.getState().dismiss(id)
+})