Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (self): reader try/finally + aria-labels on Local LLM controls
Adam Eivyac57019ae059
diff --git a/client/src/components/settings/LocalLlmTab.jsx b/client/src/components/settings/LocalLlmTab.jsxindex 9b5a6a6dba..d786260f35 100644--- a/client/src/components/settings/LocalLlmTab.jsx+++ b/client/src/components/settings/LocalLlmTab.jsx@@ -160,7 +160,7 @@ export function LocalLlmTab() {<div className="bg-port-card border border-port-border rounded-xl p-4 sm:p-6 space-y-4"><div className="flex items-center justify-between"><h2 className="text-sm font-medium text-gray-300">Local LLM Backends</h2>- <button onClick={loadStatus} disabled={loading} className="p-1.5 text-gray-400 hover:text-white transition-colors" title="Refresh">+ <button onClick={loadStatus} disabled={loading} className="p-1.5 text-gray-400 hover:text-white transition-colors" title="Refresh" aria-label="Refresh local LLM status"><RefreshCw size={14} className={loading ? 'animate-spin' : ''} /></button></div>@@ -244,6 +244,7 @@ export function LocalLlmTab() {value={query}onChange={(e) => setQuery(e.target.value)}placeholder={`Search the ${labelFor(selected)} catalog…`}+ aria-label={`Search the ${labelFor(selected)} model catalog`}className="flex-1 bg-transparent py-2 text-sm text-white placeholder-gray-600 focus:outline-none"/></div>@@ -252,6 +253,7 @@ export function LocalLlmTab() {value={manualId}onChange={(e) => setManualId(e.target.value)}placeholder={selected === 'ollama' ? 'pull by name e.g. llama3.2' : 'publisher/Model-GGUF'}+ aria-label={`Install a ${labelFor(selected)} model by id`}className="flex-1 sm:w-56 bg-port-bg border border-port-border rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:outline-none focus:border-port-accent"/><buttondiff --git a/server/services/ollamaManager.js b/server/services/ollamaManager.jsindex 0d7cbbdabd..ea2bece332 100644--- a/server/services/ollamaManager.js+++ b/server/services/ollamaManager.js@@ -138,26 +138,32 @@ async function pullModel(modelId, onProgress) {let lastError = null// Ollama streams newline-delimited JSON progress frames. Read via getReader()- // to match the rest of the codebase's streaming-fetch convention.- while (true) {- const { value, done } = await reader.read()- if (done) break- buffer += decoder.decode(value, { stream: true })- let nl- while ((nl = buffer.indexOf('\n')) !== -1) {- const line = buffer.slice(0, nl).trim()- buffer = buffer.slice(nl + 1)- if (!line) continue- const frame = safeParse(line)- if (!frame) continue- if (frame.error) lastError = frame.error- if (typeof onProgress === 'function') {- const percent = frame.total > 0 && frame.completed >= 0- ? Math.round((frame.completed / frame.total) * 100)- : null- onProgress({ status: frame.status || '', percent, completed: frame.completed, total: frame.total })+ // to match the rest of the codebase's streaming-fetch convention. try/finally+ // releases the reader even if a read rejects mid-pull (avoids leaking the+ // underlying connection).+ try {+ while (true) {+ const { value, done } = await reader.read()+ if (done) break+ buffer += decoder.decode(value, { stream: true })+ let nl+ while ((nl = buffer.indexOf('\n')) !== -1) {+ const line = buffer.slice(0, nl).trim()+ buffer = buffer.slice(nl + 1)+ if (!line) continue+ const frame = safeParse(line)+ if (!frame) continue+ if (frame.error) lastError = frame.error+ if (typeof onProgress === 'function') {+ const percent = frame.total > 0 && frame.completed >= 0+ ? Math.round((frame.completed / frame.total) * 100)+ : null+ onProgress({ status: frame.status || '', percent, completed: frame.completed, total: frame.total })+ }}}+ } finally {+ reader.releaseLock()}if (lastError) {