Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
a49cf72
feat(site/src/pages/AgentsPage/components): add the chat overview car…
ThomasK33 Oct 28, 2026
e9a38fc
refactor(site/src/pages/AgentsPage): move the chat attachments list i…
ThomasK33 Oct 28, 2026
6b9ff82
feat(site/src/pages/AgentsPage/components): list non-idle subagents i…
ThomasK33 Oct 28, 2026
589489d
refactor(site/src/pages/AgentsPage): keep the earlier attachments sta…
ThomasK33 Oct 30, 2026
1b24a9e
Merge remote-tracking branch 'origin/main' into tk/overview-card-view
ThomasK33 Oct 30, 2026
df57d0b
Merge branch 'tk/overview-card-view' into tk/overview-card-subagents
ThomasK33 Oct 30, 2026
8bdf929
Merge branch 'tk/overview-card-subagents' into tk/overview-card-share
ThomasK33 Oct 30, 2026
5030bf4
Merge remote-tracking branch 'origin/main' into tk/overview-card-view
ThomasK33 Oct 30, 2026
7875cc9
Merge branch 'tk/overview-card-view' into tk/overview-card-subagents
ThomasK33 Oct 30, 2026
f36c610
Merge branch 'tk/overview-card-subagents' into tk/overview-card-share
ThomasK33 Oct 30, 2026
51271f8
refactor(site/src/pages/AgentsPage/components): tidy the overview car…
ThomasK33 Oct 30, 2026
6875cf7
Merge branch 'tk/overview-card-view' into tk/overview-card-subagents
ThomasK33 Oct 30, 2026
4366305
Merge branch 'tk/overview-card-subagents' into tk/overview-card-share
ThomasK33 Oct 30, 2026
636cf24
refactor(site/src/pages/AgentsPage/components): move the Git view hel…
ThomasK33 Oct 30, 2026
8b84d88
refactor(site/src/pages/AgentsPage/components): fold the overview lis…
ThomasK33 Oct 30, 2026
48b6a31
Merge branch 'tk/overview-card-view' into tk/overview-card-subagents
ThomasK33 Oct 30, 2026
88ab0a1
Merge branch 'tk/overview-card-subagents' into tk/overview-card-share
ThomasK33 Oct 30, 2026
a511fec
refactor(site/src/pages/AgentsPage): name the earlier attachments req…
ThomasK33 Oct 30, 2026
3009400
feat(site/src/pages/AgentsPage/components): show truncated overview c…
ThomasK33 Oct 30, 2026
bd33fcd
Merge branch 'tk/overview-card-view' into tk/overview-card-subagents
ThomasK33 Oct 30, 2026
c8e64da
Merge branch 'tk/overview-card-subagents' into tk/overview-card-share
ThomasK33 Oct 30, 2026
f2f153c
feat(site/src/pages/AgentsPage): show a failed earlier attachments re…
ThomasK33 Oct 30, 2026
0909bcf
test(site/src/pages/AgentsPage/components): assert the overview row t…
ThomasK33 Oct 30, 2026
b120a00
Merge branch 'tk/overview-card-view' into tk/overview-card-subagents
ThomasK33 Oct 30, 2026
f8e03c9
Merge branch 'tk/overview-card-subagents' into tk/overview-card-share
ThomasK33 Oct 30, 2026
85f4dfe
test(site/src/pages/AgentsPage/components): assert the overview card …
ThomasK33 Oct 30, 2026
deb386a
chore(site/src/pages/AgentsPage/components): trim non-essential overv…
jaaydenh Nov 3, 2026
4236f7e
Merge remote-tracking branch 'origin/main' into tk/overview-card-view
ThomasK33 Nov 3, 2026
45968e2
fix(site/src/pages/AgentsPage/components): address the overview card …
ThomasK33 Nov 3, 2026
87d5353
Merge branch 'tk/overview-card-view' into tk/overview-card-subagents
ThomasK33 Nov 3, 2026
428bd25
Merge branch 'tk/overview-card-subagents' into tk/overview-card-share
ThomasK33 Nov 3, 2026
6bd8c9c
test(site/src/pages/AgentsPage/components): add a keyboard focus stor…
ThomasK33 Nov 3, 2026
8d02902
Merge branch 'tk/overview-card-view' into tk/overview-card-subagents
ThomasK33 Nov 3, 2026
114d446
Merge branch 'tk/overview-card-subagents' into tk/overview-card-share
ThomasK33 Nov 3, 2026
11931d1
fix(site/src/pages/AgentsPage/components): name the overview list tot…
ThomasK33 Nov 3, 2026
755379a
Merge branch 'tk/overview-card-view' into tk/overview-card-subagents
ThomasK33 Nov 3, 2026
68ec131
Merge branch 'tk/overview-card-subagents' into tk/overview-card-share
ThomasK33 Nov 3, 2026
d58894a
test(site/src/pages/AgentsPage/components): find the next tab stop by…
ThomasK33 Nov 3, 2026
a4f2cbd
Merge branch 'tk/overview-card-view' into tk/overview-card-subagents
ThomasK33 Nov 3, 2026
fb9a18c
Merge branch 'tk/overview-card-subagents' into tk/overview-card-share
ThomasK33 Nov 3, 2026
b782c13
chore: update overview card styling
jaaydenh Nov 4, 2026
07032ee
refactor(site/src/pages/AgentsPage/components): replace negative marg…
jaaydenh Nov 4, 2026
451d0af
feat(site/src/pages/AgentsPage/components): list repositories by name…
jaaydenh Nov 8, 2026
4782f01
fix(site/src/pages/AgentsPage/components): label branchless repositor…
jaaydenh Nov 8, 2026
bc228df
Merge branch 'tk/overview-card-view' into tk/overview-card-subagents
jaaydenh Nov 8, 2026
530a700
Merge branch 'tk/overview-card-subagents' into tk/overview-card-share
jaaydenh Nov 8, 2026
537adbf
Merge remote-tracking branch 'origin/main' into tk/overview-card-share
jaaydenh Nov 13, 2026
90be464
chore: create smaller error alert
jaaydenh Nov 16, 2026
89c4e21
fix(site/src/pages/AgentsPage/components): wait for the failed retry …
jaaydenh Nov 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { fn } from "storybook/test";
import { AttachmentsErrorAlert } from "./AttachmentsErrorAlert";

