Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(ui): pulse the running session dot and stop selection shifting the row (#2036)

Max4e0214fcd846
diff --git a/docs/plans/2026-09-18-session-running-dot.md b/docs/plans/2026-09-18-session-running-dot.md
new file mode 100644
index 000000000..004ea878d
--- /dev/null
+++ b/docs/plans/2026-09-18-session-running-dot.md
@@ -0,0 +1,163 @@
+# Session dot motion and selected-row alignment
+
+## Outcome and authority
+
+The owner requested an issue and an implementation agent for the green dot before
+the name of a running session: it should keep blinking while the session runs.
+The owner also reported that selecting a session shifts its dot to the right;
+selected and unselected rows must share the same dot and name alignment.
+The supplied screenshot establishes the approved dot, row, position, and color.
+This is a narrow motion refinement of that supplied design, not a new UI surface.
+Owner merge and release authorization has not been given.
+
+## Evidence
+
+At origin/master `557186174`, both `WorkbenchSidebar.tsx` and `ProjectsPage.tsx`
+render static mint dots for `WorkbenchSession.agent_status === 'running'`.
+The API type and the existing `session.status` event already expose the live
+`idle | running | failed` state; a new backend status or polling mechanism is
+unnecessary. Both surfaces render the dot in their normal and rename paths.
+The desktop row currently combines unconditional `pl-[26px]` with selected-only
+`border-l-2` and `pl-[24px]` using `clsx`. Conflicting padding utilities may leave
+the intended border compensation ineffective in generated CSS. This is a
+testable hypothesis, not a measured diagnosis yet; inspect browser computed
+padding and bounding boxes before choosing the smallest alignment fix.
+
+## Change contract
+
+- Producer: existing Workbench session state, including its existing live updates.
+- Consumer: the status dot immediately before each session name in the desktop
+ sidebar and mobile Projects list, including inline rename.
+- Motion applies exactly while `agent_status === 'running'` and the user has not
+ requested reduced motion. Route selection, unread count, hover, and focus do
+ not determine whether a session is running.
+- Use a gentle repeating opacity pulse (existing Tailwind pulse, approximately
+ two seconds per cycle). Keep the dot visible through the cycle and preserve
+ its current green token, glow, size, position, and surrounding layout.
+- Dot center X and name left edge must remain identical across selected and
+ unselected rows at the same tree depth, including after navigation. Preserve
+ the current selected-row background and left accent without letting their
+ border geometry shift content. Prefer one unambiguous spacing rule over
+ competing utility classes or another compensating offset.
+- A transition out of running removes the animation immediately through the
+ existing state render. Preserve the incumbent idle and failure appearance.
+- Under `prefers-reduced-motion: reduce`, show the static status color. Preserve
+ existing localized status descriptions.
+- No new package, timer, fetch, persisted field, or runtime lifecycle change.
+ Keep Agent graph indicators and other unrelated animations outside this task.
+
+Motion thesis: the only moving element is the running dot; it tells users which
+session is currently working even when another chat is open. CSS opacity gives
+continuous feedback without geometry changes or a JavaScript animation loop.
+
+## Scope and delivery
+
+One implementation lane owns `ui/src/components/workbench/WorkbenchSidebar.tsx`,
+`ui/src/components/workbench/ProjectsPage.tsx`, this plan, and directly relevant
+existing row tests. A small shared status presentation helper or component may
+be used if it reduces the repeated paths without changing other state semantics.
+The existing `sessionRowLayout.ts` and a focused browser regression in the current
+UI test framework are also in scope if the alignment fix needs them.
+Touch `ui/src/index.css` only if the existing motion utility is insufficient.
+All backend, settings, authorization, regression-runner, and other feature files
+are outside scope. Never edit the primary checkout's unrelated dirty work.
+
+The lane must follow `AGENTS.md` and `pr-delivery-loop`, open a non-draft PR linked
+to the issue, drive exact-head Codex review and CI, and hand back without merging.
+The orchestrator is Avibe Session `sesdztacubwq4`.
+
+## Acceptance and evidence
+
+1. A running session's dot visibly cycles for multiple periods independently of
+ selected-row state, on both desktop and mobile session-list surfaces.
+2. Changing the same row's runtime status starts or stops the animation with no
+ reload; the static status appearance remains correct outside running.
+3. Reduced-motion rendering remains static and communicates the same status.
+4. Row geometry, text readability, rename, and existing actions remain usable.
+5. Browser bounding-box measurements show equal dot centers and name left edges
+ between selected and unselected sibling rows, before and after selection is
+ switched. Compare both editable and read-only rows without changing action
+ permissions or the selected-row visual language.
+
+Run the relevant existing UI tests, scoped lint, and `npm run build` before push.
+Do not add implementation-mirroring test scaffolding for a CSS utility change.
+Verify actual browser computed animation and visible motion with test-owned data
+and isolated browser state; use the local Incus runner for product-level probes.
+Capture desktop/mobile and reduced-motion evidence in the PR. If product-level
+verification is unavailable, state the remaining check rather than claiming it.
+Never restart the user's local Avibe service or mutate real sessions for tests.
+
+## Implementation result
+
+The alignment hypothesis was confirmed by measurement, not by reading the JSX.
+In the baseline bundle `.pl-[24px]` is emitted before `.pl-[26px]`. Utilities of
+equal specificity are resolved by their order in the generated stylesheet, not by
+the order of the class string, so the selected row's `pl-[24px]` compensation for
+its `border-l-2` never applied: selected content sat at 2px + 26px while its
+siblings sat at 26px. That is the 2px rightward shift the owner reported.
+
+The fix moves both invariants into `sessionRowLayout.ts`, which already owns this
+row's shared geometry. Every desktop row now carries `border-l-2 pl-[24px]`
+unconditionally and selection changes only the border *colour*, so a row can
+never emit two competing `pl-*` utilities and no compensating offset exists to go
+stale. The selected background, the left accent, and the absolutely positioned
+action rail are unchanged; the rail is positioned against the padding box, so the
+always-present border does not move it.
+
+Motion is the stock Tailwind `animate-pulse`
+(`pulse 2s cubic-bezier(.4,0,.6,1) infinite`, `@keyframes pulse{50%{opacity:.5}}`),
+which is already the contract's gentle two-second cycle that never fully
+disappears, so `index.css` needed no new keyframes. `motion-reduce:animate-none`
+is emitted later, inside the reduced-motion media query, and therefore wins.
+Both surfaces import the one motion constant so they cannot drift apart.
+
+Evidence: `ui/e2e/session-dot/` drives the real sidebar, the real mobile list and
+the real provider against test-owned mocked data in an isolated browser profile.
+It measures rather than mirrors classes — it pauses the live CSS animation, walks
+`currentTime` across four cycles and reads computed opacity (1 / 0.5 / 1 / 0.5 / 1
+at 0/1000/2000/3000/4000 ms, never below 0.5), observes an untouched wall-clock
+change, and compares bounding boxes of selected and unselected sibling rows. It
+flips status through the product's own `session.status` event. Reverting the two
+product class changes fails 10 of its 11 cases, the alignment case reporting the
+exact 2px difference.
+
+## Review correction: hermetic-suite collection boundary
+
+PM review of head `64295b6bd` raised one integration defect: `ui/playwright.config.ts`
+also collected the new fixture suite. That config drives a **live** Avibe instance
+and deliberately has no `webServer`, so a fixture spec collected there asks the
+product backend for a fixture URL it does not serve.
+
+Measuring it first widened the finding. The live config collected 231 tests in 24
+files, of which only 95 in 14 files are its own: `badge-triggers`,
+`onboarding-fidelity`, `project-order`, `session-dot` and `workbench-general`
+were all leaking into a suite whose whole design refuses to start without an
+explicit base URL because it mutates the instance it points at. Four of those
+five predate this branch.
+
+The cause is the shape of the exclusion, not a missing entry in it. The repository
+already has an unambiguous rule — specs directly in `e2e/` are the live suite, and
+every subdirectory is shared support or a hermetic suite owning a
+`playwright.*.config.ts` — and `testIgnore` restated that rule as a hand-maintained
+list of directory names. Adding a fifth name would leave the same list one suite
+behind the next time. So the list is replaced by the rule it was copying:
+
+```
+testIgnore: ['**/e2e/*/**'],
+```
+
+Verified by collection on both sides: the live config goes from 231 tests in 24
+files to exactly its own 95 in 14, with zero specs collected from any
+subdirectory and `--list session-dot` collecting nothing; every one of the eight
+dedicated hermetic configs still collects its own suite unchanged, and
+`playwright.session-dot.config.ts` still collects 14 (7 cases x 2 device projects).
+No suite, dedicated config, package script, or test framework changed.
+
+## Checklist
+
+- [x] Inspect current code and freeze the change contract.
+- [x] Create and read back [issue #2035](https://github.com/avibe-bot/avibe/issues/2035).
+- [x] Implement in the assigned isolated worktree.
+- [x] Verify status transitions, reduced motion, and the UI build.
+- [ ] Open the PR and complete Codex review plus required CI.
+- [ ] Deliver the PR and validation evidence to the orchestrator; do not merge.
diff --git a/ui/e2e/session-dot/dot.spec.ts b/ui/e2e/session-dot/dot.spec.ts
new file mode 100644
index 000000000..3cefb9b83
--- /dev/null
+++ b/ui/e2e/session-dot/dot.spec.ts
@@ -0,0 +1,254 @@
+import { expect, test, type Locator, type Page } from '@playwright/test';
+
+/**
+ * The two claims the owner made, measured in a browser rather than inferred
+ * from class names: a running session's dot keeps pulsing, and selecting a row
+ * does not move its dot or its name.
+ *
+ * The alignment half needs a browser specifically. At the base commit the row
+ * carried both an unconditional 26px left padding and a selected-only 24px one
+ * meant to pay for the 2px accent border. Two utilities of equal specificity are
+ * resolved by their order in the generated stylesheet, not by the order of the
+ * class string, so reading the source cannot tell you which one applied — only
+ * the computed box can.
+ */
+
+const RUNNING = '实例描述字段:实现';
+const RUNNING_SIBLING = '第二个运行中的会话';
+const IDLE = '修复组织成员 Model';
+const FAILED = '失败的会话';
+const READONLY_RUNNING = '只读运行中的会话';
+const WRITABLE_PROJECT = '可写项目';
+const READONLY_PROJECT = '只读项目';
+
+/** Whichever of the two session surfaces this project's viewport renders. */
+const surface = (page: Page) =>
+ page.getByTestId('desktop-tree').or(page.getByTestId('mobile-tree')).filter({ visible: true });
+
+/** The row's own navigation control — the dot and the name live inside it. */
+const rowButton = (page: Page, title: string) =>
+ surface(page).getByRole('button').filter({ hasText: title }).first();
+
+const dotOf = (button: Locator) => button.locator('span').first();
+const labelOf = (button: Locator, title: string) => button.getByText(title, { exact: true });
+
+/** The desktop row container: the element that carries the selected accent. */
+const rowOf = (page: Page, title: string) =>
+ surface(page).locator('div:has(> button > span[title])').filter({ hasText: title }).first();
+
+const expand = async (page: Page, project: string) => {
+ await surface(page).getByText(project, { exact: true }).click();
+};
+
+const boxOf = async (locator: Locator, what: string) => {
+ const box = await locator.boundingBox();
+ expect(box, `${what} should be laid out`).not.toBeNull();
+ return box!;
+};
+
+/** What the user sees line up (or not): the dot's centre and the name's left edge. */
+const geometry = async (page: Page, title: string) => {
+ const button = rowButton(page, title);
+ const dot = await boxOf(dotOf(button), `${title} dot`);
+ const label = await boxOf(labelOf(button, title), `${title} name`);
+ return { dotCentreX: dot.x + dot.width / 2, nameLeft: label.x };
+};
+
+/**
+ * Reads the dot's real CSS animation, then walks its timeline by hand to sample
+ * the whole cycle — including a second and third period, which is what "keeps
+ * blinking" and "never disappears" actually mean.
+ */
+const motionOf = (dot: Locator) =>
+ dot.evaluate((el) => {
+ const animations = el.getAnimations().filter((a): a is CSSAnimation => 'animationName' in a);
+ if (animations.length === 0) return { animated: false as const };
+ const [animation] = animations;
+ const timing = animation.effect?.getTiming();
+ animation.pause();
+ const opacityAt: Record<string, number> = {};
+ for (const ms of [0, 250, 500, 1000, 1500, 2000, 2500, 3000, 4000]) {
+ animation.currentTime = ms;
+ opacityAt[String(ms)] = Number(getComputedStyle(el).opacity);
+ }
+ animation.play();
+ return {
+ animated: true as const,
+ name: animation.animationName,
+ durationMs: typeof timing?.duration === 'number' ? timing.duration : null,
+ endless: timing?.iterations === Infinity,
+ opacityAt,
+ };
+ });
+
+/** Untouched wall-clock evidence that the declared animation is really running. */
+const opacityOf = (dot: Locator) => dot.evaluate((el) => Number(getComputedStyle(el).opacity));
+
+const expectGentleTwoSecondPulse = (motion: Awaited<ReturnType<typeof motionOf>>) => {
+ expect(motion.animated, 'the running dot should carry a CSS animation').toBe(true);
+ if (!motion.animated) return;
+ expect(motion.name).toBe('pulse');
+ expect(motion.durationMs).toBe(2000);
+ expect(motion.endless, 'the pulse should not stop on its own').toBe(true);
+ // Cycle boundaries: full at the ends, half-lit at the middle, and the same
+ // again one and two periods later.
+ expect(motion.opacityAt['0']).toBeCloseTo(1, 2);
+ expect(motion.opacityAt['1000']).toBeCloseTo(0.5, 2);
+ expect(motion.opacityAt['2000']).toBeCloseTo(1, 2);
+ expect(motion.opacityAt['3000']).toBeCloseTo(0.5, 2);
+ expect(motion.opacityAt['4000']).toBeCloseTo(1, 2);
+ // Gentle: the dot dims, it never goes out.
+ const samples = Object.values(motion.opacityAt);
+ expect(Math.min(...samples)).toBeGreaterThanOrEqual(0.5);
+ expect(Math.max(...samples)).toBeLessThanOrEqual(1);
+};
+
+test.beforeEach(async ({ page }) => {
+ await page.goto('/e2e/session-dot/fixture.html');
+ await expect(surface(page).getByText(WRITABLE_PROJECT, { exact: true })).toBeVisible();
+ await expand(page, WRITABLE_PROJECT);
+ await expect(surface(page).getByText(RUNNING, { exact: true })).toBeVisible();
+});
+
+test('a running session keeps pulsing and an idle or failed one stays still', async ({ page }) => {
+ expectGentleTwoSecondPulse(await motionOf(dotOf(rowButton(page, RUNNING))));
+
+ // The same claim without touching the timeline: left alone, the dot's opacity
+ // is somewhere else half a period later.
+ const first = await opacityOf(dotOf(rowButton(page, RUNNING))); // resumed at ~0
+ await page.waitForTimeout(700);
+ const second = await opacityOf(dotOf(rowButton(page, RUNNING)));
+ expect(Math.abs(second - first), 'the dot should visibly change on its own').toBeGreaterThan(0.05);
+
+ for (const still of [IDLE, FAILED]) {
+ expect((await motionOf(dotOf(rowButton(page, still)))).animated, `${still} should not pulse`).toBe(false);
+ }
+});
+
+test('the pulse follows the runtime status alone, not selection or the surface', async ({ page }) => {
+ // Selecting the row must neither start nor stop the motion.
+ await rowButton(page, IDLE).click();
+ expect((await motionOf(dotOf(rowButton(page, IDLE)))).animated, 'a selected idle row').toBe(false);
+ expectGentleTwoSecondPulse(await motionOf(dotOf(rowButton(page, RUNNING))));
+
+ await rowButton(page, RUNNING).click();
+ expectGentleTwoSecondPulse(await motionOf(dotOf(rowButton(page, RUNNING))));
+
+ // A read-only project's rows are the same dot.
+ await expand(page, READONLY_PROJECT);
+ await expect(surface(page).getByText(READONLY_RUNNING, { exact: true })).toBeVisible();
+ expectGentleTwoSecondPulse(await motionOf(dotOf(rowButton(page, READONLY_RUNNING))));
+});
+
+test('a live status change starts and stops the pulse without a reload', async ({ page }) => {
+ const dot = dotOf(rowButton(page, RUNNING));
+ expect((await motionOf(dot)).animated).toBe(true);
+
+ await page.evaluate((id) => window.setSessionStatus(id, 'idle'), 'writable-running');
+ await expect.poll(async () => (await motionOf(dot)).animated, {
+ message: 'the pulse should stop when the session stops running',
+ }).toBe(false);
+
+ await page.evaluate((id) => window.setSessionStatus(id, 'running'), 'writable-idle');
+ const revived = dotOf(rowButton(page, IDLE));
+ await expect.poll(async () => (await motionOf(revived)).animated, {
+ message: 'the pulse should start when the session starts running',
+ }).toBe(true);
+ expectGentleTwoSecondPulse(await motionOf(revived));
+});
+
+test('reduced motion keeps the static status dot', async ({ page }) => {
+ const dot = dotOf(rowButton(page, RUNNING));
+ expect((await motionOf(dot)).animated, 'the dot pulses before the preference changes').toBe(true);
+ const lit = await dot.evaluate((el) => getComputedStyle(el).backgroundColor);
+
+ await page.emulateMedia({ reducedMotion: 'reduce' });
+
+ expect((await motionOf(dot)).animated, 'reduced motion should not animate').toBe(false);
+ expect(await opacityOf(dot), 'the static dot stays fully lit').toBeCloseTo(1, 2);
+ expect((await boxOf(dot, 'reduced-motion dot')).width).toBeGreaterThan(0);
+ // Same green, same size: reduced motion drops the animation, not the status.
+ await expect(dot).toHaveCSS('background-color', lit);
+ expect(lit).not.toBe('rgba(0, 0, 0, 0)');
+});
+
+test.describe('desktop row alignment', () => {
+ test.skip(({ isMobile }) => Boolean(isMobile), 'the selected-row accent is a desktop-tree affordance');
+
+ test('selecting a row leaves its dot and name where they were', async ({ page }) => {
+ // The localized status description the dot carries survives the change.
+ await expect(dotOf(rowButton(page, RUNNING))).toHaveAttribute('title', 'Running');
+ await expect(dotOf(rowButton(page, IDLE))).toHaveAttribute('title', 'Idle');
+ await expect(dotOf(rowButton(page, FAILED))).toHaveAttribute('title', 'Last turn failed');
+
+ const before = await geometry(page, RUNNING);
+ const sibling = await geometry(page, RUNNING_SIBLING);
+ expect(before.dotCentreX).toBeCloseTo(sibling.dotCentreX, 1);
+ expect(before.nameLeft).toBeCloseTo(sibling.nameLeft, 1);
+
+ await rowButton(page, RUNNING).click();
+ // The row really is selected: the accent it reserves space for is now lit.
+ await expect(rowOf(page, RUNNING)).not.toHaveCSS('border-left-color', 'rgba(0, 0, 0, 0)');
+ await expect(rowOf(page, RUNNING)).toHaveCSS('border-left-width', '2px');
+
+ const selected = await geometry(page, RUNNING);
+ expect(selected.dotCentreX, 'the selected dot must not shift right').toBeCloseTo(before.dotCentreX, 1);
+ expect(selected.nameLeft, 'the selected name must not shift right').toBeCloseTo(before.nameLeft, 1);
+ // ... and against the row beside it, which is what the user compares it to.
+ expect(selected.dotCentreX).toBeCloseTo((await geometry(page, RUNNING_SIBLING)).dotCentreX, 1);
+ expect(selected.nameLeft).toBeCloseTo((await geometry(page, RUNNING_SIBLING)).nameLeft, 1);
+ });
+
+ test('moving the selection does not move either row', async ({ page }) => {
+ await rowButton(page, RUNNING).click();
+ const firstSelected = await geometry(page, RUNNING);
+ const firstUnselected = await geometry(page, IDLE);
+
+ await rowButton(page, IDLE).click();
+ await expect(rowOf(page, IDLE)).not.toHaveCSS('border-left-color', 'rgba(0, 0, 0, 0)');
+ await expect(rowOf(page, RUNNING)).toHaveCSS('border-left-color', 'rgba(0, 0, 0, 0)');
+
+ // Each row's geometry is the same as it was in the opposite selection state.
+ expect((await geometry(page, RUNNING)).dotCentreX).toBeCloseTo(firstSelected.dotCentreX, 1);
+ expect((await geometry(page, RUNNING)).nameLeft).toBeCloseTo(firstSelected.nameLeft, 1);
+ expect((await geometry(page, IDLE)).dotCentreX).toBeCloseTo(firstUnselected.dotCentreX, 1);
+ expect((await geometry(page, IDLE)).nameLeft).toBeCloseTo(firstUnselected.nameLeft, 1);
+ });
+
+ test('a read-only row and a row being renamed keep the same indent', async ({ page }) => {
+ await expand(page, READONLY_PROJECT);
+ await expect(surface(page).getByText(READONLY_RUNNING, { exact: true })).toBeVisible();
+
+ const writable = await geometry(page, RUNNING);
+ const readOnly = await geometry(page, READONLY_RUNNING);
+ expect(readOnly.dotCentreX, 'a read-only row is indented like a writable one').toBeCloseTo(writable.dotCentreX, 1);
+ expect(readOnly.nameLeft).toBeCloseTo(writable.nameLeft, 1);
+
+ // The action rail only exists where metadata is writable, and that is a
+ // right-hand affordance: it must not change the left indent either way.
+ await expect(rowOf(page, RUNNING).getByRole('button', { name: 'Session actions' })).toBeAttached();
+ await expect(rowOf(page, READONLY_RUNNING).getByRole('button', { name: 'Session actions' })).toHaveCount(0);
+
+ // Selecting a read-only row has to hold the indent too — it has no action
+ // rail, so it is the row where a right-hand compensation would show up.
+ await rowButton(page, READONLY_RUNNING).click();
+ await expect(rowOf(page, READONLY_RUNNING)).not.toHaveCSS('border-left-color', 'rgba(0, 0, 0, 0)');
+ const readOnlySelected = await geometry(page, READONLY_RUNNING);
+ expect(readOnlySelected.dotCentreX, 'a selected read-only dot must not shift').toBeCloseTo(readOnly.dotCentreX, 1);
+ expect(readOnlySelected.nameLeft).toBeCloseTo(readOnly.nameLeft, 1);
+ expect(readOnlySelected.dotCentreX).toBeCloseTo(writable.dotCentreX, 1);
+
+ // Inline rename replaces the row, accent and all, so the strict case is a
+ // SELECTED row: the dot has to stay put while the user types.
+ await rowButton(page, RUNNING).click();
+ await expect(rowOf(page, RUNNING)).not.toHaveCSS('border-left-color', 'rgba(0, 0, 0, 0)');
+ const dotBefore = await boxOf(dotOf(rowButton(page, RUNNING)), 'dot before rename');
+ await rowOf(page, RUNNING).click({ button: 'right' });
+ await page.getByRole('group', { name: 'Session actions' }).getByRole('button', { name: 'Rename' }).click();
+ const renameRow = surface(page).locator('div:has(> input)').first();
+ await expect(renameRow.getByPlaceholder('Session name')).toBeVisible();
+ const renameDot = await boxOf(renameRow.locator('span').first(), 'dot while renaming');
+ expect(renameDot.x + renameDot.width / 2).toBeCloseTo(dotBefore.x + dotBefore.width / 2, 1);
+ await page.keyboard.press('Escape');
+ });
+});
diff --git a/ui/e2e/session-dot/fixture.html b/ui/e2e/session-dot/fixture.html
new file mode 100644
index 000000000..f69ad939b
--- /dev/null
+++ b/ui/e2e/session-dot/fixture.html
@@ -0,0 +1,2 @@
+<!doctype html>
+<html lang="en"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Session status dot regression</title></head><body><div id="root"></div><script type="module" src="./fixture.tsx"></script></body></html>
diff --git a/ui/e2e/session-dot/fixture.tsx b/ui/e2e/session-dot/fixture.tsx
new file mode 100644
index 000000000..5740fce1e
--- /dev/null
+++ b/ui/e2e/session-dot/fixture.tsx
@@ -0,0 +1,139 @@
+import { createRoot } from 'react-dom/client';
+import { createHashRouter, RouterProvider } from 'react-router-dom';
+import { ApiProvider, type WorkbenchProject, type WorkbenchSession } from '../../src/context/ApiContext';
+import { WorkbenchProjectsProvider } from '../../src/context/WorkbenchProjectsProvider';
+import { WorkbenchInboxContext } from '../../src/context/WorkbenchInboxContext';
+import { InstanceAuthorizationContext } from '../../src/context/InstanceAuthorizationContext';
+import { ToastContext } from '../../src/context/ToastContext';
+import { WindowManagerContext, type WindowManagerValue } from '../../src/context/WindowManagerContext';
+import { UnsavedChangesProvider } from '../../src/context/UnsavedChangesProvider';
+import { WorkbenchSidebar } from '../../src/components/workbench/WorkbenchSidebar';
+import { ProjectsPage } from '../../src/components/workbench/ProjectsPage';
+import { OWNER_INSTANCE_CAPABILITIES } from '../../src/lib/sessionInfo';
+import '../../src/i18n';
+import '../../src/index.css';
+
+const noop = () => {};
+
+// Two projects at the same tree depth, so the rows the spec measures against
+// each other are siblings in layout terms. The first is writable and the
+// second is not: `canManageMetadata` is `can_manage_projects || project.can_chat`,
+// so denying the instance the former and the project the latter produces the
+// read-only row without touching any other permission. Titles are non-ASCII
+// because that is what the reported screenshot shows, and Latin-only fixtures
+// flatter both truncation and measurement.
+const projects: WorkbenchProject[] = [
+ {
+ id: 'project-writable', scope_id: 'scope-writable', display_name: '可写项目',
+ folder_path: '/fixture/可写项目', created_at: '2026-01-01T00:00:00Z', last_active_at: null,
+ archived: false, capabilities: { can_chat: true, has_folder: true },
+ },
+ {
+ id: 'project-readonly', scope_id: 'scope-readonly', display_name: '只读项目',
+ folder_path: '/fixture/只读项目', created_at: '2026-01-02T00:00:00Z', last_active_at: null,
+ archived: false, capabilities: { can_chat: false, has_folder: true },
+ },
+];
+
+type Seed = { id: string; title: string; agent_status: WorkbenchSession['agent_status'] };
+
+// Every status the dot maps, plus a second running session so the spec can hold
+// one running row selected and another running row unselected at the same time.
+const SEEDS: Record<string, Seed[]> = {
+ 'project-writable': [
+ { id: 'writable-running', title: '实例描述字段:实现', agent_status: 'running' },
+ { id: 'writable-idle', title: '修复组织成员 Model', agent_status: 'idle' },
+ { id: 'writable-running-2', title: '第二个运行中的会话', agent_status: 'running' },
+ { id: 'writable-failed', title: '失败的会话', agent_status: 'failed' },
+ ],
+ 'project-readonly': [
+ { id: 'readonly-running', title: '只读运行中的会话', agent_status: 'running' },
+ { id: 'readonly-idle', title: '只读空闲会话', agent_status: 'idle' },
+ ],
+};
+
+const session = (projectId: string, seed: Seed): WorkbenchSession => ({
+ id: seed.id, title: seed.title, project_id: projectId,
+ scope_id: projects.find((p) => p.id === projectId)?.scope_id,
+ status: 'active', agent_status: seed.agent_status, pinned: false, visibility: 'foreground',
+ created_at: '2026-01-01T00:00:00Z', updated_at: '2026-01-01T00:00:00Z',
+ last_active_at: '2026-01-01T00:00:00Z', metadata: {},
+} as WorkbenchSession);
+
+// One mutable store behind every read, because the product has one too. The
+// provider re-reads a single row after a status event, so a fixture that only
+// answered the list would hand that read an empty session and blank the row.
+const rows = new Map<string, WorkbenchSession>(
+ Object.entries(SEEDS).flatMap(([projectId, seeds]) =>
+ seeds.map((seed) => [seed.id, session(projectId, seed)] as const),
+ ),
+);
+const rowsOf = (projectId: string) => [...rows.values()].filter((row) => row.project_id === projectId);
+
+const streams = new Set<EventTarget>();
+class FixtureEvents extends EventTarget {
+ readyState = 1;
+ constructor() { super(); streams.add(this); }
+ close() { streams.delete(this); this.readyState = 2; }
+}
+Object.defineProperty(window, 'EventSource', { value: FixtureEvents });
+
+// The product's own live path: the spec flips a status through the SSE event the
+// service emits, not through a prop, so what it measures is the same update the
+// user gets while a session starts or stops working.
+declare global {
+ interface Window {
+ setSessionStatus: (sessionId: string, agentStatus: WorkbenchSession['agent_status']) => void;
+ }
+}
+window.setSessionStatus = (session_id, agent_status) => {
+ const row = rows.get(session_id);
+ if (row) rows.set(session_id, { ...row, agent_status });
+ streams.forEach((stream) => stream.dispatchEvent(new MessageEvent('session.status', {
+ data: JSON.stringify({ type: 'session.status', data: { session_id, agent_status } }),
+ })));
+};
+
+// Hermetic transport: the real API client, provider and both session surfaces
+// run here, but no request can reach a workstation Avibe service or user state.
+window.fetch = async (input) => {
+ const url = new URL(
+ typeof input === 'string' ? input : input instanceof URL ? input.href : input.url,
+ location.origin,
+ );
+ const reply = (data: unknown) => new Response(JSON.stringify(data), {
+ status: 200, headers: { 'Content-Type': 'application/json' },
+ });
+ if (url.pathname === '/api/csrf-token') return reply({ csrf_token: 'fixture' });
+ if (url.pathname === '/api/projects' || url.pathname === '/api/workbench/projects-bootstrap') {
+ return reply({ projects, sessions: {} });
+ }
+ if (url.pathname === '/api/sessions') {
+ return reply({ sessions: rowsOf(url.searchParams.get('project_id') ?? ''), next_before_id: null });
+ }
+ const row = rows.get(decodeURIComponent(url.pathname.replace('/api/sessions/', '')));
+ if (row) return reply(row);
+ return reply({});
+};
+
+export function Fixture() {
+ return <InstanceAuthorizationContext.Provider value={{
+ remote: false, instanceKind: null, instanceRole: 'owner',
+ capabilities: { ...OWNER_INSTANCE_CAPABILITIES, can_manage_projects: false },
+ }}><ToastContext.Provider value={{ showToast: noop }}><ApiProvider><UnsavedChangesProvider>
+ <WorkbenchProjectsProvider><WorkbenchInboxContext.Provider value={{
+ inboxSessions: [], unreadBySession: {}, totalUnread: 0, unreadSessions: 0, nextCursor: null,
+ loading: false, loadingMore: false, refresh: async () => {}, loadMore: async () => {},
+ markRead: async () => {}, activateFeed: () => noop,
+ }}><WindowManagerContext.Provider value={{ focusedId: null, focusCanvas: noop, openApp: noop } as unknown as WindowManagerValue}>
+ <div className="flex h-dvh overflow-hidden bg-background text-foreground">
+ <aside className="hidden h-full w-64 shrink-0 border-r border-border md:flex" data-testid="desktop-tree"><WorkbenchSidebar /></aside>
+ <main id="app-shell-scroll" className="min-h-0 min-w-0 flex-1 overflow-y-auto p-4 md:hidden" data-testid="mobile-tree"><ProjectsPage /></main>
+ </div>
+ </WindowManagerContext.Provider></WorkbenchInboxContext.Provider></WorkbenchProjectsProvider>
+ </UnsavedChangesProvider></ApiProvider></ToastContext.Provider></InstanceAuthorizationContext.Provider>;
+}
+
+createRoot(document.getElementById('root')!).render(
+ <RouterProvider router={createHashRouter([{ path: '*', element: <Fixture /> }])} />,
+);
diff --git a/ui/e2e/session-dot/tsconfig.json b/ui/e2e/session-dot/tsconfig.json
new file mode 100644
index 000000000..497830b7f
--- /dev/null
+++ b/ui/e2e/session-dot/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "../../tsconfig.app.json",
+ "compilerOptions": { "types": ["vite/client", "node"] },
+ "include": [
+ "*.ts", "*.tsx", "../../playwright.session-dot.config.ts", "../../agentation.d.ts"
+ ],
+ "exclude": []
+}
diff --git a/ui/package.json b/ui/package.json
index 8bfe55530..fde4b78ba 100644
--- a/ui/package.json
+++ b/ui/package.json
@@ -23,6 +23,7 @@
"test:inbox-return": "tsc -p e2e/inbox-return/tsconfig.json --noEmit && playwright test --config playwright.inbox-return.config.ts",
"test:badge-triggers": "tsc -p e2e/badge-triggers/tsconfig.json --noEmit && playwright test --config playwright.badge-triggers.config.ts",
"test:project-order": "tsc -p e2e/project-order/tsconfig.json --noEmit && playwright test --config playwright.project-order.config.ts",
+ "test:session-dot": "tsc -p e2e/session-dot/tsconfig.json --noEmit && playwright test --config playwright.session-dot.config.ts",
"test:model-catalog": "tsc -p e2e/model-catalog/tsconfig.json --noEmit && playwright test --config playwright.model-catalog.config.ts",
"test:model-provider": "tsc -p e2e/model-provider/tsconfig.json --noEmit && playwright test --config playwright.model-provider.config.ts",
"test:onboarding-fidelity": "tsc -p e2e/onboarding-fidelity/tsconfig.json --noEmit && playwright test --config playwright.onboarding-fidelity.config.ts",
diff --git a/ui/playwright.config.ts b/ui/playwright.config.ts
index 73f9d29d3..7bf6bce66 100644
--- a/ui/playwright.config.ts
+++ b/ui/playwright.config.ts
@@ -16,7 +16,15 @@ import { BASE_URL } from './e2e/support/env';
export default defineConfig({
testDir: './e2e',
- testIgnore: ['**/chat-paging/**', '**/inbox-return/**', '**/model-catalog/**', '**/model-provider/**'],
+ // This suite is the specs directly in `e2e/`. Every subdirectory is either
+ // shared support or a per-feature hermetic suite that owns a `playwright.*.config.ts`
+ // and starts its own dev server against a fixture page; running one here would
+ // ask a live instance for a fixture URL it does not serve. That rule used to be
+ // restated as a list of directory names, which is a copy of the structure that
+ // has to be updated by hand — and five suites had already fallen out of it, so
+ // `npm run e2e` collected 136 foreign tests against the instance it mutates.
+ // Add a spec here to run it live; add a directory to keep it hermetic.
+ testIgnore: ['**/e2e/*/**'],
outputDir: './e2e/.artifacts/test-results',
// Every spec mutates shared instance state (sources, agent modes, the
// runtime switch). Parallel workers would race on it, so the suite is serial
diff --git a/ui/playwright.session-dot.config.ts b/ui/playwright.session-dot.config.ts
new file mode 100644
index 000000000..553c585a3
--- /dev/null
+++ b/ui/playwright.session-dot.config.ts
@@ -0,0 +1,22 @@
+import { defineConfig, devices } from '@playwright/test';
+
+// Hermetic: the dev server is bound to loopback and points at a dead backend
+// port, and the fixture answers every request in-page, so nothing here reaches
+// a running Avibe service or writes to user state.
+export default defineConfig({
+ testDir: './e2e/session-dot',
+ outputDir: './e2e/.artifacts/session-dot',
+ workers: 1,
+ retries: 0,
+ use: { baseURL: 'http://127.0.0.1:5214', locale: 'en-US', trace: 'retain-on-failure' },
+ webServer: {
+ command: 'npm run dev -- --host 127.0.0.1 --port 5214 --strictPort',
+ env: { VIBE_UI_BACKEND: 'http://127.0.0.1:9' },
+ url: 'http://127.0.0.1:5214/e2e/session-dot/fixture.html',
+ reuseExistingServer: true,
+ },
+ projects: [
+ { name: 'desktop', use: { ...devices['Desktop Chrome'] } },
+ { name: 'mobile', use: { ...devices['iPhone 13'], browserName: 'chromium' } },
+ ],
+});
diff --git a/ui/src/components/workbench/ProjectsPage.tsx b/ui/src/components/workbench/ProjectsPage.tsx
index a28dc37a8..16c8543ed 100644
--- a/ui/src/components/workbench/ProjectsPage.tsx
+++ b/ui/src/components/workbench/ProjectsPage.tsx
@@ -52,10 +52,14 @@ import { mobileSessionActions } from './chatSessionActions';
import { SessionActionMenuContent, SessionActionsTrigger } from './sessionActions';
import { useSessionActions } from './useSessionActions';
import { SessionPinIndicator } from './SessionPinIndicator';
+import { SESSION_STATUS_DOT_MOTION_CLASS } from './sessionRowLayout';
import { SortableProjectList, type ProjectDragHandle } from './SortableProjectList';
+// Same status → colour mapping the desktop sidebar draws, and the same pulse
+// while the agent is running; the two surfaces share the motion class so a
+// running session reads the same way on a phone as on a desktop.
const DOT: Record<string, string> = {
- running: 'bg-mint shadow-glow-dot-mint',
+ running: `bg-mint shadow-glow-dot-mint ${SESSION_STATUS_DOT_MOTION_CLASS}`,
failed: 'bg-destructive',
idle: 'bg-muted',
};
diff --git a/ui/src/components/workbench/WorkbenchSidebar.tsx b/ui/src/components/workbench/WorkbenchSidebar.tsx
index bebb084b7..78b7f689c 100644
--- a/ui/src/components/workbench/WorkbenchSidebar.tsx
+++ b/ui/src/components/workbench/WorkbenchSidebar.tsx
@@ -35,7 +35,11 @@ import { useWindowManager } from '../../context/WindowManagerContext';
import { useUnsavedChangesActionGuard } from '../../context/useUnsavedChangesActionGuard';
import type { InboxSession, WorkbenchProject, WorkbenchSession } from '../../context/ApiContext';
import { SessionPinAction } from './SessionPinAction';
-import { SESSION_ROW_MENU_POSITION_CLASS } from './sessionRowLayout';
+import {
+ SESSION_ROW_INDENT_CLASS,
+ SESSION_ROW_MENU_POSITION_CLASS,
+ SESSION_STATUS_DOT_MOTION_CLASS,
+} from './sessionRowLayout';
import { SessionActionMenuContent, SessionActionsTrigger } from './sessionActions';
import { useSessionActions } from './useSessionActions';
import { formatRelativeTime } from '../../lib/relativeTime';
@@ -232,8 +236,10 @@ const InboxHoverPopover: React.FC<{
// Session status dot colours. Maps the agent-runtime status to the user's
// gray / green / red: idle → muted (gray), running → mint (green) + glow,
// failed → destructive (red) + glow. Tokens resolve from src/index.css.
+// Running also pulses — keyed on nothing but the status, so selection, unread
+// count, hover and focus cannot start or stop the motion.
const STATUS_DOT_CLASS: Record<string, string> = {
- running: 'bg-mint shadow-glow-dot-mint',
+ running: `bg-mint shadow-glow-dot-mint ${SESSION_STATUS_DOT_MOTION_CLASS}`,
failed: 'bg-destructive shadow-glow-dot-destructive',
idle: 'bg-muted',
};
@@ -312,7 +318,12 @@ export const SessionRow: React.FC<{
if (renaming) {
return (
- <div className="flex items-center gap-2 py-1.5 pl-[26px] pr-2.5">
+ <div
+ className={clsx(
+ 'flex items-center gap-2 border-transparent py-1.5 pr-2.5',
+ SESSION_ROW_INDENT_CLASS,
+ )}
+ >
<span
className={clsx(
'size-[5px] shrink-0 rounded-full',
@@ -347,11 +358,14 @@ export const SessionRow: React.FC<{
setMenuOpen(true);
}}
className={clsx(
- 'group/sess relative flex items-center gap-2 rounded-md py-1.5 pl-[26px] text-left transition-colors duration-150 ease-out motion-reduce:transition-none',
+ 'group/sess relative flex items-center gap-2 rounded-md py-1.5 text-left transition-colors duration-150 ease-out motion-reduce:transition-none',
+ SESSION_ROW_INDENT_CLASS,
canManageMetadata ? 'pr-11' : 'pr-2.5',
+ // Only the accent's colour turns on with selection; its width is
+ // already reserved above, so the row's contents do not move.
active
- ? 'border-l-2 border-mint bg-mint-soft pl-[24px] font-semibold text-foreground'
- : 'hover:bg-foreground/[0.04]',
+ ? 'border-mint bg-mint-soft font-semibold text-foreground'
+ : 'border-transparent hover:bg-foreground/[0.04]',
)}
>
<button
diff --git a/ui/src/components/workbench/sessionRowLayout.ts b/ui/src/components/workbench/sessionRowLayout.ts
index ba1a9a27e..c82490115 100644
--- a/ui/src/components/workbench/sessionRowLayout.ts
+++ b/ui/src/components/workbench/sessionRowLayout.ts
@@ -4,3 +4,20 @@
export const SESSION_ROW_ACTION_BUTTON_CLASS = 'size-5 rounded-md';
export const SESSION_ROW_PIN_POSITION_CLASS = 'right-5';
export const SESSION_ROW_MENU_POSITION_CLASS = 'right-0';
+
+// The desktop session row's left inset, and the one owner of it. Every row
+// carries the selected accent's 2px border and only its colour changes with
+// selection, so the status dot and the name keep one X coordinate. Paying for
+// that border with a second `pl-*` on the selected row cannot work: utilities
+// of equal specificity are resolved by their order in the generated stylesheet
+// rather than by the order of the class string, and Tailwind emitted the 26px
+// padding after the 24px one — so the compensation never applied and selecting
+// a row pushed its contents 2px to the right.
+export const SESSION_ROW_INDENT_CLASS = 'border-l-2 pl-[24px]';
+
+// A running session's dot pulses, so the user can see which session is working
+// while reading another chat. `animate-pulse` is a ~2s opacity cycle that keeps
+// the dot visible throughout and moves no geometry; under reduced motion the
+// dot falls back to its static status colour. Shared by the desktop sidebar and
+// the mobile session list so the two surfaces cannot drift apart.
+export const SESSION_STATUS_DOT_MOTION_CLASS = 'animate-pulse motion-reduce:animate-none';