diff --git a/frontend/src/renderer/components/Sidebar.test.tsx b/frontend/src/renderer/components/Sidebar.test.tsx index cd71be74..bd9b24ff 100644 --- a/frontend/src/renderer/components/Sidebar.test.tsx +++ b/frontend/src/renderer/components/Sidebar.test.tsx @@ -3,7 +3,7 @@ import { render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { Sidebar } from "./Sidebar"; -import type { WorkspaceSummary } from "../types/workspace"; +import type { WorkspaceSession, WorkspaceSummary } from "../types/workspace"; const { navigateMock } = vi.hoisted(() => ({ navigateMock: vi.fn() })); @@ -25,6 +25,21 @@ const workspace: WorkspaceSummary = { sessions: [], }; +function workerSession(overrides: Partial): WorkspaceSession { + return { + id: "reverbcode-2", + workspaceId: "proj-1", + workspaceName: "Project One", + title: "reverbcode-2", + provider: "claude-code", + kind: "worker", + branch: "session/reverbcode-2", + status: "working", + updatedAt: "2026-06-17T00:00:00Z", + ...overrides, + }; +} + function renderSidebar(onRemoveProject = vi.fn().mockResolvedValue(undefined)) { render( @@ -74,6 +89,40 @@ describe("Sidebar", () => { expect(onRemoveProject).not.toHaveBeenCalled(); }); + it("does not repeat the session id under the title when the title is the id", () => { + const sessions = [workerSession({ id: "reverbcode-2", title: "reverbcode-2" })]; + render( + + + , + ); + + // Title renders once; the id subtitle is suppressed because it would duplicate it. + expect(screen.getAllByText("reverbcode-2")).toHaveLength(1); + }); + + it("shows the session id under a distinct display name", () => { + const sessions = [workerSession({ id: "reverbcode-2", title: "fix the sidebar" })]; + render( + + + , + ); + + expect(screen.getByText("fix the sidebar")).toBeInTheDocument(); + expect(screen.getByText("reverbcode-2")).toBeInTheDocument(); + }); + it("hides the worker count in every state that reveals project actions", () => { renderSidebar(); diff --git a/frontend/src/renderer/components/Sidebar.tsx b/frontend/src/renderer/components/Sidebar.tsx index c0878d8a..98bc3e1b 100644 --- a/frontend/src/renderer/components/Sidebar.tsx +++ b/frontend/src/renderer/components/Sidebar.tsx @@ -498,7 +498,13 @@ function ProjectItem({ > {session.title} - {session.id} + {/* The id is a secondary handle; when the worker has no + displayName/issueId the title already falls back to the + id (useWorkspaceQuery), so skip the line rather than + repeat the same string twice. */} + {session.title !== session.id && ( + {session.id} + )}