const meta: Meta<typeof AttachmentsErrorAlert> = {
title: "pages/AgentsPage/AttachmentsErrorAlert",
component: AttachmentsErrorAlert,
args: {
isRetrying: false,
onRetry: fn(),
},
};

export default meta;
type Story = StoryObj<typeof AttachmentsErrorAlert>;

const overviewCardWidth = (Story: React.FC) => (
<div className="w-64 p-1.5">
<Story />
</div>
);

export const OverviewCard: Story = {
decorators: [overviewCardWidth],
};

export const OverviewCardRetrying: Story = {
args: { isRetrying: true },
decorators: [overviewCardWidth],
};

export const AttachmentsList: Story = {
decorators: [
(Story) => (
<div className="w-90 p-4">
<Story />
</div>
),
],
};
41 changes: 41 additions & 0 deletions site/src/pages/AgentsPage/components/AttachmentsErrorAlert.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { cn } from "cn";
import { ErrorAlert } from "#/components/Alert/ErrorAlert";
import { RetryButton } from "./RetryButton";

type AttachmentsErrorAlertProps = {
isRetrying: boolean;
onRetry: () => void;
className?: string;
};

/**
* One line, because the attachments request error is too tall for the
* overview card and the attachments list. The request message wraps, and
* ErrorAlert also renders the error detail and stack trace.
*/
export const AttachmentsErrorAlert: React.FC<AttachmentsErrorAlertProps> = ({
isRetrying,
onRetry,
className,
}) => (
<ErrorAlert
error="Failed to get attachments"
showDebugDetail={false}
className={cn(
"p-2",
// Alert stacks its message and actions. These pull them onto one row.
"[&>div>div]:items-center",
"[&>div>div>div]:flex-row [&>div>div>div]:items-center [&>div>div>div]:gap-2",
"[&_h2]:text-xs [&_svg]:mt-0 [&_svg]:size-3.5",
className,
)}
actions={
<RetryButton
variant="outline"
size="xs"
isRetrying={isRetrying}
onRetry={onRetry}
/>
}
/>
);
15 changes: 2 additions & 13 deletions site/src/pages/AgentsPage/components/ChatAttachments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { FileIcon } from "lucide-react";
import { useId } from "react";
import { useQueries } from "react-query";
import { chatFileText } from "#/api/queries/chats";
import { ErrorAlert } from "#/components/Alert/ErrorAlert";
import { ChevronDownIcon } from "#/components/AnimatedIcons/ChevronDown";
import {
Collapsible,
CollapsibleContent,
CollapsibleTrigger,
} from "#/components/Collapsible/Collapsible";
import { Spinner } from "#/components/Spinner/Spinner";
import { AttachmentsErrorAlert } from "./AttachmentsErrorAlert";
import {
expiredAttachmentExplanation,
getAttachmentDisplayName,
Expand All @@ -20,7 +20,6 @@ import {
MessageAttachmentCard,
} from "./ChatConversation/MessageAttachmentCard";
import type { MessageAttachment } from "./ChatConversation/messageHelpers";
import { RetryButton } from "./RetryButton";
import { SectionHeader } from "./SectionHeader";

type ChatAttachmentsProps = {
Expand Down Expand Up @@ -95,17 +94,7 @@ export const ChatAttachments: React.FC<ChatAttachmentsProps> = ({
</p>
)}
{earlierAttachmentsError ? (
<ErrorAlert
error={earlierAttachmentsError}
actions={
<RetryButton
variant="outline"
size="sm"
isRetrying={isRetrying}
onRetry={onRetry}
/>
}
/>
<AttachmentsErrorAlert isRetrying={isRetrying} onRetry={onRetry} />
) : null}
</CollapsibleContent>
</Collapsible>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { Meta, StoryObj } from "@storybook/react-vite";
import { fn, userEvent, within } from "storybook/test";
import type { ChatStatus } from "#/api/typesGenerated";
import { MockChatDiffStatus } from "#/testHelpers/chatEntities";
import { mockApiError } from "#/testHelpers/entities";
import type { MessageAttachment } from "./ChatConversation/messageHelpers";
import {
type ChatOverview,
Expand Down Expand Up @@ -126,6 +127,16 @@ export const CostUnavailable: Story = {
},
};

export const EarlierAttachmentsError: Story = {
args: {
earlierAttachmentsRequest: {
error: mockApiError({ message: "Failed to get chat attachments." }),
isRetrying: false,
retry: fn(),
},
},
};

export const NoCostCleanRepo: Story = {
args: {
overview: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,24 @@ describe("ChatOverviewCardView", () => {
expect(row).toHaveAccessibleDescription("Find the flake"),
);
});

it("shows a failed earlier attachments request with a retry", async () => {
const user = userEvent.setup();
const retry = vi.fn();
render(
<ChatOverviewCardView
overview={{ ...mockChatOverview, attachments: [] }}
earlierAttachmentsRequest={{
error: new Error("Failed to get chat attachments."),
isRetrying: false,
retry,
}}
onOpenTarget={vi.fn()}
/>,
);

const section = screen.getByRole("region", { name: "Attachments" });
await user.click(within(section).getByRole("button", { name: "Retry" }));
expect(retry).toHaveBeenCalledOnce();
});
});
48 changes: 33 additions & 15 deletions site/src/pages/AgentsPage/components/ChatOverviewCardView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@ import {
TooltipTrigger,
} from "#/components/Tooltip/Tooltip";
import { formatCostMicros } from "#/utils/currency";
import type { EarlierAttachmentsRequest } from "../hooks/useChatAttachments";
import { buildAgentChatPath } from "../utils/navigation";
import { AttachmentsErrorAlert } from "./AttachmentsErrorAlert";
import { getAttachmentDisplayName } from "./ChatConversation/AttachmentBlocks";
import type { MessageAttachment } from "./ChatConversation/messageHelpers";
import {
getChatStatusDisplay,
getPRIconConfig,
} from "./ChatsSidebar/tree/statusConfig";
import { DiffStatBadge } from "./DiffViewer/DiffStats";
import type { DiffStats } from "./GitPanel/gitViews";

const OVERVIEW_MAX_LIST_ROWS = 3;
/**
Expand All @@ -44,14 +47,12 @@ export type OverviewTarget = { tabId: "summary" } | { tabId: "git" };

type OverviewSubagent = Pick<Chat, "id" | "title" | "status">;

type OverviewRepo = {
type OverviewRepo = DiffStats & {
root: string;
/** The row label. `root` stays the row's key, so names may repeat. */
name: string;
/** Empty when HEAD is on no branch, such as a detached HEAD. */
branch: string;
additions: number;
deletions: number;
};

