Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

perf(app): keep dev-only preview routes out of production builds

M3gA-Mind0612c6c44bd5
diff --git a/app/src/AppRoutes.tsx b/app/src/AppRoutes.tsx
index 04974a64ed..87c1f28490 100644
--- a/app/src/AppRoutes.tsx
+++ b/app/src/AppRoutes.tsx
@@ -10,6 +10,7 @@ import { getIsMobile } from './lib/platform';
import Accounts from './pages/Accounts';
import Activity from './pages/Activity';
import Brain from './pages/Brain';
+import { IS_DEV } from './utils/config';
import AgentInsightsPreview from './pages/dev/AgentInsightsPreview';
import AssistantUiDemoPage from './pages/dev/assistant-ui-demo';
import UiGallery from './pages/dev/UiGallery';
@@ -244,14 +245,25 @@ const AppRoutes = ({ location }: AppRoutesProps = {}) => {
<Route path="/ptt-overlay" element={<PttOverlayPage />} />
- {/* Dev-only visual preview of the Agentic task insights surface. */}
- <Route path="/dev/agent-insights" element={<AgentInsightsPreview />} />
+ {/* Dev-only harnesses. Registered behind `IS_DEV` so their component
+ trees are dead code in a production build and drop out of the bundle
+ entirely — `import.meta.env.DEV` is substituted at build time, so
+ `false && <Route/>` folds away and the imports above become
+ unreferenced. These pages exist to preview UI in isolation and have
+ never been part of the shipped product; before this they were
+ registered unconditionally and every user downloaded them. */}
+ {IS_DEV && (
+ <>
+ {/* Visual preview of the Agentic task insights surface. */}
+ <Route path="/dev/agent-insights" element={<AgentInsightsPreview />} />
- {/* Dev-only gallery of every shared UI primitive, in the active theme. */}
- <Route path="/dev/ui" element={<UiGallery />} />
+ {/* Gallery of every shared UI primitive, in the active theme. */}
+ <Route path="/dev/ui" element={<UiGallery />} />
- {/* Dev-only: the upstream assistant-ui `base` demo on a mock runtime. */}
- <Route path="/dev/assistant-ui" element={<AssistantUiDemoPage />} />
+ {/* The upstream assistant-ui `base` demo on a mock runtime. */}
+ <Route path="/dev/assistant-ui" element={<AssistantUiDemoPage />} />
+ </>
+ )}
{/* Default redirect based on auth status */}
<Route path="*" element={<DefaultRedirect />} />
diff --git a/app/src/components/assistant-ui/thread-list.tsx b/app/src/components/assistant-ui/thread-list.tsx
index d5dcdd973c..517fd37cb7 100644
--- a/app/src/components/assistant-ui/thread-list.tsx
+++ b/app/src/components/assistant-ui/thread-list.tsx
@@ -1,5 +1,50 @@
'use client';
+/**
+ * Upstream assistant-ui thread list. **Not mounted on `/chat`, and it cannot be
+ * without a runtime change** — this note exists so that is not re-derived.
+ *
+ * It needs a runtime whose thread-list core is backed by a real adapter. The
+ * only place it renders is `/dev/assistant-ui`, which runs
+ * `useRemoteThreadListRuntime` with an `InMemoryThreadListAdapter`
+ * (`pages/dev/assistant-ui-demo/MockRuntimeProvider.tsx`). Live chat runs a
+ * different runtime family — `useExternalStoreRuntime`
+ * (`providers/AssistantUiRuntimeProvider.tsx`) — whose thread-list core is a
+ * stub when the adapter supplies no threads:
+ *
+ * ```js
+ * // @assistant-ui/core, external-store-thread-list-runtime-core.js
+ * _threads = DEFAULT_THREADS; // [DEFAULT_THREAD_ID]
+ * const newThreadId = adapter.threadId ?? DEFAULT_THREAD_ID;
+ * const newThreads = adapter.threads ?? EMPTY_ARRAY;
+ * if (previousThreads !== newThreads) this._threads = ...; // same frozen
+ * ``` // EMPTY_ARRAY, so
+ * // never reassigned
+ *
+ * `useOpenHumanExternalStore` supplies neither `threads` nor `threadId`, so
+ * `threadIds` stays `[DEFAULT_THREAD_ID]`. Mounted on `/chat` this renders
+ * exactly ONE untitled row showing its `fallback="New Chat"`, no matter how many
+ * threads exist — and `hasThreads` below is permanently true, because 1 > 0. It
+ * would not look broken. It would look like data that had not loaded yet, which
+ * is why this note is here rather than left to be discovered.
+ *
+ * Adoption costs one of:
+ * 1. Supply `threads` + `threadId` on the external-store adapter, plus
+ * switch / archive / new handlers. This includes making `mainThreadId` real
+ * — the identity key composer state, thread-list rows and subscription
+ * teardown all hang off — which was deliberately declined in #6475 as too
+ * broad for the bug at hand. The real thread id currently travels
+ * out-of-band through `AuiThreadIdContext` instead.
+ * 2. Migrate the chat surface to `useRemoteThreadListRuntime`, as the demo does.
+ *
+ * Neither buys a capability we lack: `features/conversations/threadList/
+ * ThreadList.tsx` is live on `/chat` and already does selection, inline rename,
+ * delete and search-filtered rows.
+ *
+ * Kept rather than deleted because the demo is the only worked reference for
+ * what adoption would actually require.
+ */
+
import { cn } from '@/components/assistant-ui/lib/utils';
import { Button } from '@/components/assistant-ui/ui/button';
import { Input } from '@/components/assistant-ui/ui/input';