fix(webui): keep history loading until content is ready (#6659)

* fix(webui): keep history loading until content is ready

* fix(webui): preserve history content and retry state

Share final activity filtering with history readiness and retain completion and fork metadata across bookkeeping pages. Route boundary retries to the failed cursor and publish navigation pages synchronously so concurrent trace details are preserved. Cover real retry gestures, metadata traversal, batched details, and fork boundaries in both directions.

* fix(webui): reduce history admission work and release retry pages
This commit is contained in:
chengyongru authored and GitHub committed 2026-11-14 22:52:44 +08:00
1 parent 40e4e8a3fd
commit efec4a608d
14 files changed
+751 -103

No files matched your search

+11 -3
View File
@@ -13,6 +13,7 @@ const localMessages: UIMessage[] = Array.from({ length: 280 }, (_, index) => ({
export function HistoryBoundaryFixture({ local = false, navigate = false, tasks = false }: { local?: boolean; navigate?: boolean; tasks?: boolean }) {
const { client, token } = useClient();
const preview = new URLSearchParams(location.search).get("preview");
const [key, setKey] = useState("websocket:boundary-a");
const history = useSessionHistory(local ? null : key);
const messages = local ? localMessages : history.messages;
@@ -24,8 +25,13 @@ export function HistoryBoundaryFixture({ local = false, navigate = false, tasks
&& current.turnIds.every((turnId, index) => turnId === turnIds[index]) ? current : { key, turnIds });
}, [key]);
return <main className="bg-background text-foreground" style={{ height: "100vh", display: "flex", flexDirection: "column" }}>
<div className="flex h-10 shrink-0 items-center gap-4 px-4 text-sm">
<button onClick={() => setKey((current) => current.endsWith("-a") ? "websocket:boundary-b" : "websocket:boundary-a")}>Switch conversation</button>
<div className="flex min-h-10 shrink-0 flex-wrap items-center gap-4 px-4 py-2 text-sm">
{preview ? <>
<span className="text-muted-foreground">历史加载预览</span>
{([["slow", "慢加载"], ["pages", "连续分页"], ["fast", "快速完成"], ["error", "失败重试"]] as const).map(([mode, label]) =>
<a key={mode} href={`?case=history-boundary&preview=${mode}&lang=zh-CN`}
className={preview === mode ? "font-medium underline underline-offset-4" : "text-muted-foreground"}>{label}</a>)}
</> : <button onClick={() => setKey((current) => current.endsWith("-a") ? "websocket:boundary-b" : "websocket:boundary-a")}>Switch conversation</button>}
</div>
<Profiler id="history-boundary" onRender={(_, phase, actualDuration) => {
window.dispatchEvent(new CustomEvent("history-boundary-render", { detail: { phase, actualDuration } }));
@@ -40,7 +46,9 @@ export function HistoryBoundaryFixture({ local = false, navigate = false, tasks
initialLoading={history.loading} initialError={history.error} onRetryInitial={history.refresh}
loadingOlder={history.loadingOlder} olderError={history.olderError} onLoadOlder={history.loadOlder}
navigation={navigate ? navigation : undefined} userMessageOffset={history.userMessageOffset}
composer={<div className="border-t px-4 py-6" style={{ height: 96 }}>History boundary fixture</div>} />
composer={<div className="border-t px-4 py-6 text-sm text-muted-foreground" style={{ height: 96 }}>
{preview ? "滚到顶部后继续向上滚;触屏在顶部向下拉。仅使用示例消息,不连接真实会话。" : "History boundary fixture"}
</div>} />
</SubagentTasksProvider>
</Profiler>
</main>;