Skip to content

Graph-Native Infrastructure for Context and Accountable AI Systems

Fix/explorer backend failure states (#980)

Zohaib Hassnain75f88b1c4072
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d4ee0138..11f89028 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -52,6 +52,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
+- **Explorer UI hid backend failures: graph load hung forever, landing page always showed "System Online"** (#980, closes #977) by @ZohaibHassan16, reviewed by @Sameer6305
+ - `GraphWorkspace.tsx` only destructured `{ data, isLoading, isFetching }` from `useLoadGraph()`, ignoring the `isError`/`error`/`refetch` that `useQuery` (`retry: 0`) already returned. Combined with `GraphLoadingOverlay` having no error prop and `showLoadingOverlay` staying true whenever `loadingProgress` held a stale frame, a backend-down or failed fetch left the graph workspace stuck on the last progress frame indefinitely, with no error message and no way to recover short of a full page reload
+ - `GraphLoadingOverlay` now accepts `error`/`onRetry` and renders an error card with the real fetch error message and a Retry button (`refetch()`) instead of the stuck progress UI
+ - The landing page's `WelcomeScreen` replaced its hardcoded `ready: boolean` (and hardcoded "System Online" text) with a real `checking` / `online` / `offline` status derived from the same connectivity probe already driving the 4th metric card, so the status dot, text, and metric can no longer drift apart or lie about connectivity
+ - **Smaller fixes bundled in the same PR**: search results are now dismissible (previously stayed open indefinitely, pushing the graph down); relevance scores display as rounded whole numbers instead of `96.900`/`138.000`; added a debounced (250ms) typeahead combobox to graph search with arrow-key navigation, `aria-activedescendant`, and Escape-to-close, using the existing `/api/graph/search` endpoint
+ - **Fixed during review** (Qodo): the typeahead's debounced fetch had no `AbortController`, so a fast-typing user could have a stale suggestion response resolve after a newer one, replacing correct suggestions with outdated ones. In-flight requests are now aborted on every re-debounce and when the query is cleared after a selection
+ - **Noted during review** (@Sameer6305): `GraphWorkspaceShell.tsx` contains a third, unused implementation of the same graph-loading/error-handling logic this PR fixes — the issue itself named "two copies that drifted apart" as the root cause the original bug slipped through. Deliberately left out of this PR's scope and tracked separately in #981 rather than blocking this fix
+ - `npx tsc -b`: clean; `test:graph-store`/`test:graph-workspace`/`test:plugin-registry`: 42 passed; `npm run build`: succeeds
+
- **Markdown import hardened against TOCTOU symlink races during file reads** (#932, closes #856) by @lakshanmuruganandam, with fixes by @Sameer6305
- `AgentMemory._read_markdown_path` read files via `Path.read_text()` after a `Path.is_symlink()` pre-check, leaving a time-of-check/time-of-use window: a path validated as a regular file could be swapped for a symlink before the actual read, causing the importer to follow the link and read an unintended target
- Reads now go through a new `_read_markdown_file_content()` helper: the path is opened via low-level `os.open()` with `os.O_NOFOLLOW` on platforms that support it (POSIX), so a symlink substituted after validation fails atomically with `ELOOP` instead of being followed; the resulting file descriptor is then verified with `os.fstat()`/`stat.S_ISREG()` to reject non-regular files (FIFOs, devices) even after a successful open
diff --git a/explorer/src/App.tsx b/explorer/src/App.tsx
index f3f97520..8f94d477 100644
--- a/explorer/src/App.tsx
+++ b/explorer/src/App.tsx
@@ -67,6 +67,14 @@ type GraphStatsPayload = {
edges?: number;
};
+type ConnectionStatus = 'checking' | 'online' | 'offline';
+
+const CONNECTION_STATUS_LABEL: Record<ConnectionStatus, string> = {
+ checking: 'Connecting…',
+ online: 'System Online',
+ offline: 'Backend Unreachable',
+};
+
const queryClient = new QueryClient();
const PREVIEW_DOTS = Array.from({ length: 42 }, (_, i) => ({
@@ -719,19 +727,34 @@ const shellStyles = `
align-items: center;
gap: 10px;
margin-bottom: 24px;
+ --status-color: #4cc38a;
+ --status-shadow-a: 0 0 0 3px rgba(76, 195, 138, 0.22), 0 0 12px rgba(76, 195, 138, 0.5);
+ --status-shadow-b: 0 0 0 5px rgba(76, 195, 138, 0.1), 0 0 20px rgba(76, 195, 138, 0.35);
+ }
+
+ .landing-status-bar[data-status='checking'] {
+ --status-color: #f2b66d;
+ --status-shadow-a: 0 0 0 3px rgba(242, 182, 109, 0.22), 0 0 12px rgba(242, 182, 109, 0.5);
+ --status-shadow-b: 0 0 0 5px rgba(242, 182, 109, 0.1), 0 0 20px rgba(242, 182, 109, 0.35);
+ }
+
+ .landing-status-bar[data-status='offline'] {
+ --status-color: #ff7b72;
+ --status-shadow-a: 0 0 0 3px rgba(255, 123, 114, 0.22), 0 0 12px rgba(255, 123, 114, 0.5);
+ --status-shadow-b: 0 0 0 5px rgba(255, 123, 114, 0.1), 0 0 20px rgba(255, 123, 114, 0.35);
}
.landing-status-dot {
width: 8px;
height: 8px;
border-radius: 999px;
- background: #4cc38a;
- box-shadow: 0 0 0 3px rgba(76, 195, 138, 0.22), 0 0 12px rgba(76, 195, 138, 0.5);
+ background: var(--status-color);
+ box-shadow: var(--status-shadow-a);
animation: landing-pulse 2.4s ease-in-out infinite;
}
.landing-status-text {
- color: #4cc38a;
+ color: var(--status-color);
font: 700 11px/1 "JetBrains Mono", monospace;
letter-spacing: 0.1em;
text-transform: uppercase;
@@ -1323,8 +1346,8 @@ const shellStyles = `
}
@keyframes landing-pulse {
- 0%, 100% { box-shadow: 0 0 0 3px rgba(76, 195, 138, 0.22), 0 0 12px rgba(76, 195, 138, 0.5); }
- 50% { box-shadow: 0 0 0 5px rgba(76, 195, 138, 0.1), 0 0 20px rgba(76, 195, 138, 0.35); }
+ 0%, 100% { box-shadow: var(--status-shadow-a); }
+ 50% { box-shadow: var(--status-shadow-b); }
}
.workspace-loading {
@@ -1494,10 +1517,10 @@ function WelcomeScreen({
onOpenDecisions: () => void;
onOpenManage: () => void;
}) {
- const [stats, setStats] = useState<{ nodes: number | null; edges: number | null; ready: boolean }>({
+ const [stats, setStats] = useState<{ nodes: number | null; edges: number | null; status: ConnectionStatus }>({
nodes: null,
edges: null,
- ready: false,
+ status: 'checking',
});
useEffect(() => {
@@ -1507,31 +1530,32 @@ function WelcomeScreen({
.then((response) => (response.ok ? response.json() as Promise<GraphStatsPayload> : null))
.then((payload) => {
if (!payload) {
- setStats((current) => ({ ...current, ready: false }));
+ setStats((current) => ({ ...current, status: 'offline' }));
return;
}
setStats({
nodes: getNumberStat(payload, ['node_count', 'nodeCount', 'nodes']),
edges: getNumberStat(payload, ['edge_count', 'edgeCount', 'edges']),
- ready: true,
+ status: 'online',
});
})
.catch((error: unknown) => {
if (error instanceof DOMException && error.name === 'AbortError') {
return;
}
- setStats((current) => ({ ...current, ready: false }));
+ setStats((current) => ({ ...current, status: 'offline' }));
});
return () => controller.abort();
}, []);
+ const isOnline = stats.status === 'online';
const metrics: LandingMetric[] = [
{ label: 'Knowledge nodes', value: formatMetric(stats.nodes, 'Live'), tone: 'cyan' },
{ label: 'Relationships mapped', value: formatMetric(stats.edges, 'Ready'), tone: 'mint' },
{ label: 'Graph modes', value: '3', tone: 'amber' },
- { label: stats.ready ? 'Dataset online' : 'Ready to explore', value: stats.ready ? 'Active' : 'Standby', tone: 'rose' },
+ { label: isOnline ? 'Dataset online' : 'Ready to explore', value: isOnline ? 'Active' : 'Standby', tone: 'rose' },
];
const secondaryLaunchers: LandingAction[] = [
@@ -1574,9 +1598,9 @@ function WelcomeScreen({
{/* ── Hero ── */}
<section className="landing-hero">
<div className="landing-copy">
- <div className="landing-status-bar">
+ <div className="landing-status-bar" data-status={stats.status}>
<div className="landing-status-dot" />
- <span className="landing-status-text">System Online</span>
+ <span className="landing-status-text">{CONNECTION_STATUS_LABEL[stats.status]}</span>
<div className="landing-status-divider" />
<span className="landing-status-version">Semantica v2 · Semantic Intelligence</span>
</div>
diff --git a/explorer/src/workspaces/GraphWorkspace/GraphLoadingOverlay.tsx b/explorer/src/workspaces/GraphWorkspace/GraphLoadingOverlay.tsx
index 77a94130..a1ca4ea8 100644
--- a/explorer/src/workspaces/GraphWorkspace/GraphLoadingOverlay.tsx
+++ b/explorer/src/workspaces/GraphWorkspace/GraphLoadingOverlay.tsx
@@ -1,4 +1,5 @@
import { useEffect, useRef, useState, type CSSProperties } from "react";
+import { AlertTriangle, RefreshCw } from "lucide-react";
import { GRAPH_THEME, withAlpha } from "./graphTheme";
import { GRAPH_LOAD_STAGE_SEQUENCE, createGraphLoadProgress, getGraphLoadStageLabel } from "./graphLoading";
@@ -121,6 +122,58 @@ const LOADING_OVERLAY_CSS = `
0% { transform: translateX(-120%); }
100% { transform: translateX(360%); }
}
+ .graph-stage-loader-card[data-error="true"] {
+ pointer-events: auto;
+ border-color: rgba(255, 123, 114, 0.32);
+ background:
+ radial-gradient(circle at top left, rgba(255, 123, 114, 0.12), transparent 32%),
+ linear-gradient(145deg, rgba(7, 17, 31, 0.96), rgba(24, 14, 18, 0.86));
+ }
+ .graph-stage-loader-error-mark {
+ width: 38px;
+ height: 38px;
+ flex: 0 0 auto;
+ border-radius: 12px;
+ display: grid;
+ place-items: center;
+ color: #ff9e97;
+ background: rgba(255, 123, 114, 0.12);
+ border: 1px solid rgba(255, 123, 114, 0.28);
+ }
+ .graph-stage-loader-error-detail {
+ padding: 10px 12px;
+ border-radius: 10px;
+ background: rgba(0, 0, 0, 0.32);
+ border: 1px solid rgba(255, 123, 114, 0.18);
+ color: #ffb4ae;
+ font-family: "JetBrains Mono", "Fira Code", Consolas, monospace;
+ font-size: 12px;
+ line-height: 1.55;
+ word-break: break-word;
+ }
+ .graph-stage-loader-retry {
+ display: inline-flex;
+ align-items: center;
+ gap: 7px;
+ padding: 9px 16px;
+ border-radius: 8px;
+ font-size: 13px;
+ font-weight: 700;
+ cursor: pointer;
+ border: 1px solid rgba(127, 208, 255, 0.4);
+ background: linear-gradient(135deg, rgba(74, 163, 255, 0.28), rgba(56, 210, 160, 0.16));
+ color: #e8f6ff;
+ transition: 160ms ease;
+ }
+ .graph-stage-loader-retry:hover {
+ border-color: rgba(127, 208, 255, 0.62);
+ background: linear-gradient(135deg, rgba(74, 163, 255, 0.4), rgba(56, 210, 160, 0.24));
+ transform: translateY(-1px);
+ }
+ .graph-stage-loader-retry:focus-visible {
+ outline: 2px solid #7fd0ff;
+ outline-offset: 2px;
+ }
`;
function formatLayoutSource(source: GraphLoadProgress["layoutSource"]) {
@@ -170,10 +223,14 @@ export function GraphLoadingOverlay({
progress,
visible,
showGraphBehind,
+ error = null,
+ onRetry,
}: {
progress: GraphLoadProgress | null;
visible: boolean;
showGraphBehind: boolean;
+ error?: string | null;
+ onRetry?: () => void;
}) {
const [renderVisible, setRenderVisible] = useState(visible);
const [exiting, setExiting] = useState(false);
@@ -226,6 +283,44 @@ export function GraphLoadingOverlay({
return null;
}
+ if (error) {
+ return (
+ <div
+ className="graph-stage-loader"
+ data-exiting={exiting}
+ style={{ background: "linear-gradient(180deg, rgba(1,4,9,0.22), rgba(1,4,9,0.5))" }}
+ >
+ <style>{LOADING_OVERLAY_CSS}</style>
+ <div className="graph-stage-loader-card" data-error="true" role="alert">
+ <div style={{ display: "flex", alignItems: "flex-start", gap: 14, marginBottom: 14 }}>
+ <div className="graph-stage-loader-error-mark" aria-hidden="true">
+ <AlertTriangle size={18} strokeWidth={2.2} />
+ </div>
+ <div style={{ minWidth: 0 }}>
+ <div style={{ color: "#ffffff", fontSize: 20, fontWeight: 700, letterSpacing: "-0.03em", marginBottom: 6 }}>
+ Could not load the graph
+ </div>
+ <div style={{ color: "#8fa8c6", fontSize: 13, lineHeight: 1.5 }}>
+ The Explorer API did not return graph data. Check that the backend is running and reachable, then try again.
+ </div>
+ </div>
+ </div>
+
+ <div className="graph-stage-loader-error-detail">{error}</div>
+
+ {onRetry ? (
+ <div style={{ display: "flex", gap: 10, marginTop: 16 }}>
+ <button type="button" className="graph-stage-loader-retry" onClick={onRetry}>
+ <RefreshCw size={14} strokeWidth={2.2} aria-hidden />
+ Retry
+ </button>
+ </div>
+ ) : null}
+ </div>
+ </div>
+ );
+ }
+
const activeProgress = progress ?? displayProgress;
const isLiveStage = activeProgress.phase === "stabilizing_layout" || activeProgress.showGraphBehind || showGraphBehind;
const overlayBackground = isLiveStage
diff --git a/explorer/src/workspaces/GraphWorkspace/GraphWorkspace.tsx b/explorer/src/workspaces/GraphWorkspace/GraphWorkspace.tsx
index df2cd6ec..d38d21ad 100644
--- a/explorer/src/workspaces/GraphWorkspace/GraphWorkspace.tsx
+++ b/explorer/src/workspaces/GraphWorkspace/GraphWorkspace.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useEffect, useMemo, useRef, useState, type ComponentType, type ReactNode } from "react";
+import { useCallback, useEffect, useId, useMemo, useRef, useState, type ComponentType, type ReactNode } from "react";
import {
Activity,
Clock3,
@@ -12,6 +12,7 @@ import {
RefreshCw,
Search,
Users,
+ X,
ZoomIn,
ZoomOut,
} from "lucide-react";
@@ -282,37 +283,168 @@ function SegmentedModeControl({ items }: { items: GraphToolbarItem[] }) {
);
}
+const SUGGESTION_DEBOUNCE_MS = 250;
+const SUGGESTION_LIMIT = 6;
+
function SearchCommandBar({
value,
disabled,
onChange,
onSubmit,
+ onSelectSuggestion,
}: {
value: string;
disabled: boolean;
onChange: (value: string) => void;
onSubmit: () => void;
+ onSelectSuggestion: (result: SearchResult) => void;
}) {
+ const [suggestions, setSuggestions] = useState<SearchResult[]>([]);
+ const [suggestionsOpen, setSuggestionsOpen] = useState(false);
+ const [highlightedIndex, setHighlightedIndex] = useState(-1);
+ const abortRef = useRef<AbortController | null>(null);
+ const debounceRef = useRef<number | null>(null);
+ const listboxId = useId();
+
+ useEffect(() => {
+ if (debounceRef.current !== null) {
+ window.clearTimeout(debounceRef.current);
+ }
+
+ const query = value.trim();
+ if (disabled || !query) {
+ abortRef.current?.abort();
+ setSuggestions([]);
+ setSuggestionsOpen(false);
+ setHighlightedIndex(-1);
+ return;
+ }
+
+ debounceRef.current = window.setTimeout(() => {
+ abortRef.current?.abort();
+ const controller = new AbortController();
+ abortRef.current = controller;
+
+ fetch("/api/graph/search", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ query, limit: SUGGESTION_LIMIT }),
+ signal: controller.signal,
+ })
+ .then((response) => {
+ if (!response.ok) {
+ throw new Error(`Search failed with status ${response.status}`);
+ }
+ return response.json();
+ })
+ .then((data: { results?: SearchResult[] }) => {
+ setSuggestions(data.results ?? []);
+ setSuggestionsOpen(true);
+ setHighlightedIndex(-1);
+ })
+ .catch((suggestionError: unknown) => {
+ if (suggestionError instanceof DOMException && suggestionError.name === "AbortError") {
+ return;
+ }
+ setSuggestions([]);
+ setSuggestionsOpen(false);
+ setHighlightedIndex(-1);
+ });
+ }, SUGGESTION_DEBOUNCE_MS);
+
+ return () => {
+ if (debounceRef.current !== null) {
+ window.clearTimeout(debounceRef.current);
+ }
+ abortRef.current?.abort();
+ };
+ }, [value, disabled]);
+
+ const closeSuggestions = () => {
+ setSuggestionsOpen(false);
+ setHighlightedIndex(-1);
+ };
+
+ const selectSuggestion = (result: SearchResult) => {
+ setSuggestions([]);
+ closeSuggestions();
+ onSelectSuggestion(result);
+ };
+
return (
<form
className="explore-search-command"
+ role="combobox"
+ aria-expanded={suggestionsOpen && suggestions.length > 0}
+ aria-haspopup="listbox"
+ aria-owns={listboxId}
onSubmit={(event) => {
event.preventDefault();
- if (!disabled) {
- onSubmit();
+ if (disabled) return;
+ if (suggestionsOpen && highlightedIndex >= 0 && suggestions[highlightedIndex]) {
+ selectSuggestion(suggestions[highlightedIndex]);
+ return;
}
+ closeSuggestions();
+ onSubmit();
}}
>
<Search size={17} strokeWidth={2.15} aria-hidden />
<input
value={value}
onChange={(event) => onChange(event.target.value)}
+ onFocus={() => {
+ if (suggestions.length > 0) {
+ setSuggestionsOpen(true);
+ }
+ }}
+ onBlur={() => {
+ window.setTimeout(closeSuggestions, 120);
+ }}
+ onKeyDown={(event) => {
+ if (!suggestionsOpen || suggestions.length === 0) return;
+ if (event.key === "ArrowDown") {
+ event.preventDefault();
+ setHighlightedIndex((current) => (current + 1) % suggestions.length);
+ } else if (event.key === "ArrowUp") {
+ event.preventDefault();
+ setHighlightedIndex((current) => (current <= 0 ? suggestions.length - 1 : current - 1));
+ } else if (event.key === "Escape") {
+ event.preventDefault();
+ closeSuggestions();
+ }
+ }}
placeholder="Search command, node, or concept"
aria-label="Search graph nodes"
+ aria-autocomplete="list"
+ aria-controls={listboxId}
+ aria-activedescendant={highlightedIndex >= 0 ? `${listboxId}-${highlightedIndex}` : undefined}
/>
<button type="submit" disabled={disabled} aria-label="Search for the current query">
Search
</button>
+
+ {suggestionsOpen && suggestions.length > 0 ? (
+ <ul id={listboxId} role="listbox" className="explore-search-suggestions" aria-label="Search suggestions">
+ {suggestions.map((result, index) => (
+ <li
+ key={result.node.id}
+ id={`${listboxId}-${index}`}
+ role="option"
+ aria-selected={index === highlightedIndex}
+ data-highlighted={index === highlightedIndex}
+ onMouseDown={(event) => {
+ event.preventDefault();
+ selectSuggestion(result);
+ }}
+ onMouseEnter={() => setHighlightedIndex(index)}
+ >
+ <span className="explore-search-suggestion-label">{result.node.content || result.node.id}</span>
+ <span className="explore-search-suggestion-type">{result.node.type}</span>
+ </li>
+ ))}
+ </ul>
+ ) : null}
</form>
);
}
@@ -577,6 +709,7 @@ const HUD_CSS = `
gap: 10px;
}
.explore-search-command {
+ position: relative;
min-width: 0;
height: 43px;
display: grid;
@@ -592,6 +725,50 @@ const HUD_CSS = `
color: ${GRAPH_THEME.ui.text.muted};
box-shadow: inset 0 1px 0 rgba(255,255,255,0.045), 0 14px 30px rgba(0,0,0,0.16);
}
+ .explore-search-suggestions {
+ position: absolute;
+ top: calc(100% + 6px);
+ left: 0;
+ right: 0;
+ z-index: 30;
+ margin: 0;
+ padding: 6px;
+ list-style: none;
+ max-height: 288px;
+ overflow-y: auto;
+ border-radius: 14px;
+ border: 1px solid ${GRAPH_THEME.ui.control.inputBorder};
+ background: ${GRAPH_THEME.ui.surface.cardStrong};
+ box-shadow: 0 18px 40px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.04);
+ }
+ .explore-search-suggestions li {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 10px;
+ padding: 8px 10px;
+ border-radius: 10px;
+ cursor: pointer;
+ color: ${GRAPH_THEME.ui.text.body};
+ }
+ .explore-search-suggestions li[data-highlighted="true"] {
+ background: ${GRAPH_THEME.ui.control.hoverBg};
+ }
+ .explore-search-suggestion-label {
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ font-size: 13px;
+ font-weight: 600;
+ }
+ .explore-search-suggestion-type {
+ flex-shrink: 0;
+ font-size: 11px;
+ color: ${GRAPH_THEME.ui.text.subtle};
+ text-transform: uppercase;
+ letter-spacing: 0.04em;
+ }
.explore-search-command:focus-within {
border-color: ${GRAPH_THEME.ui.control.activeBorder};
box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 0 0 1px ${GRAPH_THEME.ui.control.focusRing}, 0 16px 32px rgba(0,0,0,0.18);
@@ -1225,12 +1402,28 @@ export function GraphWorkspace({ externalFocusNodeId, externalFocusToken }: Grap
}));
}, []);
- const { data: summary, isLoading, isFetching } = useLoadGraph({
+ const {
+ data: summary,
+ isLoading,
+ isFetching,
+ isError: isGraphLoadError,
+ error: graphLoadError,
+ refetch: refetchGraph,
+ } = useLoadGraph({
enabled: true,
onGraphReady: applyGraphReadySummary,
onProgress: handleLoadProgress,
});
+ const graphLoadErrorMessage = isGraphLoadError
+ ? (graphLoadError instanceof Error ? graphLoadError.message : "Unknown error while loading the graph.")
+ : null;
+
+ const handleRetryGraphLoad = useCallback(() => {
+ setLoadingProgress(null);
+ void refetchGraph();
+ }, [refetchGraph]);
+
useEffect(() => {
if (isLayoutRunning) {
return;
@@ -1523,6 +1716,11 @@ export function GraphWorkspace({ externalFocusNodeId, externalFocusToken }: Grap
}
}, [searchQuery]);
+ const handleClearSearchResults = useCallback(() => {
+ setSearchResults([]);
+ setSearchError("");
+ }, []);
+
const handleRunPredictions = useCallback(async () => {
if (!inspectableNodeId) return;
setIsRunningPredictions(true);
@@ -1901,7 +2099,7 @@ export function GraphWorkspace({ externalFocusNodeId, externalFocusToken }: Grap
viewMode,
]);
- const showLoadingOverlay = !graphReady && (isLoading || isFetching || Boolean(loadingProgress));
+ const showLoadingOverlay = !graphReady && (isLoading || isFetching || Boolean(loadingProgress) || isGraphLoadError);
const showSettlingStatus = graphReady && loadingProgress?.phase === "stabilizing_layout";
const hasGraphContent = Boolean(summary?.nodeCount);
const activePath = pathResult?.path ?? EMPTY_PATH;
@@ -2764,6 +2962,10 @@ export function GraphWorkspace({ externalFocusNodeId, externalFocusToken }: Grap
disabled={searchDisabled}
onChange={setSearchQuery}
onSubmit={() => void handleSearch()}
+ onSelectSuggestion={(result) => {
+ setSearchQuery("");
+ focusNode(result.node.id);
+ }}
/>
<SegmentedModeControl items={viewModeItems} />
<div className="explore-toolbelt">
@@ -2839,20 +3041,36 @@ export function GraphWorkspace({ externalFocusNodeId, externalFocusToken }: Grap
{searchError ? <div style={{ color: "#ff7b72", fontSize: 12 }}>{searchError}</div> : null}
{searchResults.length ? (
- <div className="explore-search-results hud-scrollbar" style={searchResultsStripStyle}>
- {searchResults.map((result) => (
- <button key={result.node.id} style={predictionCardStyle} onClick={() => focusNode(result.node.id)}>
- <div style={{ display: "flex", justifyContent: "space-between", gap: 12 }}>
- <div style={{ minWidth: 0 }}>
- <div style={{ color: "#fff", fontWeight: 600 }}>{result.node.content || result.node.id}</div>
- <div style={{ color: "#8b949e", fontSize: 12 }}>{result.node.type}</div>
- </div>
- <div style={{ color: "#58a6ff", fontSize: 12, whiteSpace: "nowrap" }}>
- {result.score.toFixed(3)}
- </div>
- </div>
+ <div style={{ display: "flex", flexDirection: "column", gap: 8 }}>
+ <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", gap: 12 }}>
+ <span style={{ color: "#8b949e", fontSize: 12 }}>
+ {searchResults.length} result{searchResults.length === 1 ? "" : "s"}
+ </span>
+ <button
+ type="button"
+ onClick={handleClearSearchResults}
+ style={{ ...secondaryActionButtonStyle, minHeight: 26, padding: "4px 9px", gap: 5 }}
+ aria-label="Dismiss search results"
+ >
+ <X size={12} strokeWidth={2.4} />
+ Dismiss
</button>
- ))}
+ </div>
+ <div className="explore-search-results hud-scrollbar" style={searchResultsStripStyle}>
+ {searchResults.map((result) => (
+ <button key={result.node.id} style={predictionCardStyle} onClick={() => focusNode(result.node.id)}>
+ <div style={{ display: "flex", justifyContent: "space-between", gap: 12 }}>
+ <div style={{ minWidth: 0 }}>
+ <div style={{ color: "#fff", fontWeight: 600 }}>{result.node.content || result.node.id}</div>
+ <div style={{ color: "#8b949e", fontSize: 12 }}>{result.node.type}</div>
+ </div>
+ <div style={{ color: "#58a6ff", fontSize: 12, whiteSpace: "nowrap" }}>
+ {Math.round(result.score)}
+ </div>
+ </div>
+ </button>
+ ))}
+ </div>
</div>
) : null}
@@ -2946,6 +3164,8 @@ export function GraphWorkspace({ externalFocusNodeId, externalFocusToken }: Grap
progress={loadingProgress}
visible={showLoadingOverlay}
showGraphBehind={hasGraphContent || Boolean(loadingProgress?.showGraphBehind)}
+ error={graphLoadErrorMessage}
+ onRetry={handleRetryGraphLoad}
/>
</div>
</div>