/** Card data. Empty lists and an absent cost hide their sections. */
Expand All @@ -76,6 +77,11 @@ export type ChatOverview = {
type ChatOverviewCardViewProps = {
overview: ChatOverview;
isLoading?: boolean;
/** A failed request shows its error and a retry in Attachments. */
earlierAttachmentsRequest?: Pick<
EarlierAttachmentsRequest,
"error" | "isRetrying" | "retry"
>;
onOpenTarget: (target: OverviewTarget) => void;
className?: string;
};
Expand All @@ -87,6 +93,7 @@ type ChatOverviewCardViewProps = {
export const ChatOverviewCardView: React.FC<ChatOverviewCardViewProps> = ({
overview,
isLoading = false,
earlierAttachmentsRequest,
onOpenTarget,
className,
}) => {
Expand All @@ -97,7 +104,8 @@ export const ChatOverviewCardView: React.FC<ChatOverviewCardViewProps> = ({
overview.repos.length === 0 &&
overview.pullRequests.length === 0 &&
overview.subagents.length === 0 &&
overview.attachments.length === 0;
overview.attachments.length === 0 &&
!earlierAttachmentsRequest?.error;

return (
<aside
Expand Down Expand Up @@ -210,7 +218,15 @@ export const ChatOverviewCardView: React.FC<ChatOverviewCardViewProps> = ({
onClick={() => onOpenTarget({ tabId: "summary" })}
/>
)}
/>
>
{earlierAttachmentsRequest?.error ? (
<AttachmentsErrorAlert
className="mt-1"
isRetrying={earlierAttachmentsRequest.isRetrying}
onRetry={earlierAttachmentsRequest.retry}
/>
) : null}
</OverviewListSection>
</aside>
);
};
Expand Down Expand Up @@ -275,13 +291,11 @@ const getCostSubtitle = (overview: ChatOverview): string | undefined => {
return parts.length > 0 ? parts.join(" · ") : undefined;
};

type RepoChanges = Pick<OverviewRepo, "additions" | "deletions">;

const hasChanges = ({ additions, deletions }: RepoChanges) =>
const hasChanges = ({ additions, deletions }: DiffStats) =>
additions > 0 || deletions > 0;

/** A clean repository shows +0 −0, where the shared badge shows nothing. */
const RepoDiffStat: React.FC<RepoChanges> = (changes) =>
const RepoDiffStat: React.FC<DiffStats> = (changes) =>
hasChanges(changes) ? (
<DiffStatBadge {...changes} />
) : (
Expand Down Expand Up @@ -310,24 +324,27 @@ const OverviewSection: React.FC<OverviewSectionProps> = ({
);
};

type OverviewListSectionProps<T> = {
type OverviewListSectionProps<T> = React.PropsWithChildren<{
title: string;
items: readonly T[];
render: (item: T) => React.ReactNode;
};
}>;

/**
* The toggle stays rendered in both states, so keyboard focus stays on it.
* Its label names the section, so a screen reader's list of buttons tells
* the toggles apart.
* A titled list, or nothing when the list and `children` are empty. It
* shows the first rows and a toggle for the rest, then `children`. The toggle
* stays rendered in both states, so keyboard focus stays on it. Its label
* names the section, so a screen reader's list of buttons tells the toggles
* apart.
*/
const OverviewListSection = <T,>({
title,
items,
render,
children,
}: OverviewListSectionProps<T>) => {
const [expanded, setExpanded] = useState(false);
if (items.length === 0) {
if (items.length === 0 && !children) {
return null;
}
const hiddenCount = items.length - OVERVIEW_MAX_LIST_ROWS;
Expand All @@ -345,6 +362,7 @@ const OverviewListSection = <T,>({
: `Show all ${items.length} ${title.toLowerCase()}`}
</button>
)}
{children}
</OverviewSection>
);
};
Expand Down
30 changes: 14 additions & 16 deletions site/src/pages/AgentsPage/components/ChatSummaryPanel.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
MockChatFileMetadata,
MockChatMessage,
} from "#/testHelpers/chatEntities";
import { createDeferred } from "#/testHelpers/deferred";
import { mockApiError } from "#/testHelpers/entities";
import { MockPngBase64 } from "#/testHelpers/files";
import { withDashboardProvider } from "#/testHelpers/storybook";
Expand Down Expand Up @@ -337,13 +338,6 @@ export const EarlierAttachmentsFailed: Story = {
{ key: chatCostTreeKey(MockChat.id), data: mockCost },
],
},
// The alert pushes Retry below the panel frame's fold.
play: async ({ canvasElement }) => {
const retry = await within(canvasElement).findByRole("button", {
name: "Retry",
});
retry.scrollIntoView();
},
};

export const EarlierAttachmentsRetrying: Story = {
Expand Down Expand Up @@ -400,12 +394,6 @@ export const EarlierAttachmentsRefetchAfterFailedRetry: Story = {
beforeEach: () => {
spyOn(API.experimental, "getChatAttachments")
.mockRejectedValueOnce(mockAttachmentsError)
.mockRejectedValueOnce(
mockApiError({
message: "Failed to get chat attachments.",
detail: "context deadline exceeded",
}),
)
.mockReturnValue(new Promise(() => {}));
},
render: renderWithLatestMessages,
Expand All @@ -416,9 +404,19 @@ export const EarlierAttachmentsRefetchAfterFailedRetry: Story = {
],
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await userEvent.click(await canvas.findByRole("button", { name: "Retry" }));
await canvas.findByText("context deadline exceeded");
const retry = await within(canvasElement).findByRole("button", {
name: "Retry",
});
// The alert text is the same before and after the Retry, so hold the
// Retry response to wait for the button to disable, then re-enable.
const retryResponse = createDeferred<TypesGen.ChatAttachmentsResponse>();
spyOn(API.experimental, "getChatAttachments").mockReturnValueOnce(
retryResponse.promise,
);
await userEvent.click(retry);
await waitFor(() => expect(retry).toBeDisabled());
retryResponse.reject(mockAttachmentsError);
await waitFor(() => expect(retry).toBeEnabled());
onlineManager.setOnline(false);
onlineManager.setOnline(true);
},
Expand Down
Loading
Loading