Skip to content

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

address review (round 18): drop unused chip query params, surface network failures

Adam Eivyfb950ef19351
diff --git a/client/src/services/apiAsk.js b/client/src/services/apiAsk.js
index ff07cf5b63..64e918d7dc 100644
--- a/client/src/services/apiAsk.js
+++ b/client/src/services/apiAsk.js
@@ -18,12 +18,22 @@ export const promoteAskConversation = (id, promoted = true) => request(`/ask/${e
* Events: 'open' | 'sources' | 'delta' | 'error' | 'done'
*/
export async function streamAskTurn(payload, { onEvent, signal } = {}) {
+ // Mirror the apiCore / apiOpenClaw fetch pattern: catch transport-layer
+ // failures (network down, DNS, TLS) and rethrow as a consistent message
+ // rather than letting the browser's "TypeError: Failed to fetch" surface
+ // verbatim. Preserve AbortError so caller-side cancellation isn't masked.
const response = await fetch(`${API_BASE}/ask`, {
method: 'POST',
headers: { 'Content-Type': 'application/json', Accept: 'text/event-stream' },
body: JSON.stringify(payload),
signal,
+ }).catch((err) => {
+ if (err?.name === 'AbortError') throw err;
+ return null;
});
+ if (!response) {
+ throw new Error('Server unreachable — check your connection and try again');
+ }
if (!response.ok || !response.body) {
const text = await response.text().catch(() => '');
let message = `HTTP ${response.status}`;
diff --git a/server/services/askService.js b/server/services/askService.js
index bd57e5d63e..09446e014b 100644
--- a/server/services/askService.js
+++ b/server/services/askService.js
@@ -102,8 +102,12 @@ async function retrieveMemories(question) {
title: mem.summary || mem.type || 'Memory',
snippet: normalizeSnippet(mem.content),
relevance: hits[i].rrfScore ?? hits[i].similarity ?? 0.5,
- href: `/brain/memory?id=${encodeURIComponent(mem.id)}`,
- meta: { type: mem.type, importance: mem.importance, updatedAt: mem.updatedAt },
+ // Memory tab doesn't yet honour an `id` query param, so the chip
+ // navigates to the section landing page; the memory's id is still
+ // surfaced via `meta` so a future deep-link can use it without
+ // changing the source contract.
+ href: '/brain/memory',
+ meta: { id: mem.id, type: mem.type, importance: mem.importance, updatedAt: mem.updatedAt },
});
}
return sources;
@@ -233,7 +237,11 @@ async function retrieveCalendar(queryTokens, timeWindow) {
id: `calendar:${e.id || `${e.startTime}-${e.title}`}`,
title: e.title || '(event)',
snippet: normalizeSnippet([e.startTime || '', e.location || '', (e.description || '').slice(0, 200)].filter(Boolean).join(' · ')),
- href: `/calendar/agenda?date=${encodeURIComponent(e.startTime || '')}`,
+ // AgendaTab doesn't currently honour a `date` query param. Land the
+ // chip on the agenda and stash the timestamp + accountId in meta so
+ // a future deep-link wiring can pick them up without touching the
+ // source contract.
+ href: '/calendar/agenda',
relevance: lexicalScore(text, queryTokens),
meta: { startTime: e.startTime, endTime: e.endTime, accountId: e.accountId },
};