Link agent names in the chat sidebar to their overviews (#23650)

## Thinking Path

> - Paperclip lets people manage agents.
> - The chat sidebar lists agents with conversations.
> - Each row opens a conversation.
> - The agent name gives readers a natural place to open the agent
overview.
> - Separate links let users choose either destination with a mouse or
keyboard.

## Linked Issues or Issue Description

**Subsystem affected**
Chat sidebar navigation.

**Current behavior**
Selecting an agent name opens the conversation.

**Proposed behavior**
Selecting the name opens that agent's overview. Selecting the avatar or
role opens the chat.

## What Changed

Added a company-scoped overview link on the name and kept a separate
chat link across the row.

## Verification

The sidebar compiled with esbuild. The diff whitespace check passed. To
verify in the app, click the name, return to the list, then click the
role. Check both links with Tab and Enter.

## Risks

Users who previously clicked the name to open chat will now reach the
overview.

## Model Used

OpenAI Codex, GPT-6, with shell tools.

## Checklist

- [ ] I have included a thinking path that traces from project context
to this change
- [ ] I have specified the model used (with version and capability
details)
- [ ] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [ ] I have searched GitHub for duplicate or related PRs and linked
them above
- [ ] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [ ] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [ ] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [ ] I have run tests locally and they pass
- [ ] I have added or updated tests where applicable
- [ ] I have updated relevant documentation to reflect my changes
- [ ] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [ ] I will address all Greptile and reviewer comments before
requesting merge
This commit is contained in:
Tonio authored and GitHub committed 2026-12-03 12:13:14 -08:00
1 parent 0208bbfbf7
commit 23ca89e376
4 files changed
+35 -22

No files matched your search

@@ -111,7 +111,7 @@ test("Coordinator agent switching preserves drafts and opens one conversation on
const editor = page.getByTestId("task-chat-composer-input").locator('[contenteditable="true"]');
const contacts = page.getByRole("complementary", { name: "Chat contacts", exact: true });
const switchTo = async (name: string) => {
const contact = contacts.getByRole("link", { name: new RegExp(`^${name}`) });
const contact = contacts.getByRole("link", { name: `Open chat with ${name}`, exact: true });
await contact.click();
await expect(contact).toHaveAttribute("aria-current", "page");
};
@@ -165,12 +165,12 @@ test("secondary chat navigation preserves layout, unique conversations, history,
});
const sidebar = page.getByRole("complementary", { name: "Chat contacts", exact: true });
const nav = sidebar.getByRole("navigation", { name: "Agent conversations" });
const alphaLink = nav.getByRole("link", { name: /^Alpha/ });
const betaLink = nav.getByRole("link", { name: /^Beta/ });
const alphaLink = nav.getByRole("link", { name: "Open chat with Alpha", exact: true });
const betaLink = nav.getByRole("link", { name: "Open chat with Beta", exact: true });
await expect(alphaLink).toHaveAttribute("aria-current", "page");
expect(await json(await request.get(f.chatPath))).toBeNull();
expect(await json(await request.get(`/api/companies/${f.company.id}/heartbeat-runs`))).toHaveLength(0);
await expect(nav.getByRole("link")).toHaveText([/^Alpha/, /^Beta/, /^Delta/, /^Epsilon/, /^Gamma/, /^Zeta/]);
await expect(nav.getByRole("link", { name: /^View overview for / })).toHaveText([/^Alpha/, /^Beta/, /^Delta/, /^Epsilon/, /^Gamma/, /^Zeta/]);
const landingBounds = await sidebar.boundingBox();
const chatListPath = `/api/companies/${f.company.id}/chats`;
const betaPath = `${chatListPath}/${f.agents[1].id}`;
@@ -194,7 +194,7 @@ test("secondary chat navigation preserves layout, unique conversations, history,
expect(await json(await request.get(chatListPath))).toHaveLength(1);
await alphaLink.click();
await expect(alphaLink).toHaveAttribute("aria-current", "page");
await expect(nav.getByRole("link")).toHaveText([/^Alpha/, /^Beta/, /^Delta/, /^Epsilon/, /^Gamma/, /^Zeta/]);
await expect(nav.getByRole("link", { name: /^View overview for / })).toHaveText([/^Alpha/, /^Beta/, /^Delta/, /^Epsilon/, /^Gamma/, /^Zeta/]);
const editor = page.getByTestId("task-chat-composer-input").locator('[contenteditable="true"]');
await editor.fill("Unsent draft for Alpha");
await betaLink.click();
@@ -206,13 +206,13 @@ test("secondary chat navigation preserves layout, unique conversations, history,
await search.fill("No matching agent");
await expect(sidebar.getByText("No agents found", { exact: true })).toBeVisible();
await search.fill("Beta");
await expect(nav.getByRole("link")).toHaveCount(1);
await expect(nav.getByRole("link", { name: /^View overview for / })).toHaveCount(1);
await expect(betaLink).toBeVisible();
await search.press("Escape");
await expect(nav.getByRole("link")).toHaveCount(6);
await expect(nav.getByRole("link", { name: /^View overview for / })).toHaveCount(6);
await page.reload();
await expect(editor).toContainText("Unsent draft for Alpha");
await expect(nav.getByRole("link")).toHaveCount(6);
await expect(nav.getByRole("link", { name: /^View overview for / })).toHaveCount(6);
await page.getByRole("link", { name: /^Chat(?:\s|$)/ }).click();
await expect(alphaLink).toHaveAttribute("aria-current", "page");
@@ -234,9 +234,14 @@ test("secondary chat navigation preserves layout, unique conversations, history,
await expect(page.getByText("Background activity", { exact: true })).toBeVisible();
expect((await json(await request.get(betaPath))).id).toBe(beta.id);
expect(await json(await request.get(chatListPath))).toHaveLength(1);
await nav.getByRole("link", { name: "View overview for Beta", exact: true }).click();
await expect(page).toHaveURL(/\/agents\/[^/]+\/overview$/);
await json(await request.post(`/api/agents/${f.agents[1].id}/terminate`));
await page.goto(`/${f.company.issuePrefix}/chats`);
await expect(betaLink).toContainText("Terminated");
const betaRow = nav.locator(".agent-contact-row").filter({
has: page.getByRole("link", { name: "Open chat with Beta", exact: true }),
});
await expect(betaRow).toContainText("Terminated");
await betaLink.click();
await expect(page).toHaveURL(new RegExp(`/chats/${f.agents[1].id}$`));
await expect(page.getByText("Background activity", { exact: true })).toBeVisible();
@@ -182,10 +182,11 @@ async function assertOnlyChatExists(page: Page, companyName: string) {
expect(await agentsRes.json()).toEqual([
expect.objectContaining({ id: chats[0].conversationAgentId, name: fixtureAgentName }),
]);
const contacts = page.getByRole("navigation", { name: "Agent conversations" }).getByRole("link");
await expect(contacts).toHaveCount(1);
const contacts = page.getByRole("navigation", { name: "Agent conversations" });
const chatLinks = contacts.getByRole("link", { name: /^Open chat with / });
await expect(chatLinks).toHaveCount(1);
await expect(contacts.getByText(fixtureAgentName, { exact: true })).toBeVisible();
await expect(contacts).toHaveAttribute("aria-current", "page");
await expect(chatLinks).toHaveAttribute("aria-current", "page");
await expect(page.getByTestId("task-chat-composer-add")).toBeVisible();
}
+16 -10
View File
@@ -27,6 +27,7 @@ export interface AgentConversationSidebarProps {
onRetry?: () => void;
initialSearch?: string;
onSelect?: (agent: Agent, signal?: AbortSignal) => void | Promise<void>;
onOpenOverview?: () => void;
onBrowse?: () => void;
onAddChat?: (agent: Agent, signal?: AbortSignal) => void | Promise<void>;
historyLoading?: boolean;
@@ -42,7 +43,7 @@ const NO_PINNED_AGENTS: readonly string[] = [];
const contactRowClassName = "agent-pin-row agent-contact-pin-row group/agent-pin relative rounded-md";
/** Searchable navigation for one conversation per agent. */
export function AgentConversationSidebar({ agents, compact = false, mobileSwitcher = false, existingChatAgentIds, availableAgents = agents, activeId, activeAgent: providedActiveAgent, previews = {}, unreadAgentIds = [], unreadMessageCounts, loading = false, error, onRetry, initialSearch = "", onSelect, onBrowse, onAddChat, historyLoading, historyError, onRetryHistory, onCreateAgent, renderAgentAction, pinnedAgentIds = NO_PINNED_AGENTS, onReorderPins }: AgentConversationSidebarProps) {
export function AgentConversationSidebar({ agents, compact = false, mobileSwitcher = false, existingChatAgentIds, availableAgents = agents, activeId, activeAgent: providedActiveAgent, previews = {}, unreadAgentIds = [], unreadMessageCounts, loading = false, error, onRetry, initialSearch = "", onSelect, onOpenOverview, onBrowse, onAddChat, historyLoading, historyError, onRetryHistory, onCreateAgent, renderAgentAction, pinnedAgentIds = NO_PINNED_AGENTS, onReorderPins }: AgentConversationSidebarProps) {
const navigate = useNavigate();
const [pickerOpen, setPickerOpen] = useState(false);
const [search, setSearch] = useState(initialSearch);
@@ -167,19 +168,24 @@ export function AgentConversationSidebar({ agents, compact = false, mobileSwitch
const unreadCount = unreadMessageCounts?.get(agent.id) ?? 0;
const hasUnread = unreadCount > 0 || unreadIds.has(agent.id);
const canReorder = pinnedIds.has(agent.id) && !!onReorderPins;
const content = <><Link to={`/chats/${encodeURIComponent(agent.status === "terminated" ? agent.id : agentRouteRef(agent))}`}
aria-current={activeId === agent.id ? "page" : undefined}
title={`${agent.name}${agent.title ? ` · ${agent.title}` : ""}`}
onClick={event => { if (onSelect) { event.preventDefault(); onSelect(agent); } }}
className={cn("agent-contact-row flex min-w-0 items-center gap-3 rounded-md px-2.5 py-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring", renderAgentAction && hasUnread && "pr-12", canReorder && "pr-20", activeId === agent.id ? "bg-accent text-accent-foreground" : "group-hover/agent-pin:bg-accent/60 group-focus-within/agent-pin:bg-accent/60")}>
<AgentAvatar agent={agent} size={40} />
<span className="agent-pin-text flex min-w-0 flex-1 flex-col gap-0.5">
<span className="truncate text-sm font-medium">{agent.name}</span>
const routeRef = encodeURIComponent(agent.status === "terminated" ? agent.id : agentRouteRef(agent));
const content = <><div className={cn("agent-contact-row relative flex min-w-0 items-center gap-3 rounded-md px-2.5 py-3 text-left transition-colors", renderAgentAction && hasUnread && "pr-12", canReorder && "pr-20", activeId === agent.id ? "bg-accent text-accent-foreground" : "group-hover/agent-pin:bg-accent/60 group-focus-within/agent-pin:bg-accent/60")}>
<Link to={`/chats/${routeRef}`}
aria-label={`Open chat with ${agent.name}`}
aria-current={activeId === agent.id ? "page" : undefined}
title={`${agent.name}${agent.title ? ` · ${agent.title}` : ""}`}
onClick={event => { if (onSelect) { event.preventDefault(); onSelect(agent); } }}
className="shrink-0 after:absolute after:inset-0 after:rounded-md focus-visible:outline-none focus-visible:after:ring-2 focus-visible:after:ring-inset focus-visible:after:ring-ring">
<AgentAvatar agent={agent} size={40} />
</Link>
<span className="agent-pin-text pointer-events-none relative flex min-w-0 flex-1 flex-col gap-0.5">
<Link to={`/agents/${routeRef}/overview`} onClick={onOpenOverview} aria-label={`View overview for ${agent.name}`}
className="pointer-events-auto max-w-full self-start truncate text-sm font-medium hover:underline focus-visible:underline">{agent.name}</Link>
<span className="truncate text-xs text-muted-foreground">{agent.status === "terminated" ? "Terminated" : agent.title ?? agent.role}</span>
</span>
{unreadCount > 0 ? <Badge variant="ghost" aria-label={`${unreadCount} unread ${unreadCount === 1 ? "message" : "messages"} from ${agent.name}`} className="shrink-0 bg-primary font-mono tabular-nums text-primary-foreground">{unreadCount}</Badge>
: unreadIds.has(agent.id) && <span role="img" aria-label={`Unread messages from ${agent.name}`} className="size-2 shrink-0 rounded-full bg-primary" />}
</Link>{renderAgentAction?.(agent)}</>;
</div>{renderAgentAction?.(agent)}</>;
return <SortablePinnedRow key={agent.id} id={agent.id} label={agent.name} disabled={!canReorder} className={contactRowClassName}
data-selected={activeId === agent.id || undefined} data-has-unread={hasUnread || undefined}
handleClassName="agent-chat-pin right-2 size-8 focus-visible:outline-none group-hover/agent-pin:opacity-100 group-focus-within/agent-pin:opacity-100" handleIconClassName="size-4">{content}</SortablePinnedRow>;
@@ -97,6 +97,7 @@ export function AgentConversationsSidebar({ compact = false, mobileSwitcher = fa
historyError={historyAgents.find(result => queryViewKind(result) === "error")?.error}
onRetryHistory={() => { historyAgents.filter(result => result.isError).forEach(result => { void result.refetch(); }); }}
onAddChat={compact || mobileSwitcher ? undefined : openChat}
onOpenOverview={isMobile ? () => setSidebarOpen(false) : undefined}
onSelect={agent => {
navigate(`/chats/${encodeURIComponent(agent.status === "terminated" ? agent.id : agentRouteRef(agent))}`);
if (isMobile) setSidebarOpen(false);