Skip to content

Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.

fix(studio): chat session and rendering robustness

FABIOTESSfc220ea51d12
diff --git a/studio/src/components/ChatPanel.tsx b/studio/src/components/ChatPanel.tsx
index 11f81a31..25d3be7b 100644
--- a/studio/src/components/ChatPanel.tsx
+++ b/studio/src/components/ChatPanel.tsx
@@ -166,7 +166,7 @@ function MessageBubble({ message }: { message: ChatMessage }) {
return (
<div className={`flex ${isUser ? 'justify-end' : 'justify-start'}`}>
- <div className="max-w-[85%] px-3 py-2 rounded-lg text-sm"
+ <div className="max-w-[85%] min-w-0 px-3 py-2 rounded-lg text-sm break-words overflow-hidden"
style={{
background: isUser ? 'var(--accent)' : 'var(--bg-panel)',
color: isUser ? 'var(--bg-primary)' : 'var(--text-primary)',
@@ -174,7 +174,7 @@ function MessageBubble({ message }: { message: ChatMessage }) {
}}>
{isUser || isSystem
? <div className="whitespace-pre-wrap">{message.content}</div>
- : <div className="prose prose-sm max-w-none markdown-body">
+ : <div className="prose prose-sm max-w-none markdown-body break-words [&_code]:break-all [&_pre]:overflow-x-auto">
<ReactMarkdown remarkPlugins={[remarkGfm]}>{message.content}</ReactMarkdown>
</div>
}
diff --git a/studio/src/hooks/useChat.ts b/studio/src/hooks/useChat.ts
index 371300c2..d3c5ecd5 100644
--- a/studio/src/hooks/useChat.ts
+++ b/studio/src/hooks/useChat.ts
@@ -3,15 +3,6 @@ import { invoke } from '@tauri-apps/api/core';
import { listen } from '@tauri-apps/api/event';
import * as mcp from '../lib/mcp-client';
-// Sync agent MCP session ID to Rust backend so graph queries use the same store
-async function syncSessionId(sessionId: string) {
- try {
- await invoke('set_mcp_session', { sessionId });
- } catch (e) {
- console.error('Failed to sync session ID:', e);
- }
-}
-
export interface ChatMessage {
id: string;
role: 'user' | 'assistant' | 'system';
@@ -60,6 +51,9 @@ export const useChat = create<ChatStore>((set) => ({
timestamp: new Date(),
};
set(s => ({ messages: [...s.messages, userMsg], isTyping: true }));
+ // A question sent while the previous answer is still streaming must not
+ // append into the old bubble above it: start a fresh assistant message.
+ currentAssistantMsg = null;
try {
const { mode } = useChat.getState();
await invoke('send_chat_message', { message: text, mode });
@@ -94,8 +88,12 @@ listen<string>('agent-message', (event) => {
try {
const data = JSON.parse(event.payload);
+ // The agent's session id is a Claude SDK session, not an MCP session,
+ // and the graph store is shared across MCP sessions anyway. Adopting it
+ // as the proxy's MCP session poisoned every panel call after the first
+ // chat turn ("Session not found").
if (data.type === 'session') {
- syncSessionId(data.sessionId);
+ // intentionally ignored
}
if (data.type === 'text') {