Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix(webui): synchronize neutral Ring sidebar activity indicators (#6371)
chengyongru29d1600837d0
diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.mdindex e92b666f5..deac0d172 100644--- a/THIRD_PARTY_NOTICES.md+++ b/THIRD_PARTY_NOTICES.md@@ -176,10 +176,10 @@ OTHER DEALINGS IN THE FONT SOFTWARE.----## loading.dev Blocks — history-loading animation (MIT)+## loading.dev Blocks and Ring — loading animations (MIT)- **Source**: https://github.com/jakubkrehel/loading/tree/48ff9a1cd5f0446901ff1a8a3d5d5f906d3e36ff-- **Adapted**: the diagonal Blocks sweep in `webui/src/components/thread/ThreadHistoryStatus.tsx` and `webui/src/globals.css`.+- **Adapted**: the diagonal Blocks sweep in `webui/src/components/thread/ThreadHistoryStatus.tsx` and `webui/src/globals.css`, and the circular Ring in `webui/src/components/ChatList.tsx` and `webui/src/globals.css`.- **Bundled**: `nanobot/web/dist/assets/index-*.{js,css}````diff --git a/webui/browser/fixture.tsx b/webui/browser/fixture.tsxindex 37848094c..f1e8cdbec 100644--- a/webui/browser/fixture.tsx+++ b/webui/browser/fixture.tsx@@ -27,6 +27,7 @@ import { HistoryBoundaryFixture } from "./history-boundary-fixture";import { ChatFailureFixture } from "./chat-failure-fixture";import { ThreadLoadingFixture } from "./thread-loading-fixture";import { AnswerOrderFixture } from "./answer-order-fixture";+import { SidebarActivityFixture } from "./sidebar-activity-fixture";const history: UIMessage[] = [{ id: "question", role: "user", content: "Earlier question", createdAt: 1_700_000_000_000 },@@ -169,6 +170,8 @@ await initializeI18n();createRoot(document.getElementById("root")!).render(<TooltipProvider>{parameters.get("case") === "answer-order"? <AnswerOrderFixture />+ : parameters.get("case") === "sidebar-activity"+ ? <SidebarActivityFixture />: parameters.get("case") === "chat-failure"? <ChatFailureFixture parameters={parameters} />: parameters.get("case") === "typography"diff --git a/webui/browser/sidebar-activity-fixture.tsx b/webui/browser/sidebar-activity-fixture.tsxnew file mode 100644index 000000000..d9355b713--- /dev/null+++ b/webui/browser/sidebar-activity-fixture.tsx@@ -0,0 +1,36 @@+import { useState } from "react";+import { ChatList } from "@/components/ChatList";+import type { ChatSummary } from "@/lib/types";++const sessions: ChatSummary[] = ["Review history", "Locate messages", "Refine message bubbles", "Check MCP connection"].map((title, index) => ({+ key: `websocket:activity-${index}`,+ chatId: `activity-${index}`,+ channel: "websocket",+ title,+ preview: "",+ createdAt: "2026-10-21T10:00:00Z",+ updatedAt: "2026-10-21T10:00:00Z",+ handle: { id: `handle_activity_${index}`, name: ["bate", "jaru", "goyo", "tami"][index] },+}));++export function SidebarActivityFixture() {+ const [count, setCount] = useState(new URLSearchParams(location.search).has("all") ? sessions.length : 1);+ const [visible, setVisible] = useState(true);+ const [activeKey, setActiveKey] = useState(sessions[0].key);+ return <main className="flex min-h-screen flex-wrap items-start gap-6 bg-background p-4 text-foreground">+ <section aria-label="Activity sidebar" className="h-[480px] w-80 max-w-full bg-sidebar">+ {visible && <ChatList+ sessions={sessions} activeKey={activeKey} onSelect={setActiveKey}+ runningChatIds={sessions.slice(0, count).map((session) => session.chatId)}+ sort="title_asc" onRequestDelete={() => {}} onTogglePin={() => {}}+ onRequestRename={async () => {}} onToggleArchive={() => {}}+ />}+ </section>+ <div className="flex flex-col gap-3">+ <button onClick={() => setCount((value) => Math.min(sessions.length, value + 1))}>Start next conversation</button>+ <button onClick={() => setCount(1)}>Reset conversations</button>+ <button onClick={() => setVisible((value) => !value)}>Toggle sidebar</button>+ <button onClick={() => document.documentElement.classList.toggle("dark")}>Toggle theme</button>+ </div>+ </main>;+}diff --git a/webui/browser/sidebar-activity.spec.ts b/webui/browser/sidebar-activity.spec.tsnew file mode 100644index 000000000..19628e9ab--- /dev/null+++ b/webui/browser/sidebar-activity.spec.ts@@ -0,0 +1,94 @@+import { expect, test, type Page } from "@playwright/test";++async function samplePhases(page: Page) {+ return page.getByRole("img", { name: "Agent running", exact: true }).evaluateAll((nodes) => nodes.map((node) => {+ const animation = node.getAnimations({ subtree: true })[0];+ const duration = animation.effect!.getTiming().duration as number;+ return (Number(animation.currentTime) % duration) / duration;+ }));+}++test("sidebar activity stays in phase across staggered starts, selection and remounts", async ({ page }) => {+ await page.goto("/browser/fixture.html?case=sidebar-activity");+ await expect(page.getByRole("img", { name: "Agent running", exact: true })).toHaveCount(1);+ for (let count = 2; count <= 4; count++) {+ // Stagger arrivals on the actual animation clock, rather than mounting every row together.+ const previous = (await samplePhases(page))[0];+ await expect.poll(async () => Math.abs((await samplePhases(page))[0] - previous)).toBeGreaterThan(0.15);+ await page.getByRole("button", { name: "Start next conversation" }).click();+ await expect(page.getByRole("img", { name: "Agent running", exact: true })).toHaveCount(count);+ }+ const samples = await page.evaluate(() => new Promise<number[][]>((resolve) => {+ const result: number[][] = [];+ const start = performance.now();+ const sample = () => {+ result.push(Array.from(document.querySelectorAll('[role="img"][aria-label="Agent running"]')).map((node) => {+ const animation = node.getAnimations({ subtree: true })[0];+ return (Number(animation.currentTime) % Number(animation.effect!.getTiming().duration)) / Number(animation.effect!.getTiming().duration);+ }));+ if (performance.now() - start < 1500) requestAnimationFrame(sample);+ else resolve(result);+ };+ requestAnimationFrame(sample);+ }));+ expect(samples.length).toBeGreaterThan(10);+ expect(new Set(samples.map((sample) => sample[0].toFixed(2))).size).toBeGreaterThan(10);+ for (const phases of samples) expect(Math.max(...phases) - Math.min(...phases)).toBeLessThan(0.001);++ await page.getByRole("button", { name: "@jaru Locate messages", exact: true }).click();+ await page.getByRole("button", { name: "Toggle sidebar" }).click();+ await expect(page.getByRole("img", { name: "Agent running", exact: true })).toHaveCount(0);+ await page.getByRole("button", { name: "Toggle sidebar" }).click();+ await expect(page.getByRole("img", { name: "Agent running", exact: true })).toHaveCount(4);+ const phases = await samplePhases(page);+ expect(Math.max(...phases) - Math.min(...phases)).toBeLessThan(0.001);+});++for (const width of [1280, 390]) {+ test(`sidebar Ring follows the neutral theme at ${width}px and respects live motion preferences`, async ({ page }) => {+ await page.setViewportSize({ width, height: 800 });+ await page.goto("/browser/fixture.html?case=sidebar-activity&all");+ const indicators = page.getByRole("img", { name: "Agent running", exact: true });+ await expect(indicators).toHaveCount(4);+ const colors: string[] = [];+ for (const dark of [false, true]) {+ await page.evaluate((enabled) => document.documentElement.classList.toggle("dark", enabled), dark);+ const actual = await indicators.evaluateAll((nodes) => nodes.map((node) => {+ const svg = node.querySelector("svg")!;+ const reference = document.createElement("span");+ reference.style.color = "hsl(var(--sidebar-muted-foreground))";+ node.append(reference);+ const expectedColor = getComputedStyle(reference).color;+ reference.remove();+ const rect = svg.getBoundingClientRect();+ return { color: getComputedStyle(svg).color, expectedColor, size: [rect.width, rect.height] };+ }));+ for (const item of actual) {+ expect(item.color).toBe(item.expectedColor);+ expect(item.size).toEqual([12, 12]);+ }+ colors.push(actual[0].color);+ await page.getByRole("button", { name: "@jaru Locate messages", exact: true }).hover();+ await page.getByRole("button", { name: "@goyo Refine message bubbles", exact: true }).click();+ expect(await indicators.evaluateAll((nodes) => nodes.map((node) => getComputedStyle(node.querySelector("svg")!).color)))+ .toEqual(Array(4).fill(actual[0].color));+ }+ expect(colors[0]).not.toBe(colors[1]);+ expect(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth)).toBe(true);++ for (const reducedMotion of ["reduce", "no-preference"] as const) {+ await page.emulateMedia({ reducedMotion });+ await expect.poll(() => indicators.evaluateAll((nodes) => nodes.map((node) => node.getAnimations({ subtree: true }).length)))+ .toEqual(Array(4).fill(reducedMotion === "reduce" ? 0 : 1));+ if (reducedMotion === "no-preference") {+ const phases = await samplePhases(page);+ expect(Math.max(...phases) - Math.min(...phases)).toBeLessThan(0.001);+ }+ }+ await page.emulateMedia({ reducedMotion: "reduce" });+ await page.getByRole("button", { name: "Reset conversations" }).click();+ await page.getByRole("button", { name: "Start next conversation" }).click();+ await expect(indicators).toHaveCount(2);+ expect(await indicators.evaluateAll((nodes) => nodes.map((node) => node.getAnimations({ subtree: true }).length))).toEqual([0, 0]);+ });+}diff --git a/webui/src/components/ChatList.tsx b/webui/src/components/ChatList.tsxindex bcf9541f8..62b7aa28e 100644--- a/webui/src/components/ChatList.tsx+++ b/webui/src/components/ChatList.tsx@@ -1884,6 +1884,12 @@ function ChatsFoldFooter({);}+function synchronizeRunningRing(element: SVGCircleElement | null) {+ if (!element) return;+ // Align pending animations before their first frame, not only after animationstart.+ for (const animation of element.getAnimations()) animation.startTime = 0;+}+function SessionActivityIndicator({state,}: {@@ -1917,7 +1923,18 @@ function SessionActivityIndicator({aria-label={label}className="grid h-4 w-4 shrink-0 place-items-center">- <span className="h-3 w-3 animate-spin rounded-full border border-blue-500/25 border-t-blue-500 [animation-duration:1.4s] motion-reduce:animate-none dark:border-blue-400/25 dark:border-t-blue-400" />+ <svg+ className="h-3 w-3 text-sidebar-muted-foreground"+ viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" aria-hidden="true"+ >+ <circle cx="12" cy="12" r="10" opacity="0.2" />+ <circle+ cx="12" cy="12" r="10" strokeDasharray="16 46.8" strokeLinecap="round"+ className="sidebar-running-ring"+ ref={synchronizeRunningRing}+ onAnimationStart={(event) => synchronizeRunningRing(event.currentTarget)}+ />+ </svg></span></HoverHint>);diff --git a/webui/src/globals.css b/webui/src/globals.cssindex db905ebfd..1adeba295 100644--- a/webui/src/globals.css+++ b/webui/src/globals.css@@ -1092,6 +1092,20 @@}}+/* loading.dev Ring, Copyright (c) 2026 Jakub Krehel (MIT); THIRD_PARTY_NOTICES.md. */+.sidebar-running-ring {+ transform-origin: center;+ animation: sidebar-running-ring 800ms linear infinite;+}+@keyframes sidebar-running-ring {+ to { transform: rotate(360deg); }+}+@media (prefers-reduced-motion: reduce) {+ .sidebar-running-ring {+ animation: none;+ }+}+@media (pointer: coarse) {/* Readable form text avoids Safari's focus zoom without disabling the user'spinch zoom. Keep this after utilities so compact desktop overrides cannotdiff --git a/webui/src/tests/setup.ts b/webui/src/tests/setup.tsindex 96ef96868..0344d303c 100644--- a/webui/src/tests/setup.ts+++ b/webui/src/tests/setup.ts@@ -12,6 +12,10 @@ if (!HTMLElement.prototype.hasPointerCapture) {if (!HTMLElement.prototype.scrollIntoView) {HTMLElement.prototype.scrollIntoView = () => {};}+// happy-dom has no animation timeline; rendered motion is covered in browser tests.+if (!Element.prototype.getAnimations) {+ Element.prototype.getAnimations = () => [];+}// happy-dom does not load fonts; text measurements can run immediately.Object.defineProperty(document, "fonts", {