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(v2.5.3): Memory-panel portal + openai/LM-Studio transient retry + chat-tools cleanup

purple5fe9096505f8
diff --git a/src/components/chat/MemoryDebugPanel.tsx b/src/components/chat/MemoryDebugPanel.tsx
index a21c4ce8..98acf7fd 100644
--- a/src/components/chat/MemoryDebugPanel.tsx
+++ b/src/components/chat/MemoryDebugPanel.tsx
@@ -1,4 +1,5 @@
import { useState, useEffect } from 'react'
+import { createPortal } from 'react-dom'
import { Brain, X, Plus, Trash2, ChevronDown, Archive } from 'lucide-react'
import { useMemoryStore } from '../../stores/memoryStore'
import { useModelStore } from '../../stores/modelStore'
@@ -85,7 +86,14 @@ function MemoryPopover({ onClose }: { onClose: () => void }) {
setAdding(false)
}
- return (
+ // Portal to document.body: this is a `fixed inset-0` overlay, but the brain
+ // button lives in the Header's center column which carries Tailwind's
+ // `-translate-x-1/2`. A CSS transform on ANY ancestor makes that ancestor the
+ // containing block for `position: fixed`, so without the portal the overlay
+ // was clamped to the header-center's ~132px width on every viewport ≥1024px
+ // (David flagged the squeezed Memory panel). Portaling out of the transformed
+ // subtree restores true viewport-anchored full-screen positioning.
+ return createPortal(
<motion.div
initial={{ opacity: 0, y: -5 }}
animate={{ opacity: 1, y: 0 }}
@@ -181,6 +189,7 @@ function MemoryPopover({ onClose }: { onClose: () => void }) {
</div>
)}
</div>
- </motion.div>
+ </motion.div>,
+ document.body,
)
}
diff --git a/src/hooks/useAgentChat.ts b/src/hooks/useAgentChat.ts
index 72a59334..a8b2ca8f 100644
--- a/src/hooks/useAgentChat.ts
+++ b/src/hooks/useAgentChat.ts
@@ -696,13 +696,33 @@ export function useAgentChat() {
}
dropThinkingBlock()
} else {
- try {
- turn = await provider.chatWithTools(modelToUse, agentMessages, tools, chatOptions)
- } catch (thinkErr: any) {
- if (thinkErr?.message?.includes('does not support thinking') || thinkErr?.statusCode === 400) {
- const retryOptions = { ...chatOptions, thinking: undefined as unknown as boolean }
- turn = await provider.chatWithTools(modelToUse, agentMessages, tools, retryOptions)
- } else {
+ // Connection-failure retry for openai-compat providers — parity with
+ // the Ollama branch above. A LOCAL LM Studio model gets unloaded +
+ // JIT-reloaded around an image/video VRAM hand-off (detectLmsTextModel
+ // juggling, v2.5.3); a request that races that reload window dies as
+ // "LM Studio: Request failed". Without a retry that surfaced as a bare
+ // "Agent error" on the very next tool turn (ship-gate find 2026-06-11,
+ // chat-tools image on LM Studio). Retry transient failures a couple of
+ // times; a 4xx is deterministic and still surfaces immediately.
+ let connRetries = 0
+ for (;;) {
+ try {
+ turn = await provider.chatWithTools(modelToUse, agentMessages, tools, chatOptions)
+ break
+ } catch (thinkErr: any) {
+ if (thinkErr?.message?.includes('does not support thinking') || thinkErr?.statusCode === 400) {
+ const retryOptions = { ...chatOptions, thinking: undefined as unknown as boolean }
+ turn = await provider.chatWithTools(modelToUse, agentMessages, tools, retryOptions)
+ break
+ }
+ const sc = typeof thinkErr?.statusCode === 'number' ? thinkErr.statusCode : 0
+ const transient = thinkErr?.name !== 'AbortError' && !(sc >= 400 && sc < 500)
+ if (transient && connRetries < 2) {
+ connRetries++
+ log.warn('agent.model_call_retry', { attempt: connRetries, provider: providerId, err: String(thinkErr?.message || thinkErr) })
+ await new Promise((r) => setTimeout(r, 1500 * connRetries))
+ continue
+ }
throw thinkErr
}
}
diff --git a/src/hooks/useChat.ts b/src/hooks/useChat.ts
index 465a674c..3593750b 100644
--- a/src/hooks/useChat.ts
+++ b/src/hooks/useChat.ts
@@ -51,13 +51,11 @@ export function useChat() {
// clearly needs one of those capabilities, run THIS turn through the agent
// executor with a curated 5-tool allow-list + a chat-style prompt. Pure
// conversation falls through to the fast plain path below, untouched — so
- // normal chatting (and the rikki/thought-only fixes) never regress.
- const agentActiveHere = !!store.activeConversationId
- && useAgentModeStore.getState().isActive(store.activeConversationId)
+ // normal chatting (and the rikki/thought-only fixes) never regress. (Agent
+ // mode already returned above, so reaching here means Agent is off.)
if (
activeModel
&& settings.chatToolsEnabled !== false
- && !agentActiveHere
&& detectChatToolIntent(content, !!images?.length)
) {
return agentChat.sendAgentMessage(content, images, {