Skip to content

feat(site/src/pages/AgentsPage): share the attachments request and Git view helpers with the overview card - #31411

Merged
jaaydenh merged 49 commits into
mainfrom
tk/overview-card-share
Nov 17, 2026
Merged

jaaydenh merged 49 commits into
mainfrom
tk/overview-card-share

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Moves two pieces of shared logic out of their single owners, so the overview card container in #31590 can read them without copies, and lets the card view show a failed attachments request. The Git panel behaves as before. The Summary panel behaves as before except for its failed attachments request, which now shows the same one-line alert as the card.

  1. hooks/useChatAttachments.ts takes the Summary panel's attachment list: the files in the loaded messages, then the server's chatAttachments list for the messages before them. It also owns the request state and the retry (earlierAttachmentsRequest). The card and the panel read the same React Query key, so the earlier-attachments request runs once.
  2. components/GitPanel/gitViews.ts is a pure module for GitView, viewIdFor, DiffStats, computeRepoStats, repoLabel, and repoBranchLabel. GitPanel imports them, and RepoHeader uses repoBranchLabel instead of its inline branch label. The card view types its repository rows with DiffStats.
  3. The card view takes earlierAttachmentsRequest. When the request fails, Attachments shows the error and a Retry button. The section shows even when no attachment loaded, and the card no longer says "Nothing to show yet" then.
  4. The new AttachmentsErrorAlert renders that error in both the card and the Summary panel. The full ErrorAlert was too tall for both: the server message wrapped, and the panel pushed Retry below its fold. The new alert is one row with a fixed "Failed to get attachments" message, no debug detail, and an extra-small Retry button.
Overview card Summary panel
The overview card with a failed earlier attachments request The Summary panel with a failed earlier attachments request

How to test

  1. Run pnpm test src/pages/AgentsPage/components/ChatSummaryPanel.test.tsx src/pages/AgentsPage/components/ChatOverviewCardView.test.tsx src/pages/AgentsPage/components/GitPanel/GitPanel.test.tsx in site/.
  2. In Storybook, open GitPanel. Nothing changes visually. Open ChatSummaryPanel. Only the EarlierAttachments* stories with a failed request change, to the one-line alert.
  3. Open ChatOverviewCardView, story EarlierAttachmentsError, and AttachmentsErrorAlert for the new alert at the card width (idle and retrying) and the list width.

What to look at first

  1. The retry state in useChatAttachments. A retry clears the error of a query with no data, so the hook keeps the failed error until the retry settles. The test "keeps the failure and its retry button while the retry runs" fails without this.
  2. AttachmentsErrorAlert lays the message and Retry on one row with child selectors ([&>div>div], [&>div>div>div]) on Alert's internal markup. A change to Alert's nesting would undo the layout, which the AttachmentsErrorAlert stories would catch. The alert also no longer shows the server's error message.
  3. computeRepoStats in gitViews.ts drops the if (!repo.unified_diff) continue branch. An empty diff counts zero lines and stays out of the map, so the result is the same.
Review history

Follow-up fix: the card view shows a failed earlier attachments request with a retry. useChatAttachments exports its EarlierAttachmentsRequest type for the view, and OverviewListSection takes children after its rows. A new test clicks Retry and checks the callback. It fails when the section drops its children. The PR title changed from refactor to feat for this.

Polish pass changes: added gitViews.ts and the retry test. The PR title changed from "move the chat attachments list into a hook" to cover the Git helpers.

Final round fixes: renamed the hook's earlier result to earlierAttachmentsRequest, typed the card's repository rows with DiffStats, and made the retry test assert the visible error and wait for the retry to finish.

Declined in the final round:

  • Keep computeRepoStats private in GitPanel.tsx. The requester asked for it in gitViews.ts next to the other Git view helpers.
  • Delete the retry test because the EarlierAttachmentsRetrying story covers the state. The requester asked for this test. It fails in CI when the alert disappears during the retry, while the story only changes a screenshot.
  • Pass earlierAttachmentsRequest to ChatAttachments as one prop. It saves about six lines but touches the ChatAttachments stories.

Smaller error alert: added AttachmentsErrorAlert and used it in the card and in ChatAttachments. The EarlierAttachmentsFailed story no longer scrolls Retry into view, since the alert fits the panel. The retry test no longer checks the server's error text, which the alert stopped showing. It still checks that Retry stays disabled during the retry and disappears after it.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

…d view

Add ChatOverviewCardView, the card that a later change shows in the
chat's top-right corner while the right panel is closed. It lists the
chat cost, the uncommitted changes per repository, the pull requests,
and the attachments. A row opens the matching right panel tab through
onOpenTab. A clean repository shows +0 -0, so the card has a Changes
row when AI Gateway turns cost off. Nothing mounts the view yet.
…nto a hook

Move the Summary panel's attachment list into useChatAttachments: the
files in the loaded messages, then the server's list for the messages
before them. The overview card in the next change reads the same hook,
so both show one list from one shared query. The Summary panel behaves
as before.
…n the overview card

Add a Subagents section to the overview card. It lists the subagents
that are not idle, at most five, with the ones that need the user
(error, requires action) first, so the cap never hides them. The
heading counts all subagents, so a chat whose subagents are all idle
shows "0 of N not idle" instead of the empty state. A row links to the
subagent's chat.
@ThomasK33
ThomasK33 added this pull request to stack #31413 October 28, 2026 12:44
@ThomasK33
ThomasK33 marked this pull request as ready for review October 29, 2026 14:16
@ThomasK33
ThomasK33 requested a review from a team as a code owner October 29, 2026 14:16
@ThomasK33
ThomasK33 requested a review from jaaydenh October 29, 2026 14:16
…te in useChatAttachments

The hook now owns the retry state and returns the earlier attachments
status (loading, error, retrying, retry) instead of the raw query. The
Summary panel passes it straight to ChatAttachments, and the overview
card in the next change reads the same loading flag instead of its own
copy of the rule. Behavior is unchanged.
…d view

Rename the view file to ChatOverviewCardView.tsx, so the container in a
later change can take ChatOverviewCard.tsx, as AgentChatPage does. Rows
now call onOpenTarget with a target object, so the deep links later only
add a view to it. A titled OverviewListSection replaces the repeated
"if not empty, section around a list" blocks, and RepoDiffStat holds the
+0 -0 placeholder.

A repository without changes is no longer a button: the Git panel lists
only repositories with changes, so the row had nothing to open.
Move the Subagents section into a SubagentsSection that owns the filter,
the five-row cap, and the heading, with isIdle and needsUser naming the
two status groups.
…pers into gitViews.ts

Move GitView, viewIdFor, the diff line counting, computeRepoStats, and
repoLabel out of the 900-line GitPanel component file into a pure
module, and add repoBranchLabel for the "branch or folder name" label.
The overview card in a later change reads the same helpers instead of
importing them from the component file. Also cover the Summary panel
keeping its earlier attachments failure while a retry runs. Behavior
is unchanged.
…t into its section and name the clean repository check
…uest and reuse DiffStats in the overview card
@ThomasK33 ThomasK33 changed the title refactor(site/src/pages/AgentsPage): move the chat attachments list into a hook refactor(site/src/pages/AgentsPage): share the attachment list and Git view helpers for the overview card Oct 30, 2026
# Conflicts:
#	site/src/pages/AgentsPage/components/ChatOverviewCardView.test.tsx
#	site/src/pages/AgentsPage/components/ChatOverviewCardView.tsx
ThomasK33 and others added 15 commits November 3, 2026 11:22
# Conflicts:
#	site/src/pages/AgentsPage/components/ChatOverviewCardView.tsx
…ins in the overview card with padding

The card now pads by px-1.5 and its headings, empty and loading states, and rows pad themselves, so rows no longer pull outward with -mx-1.5. Text, icons, and hover areas stay in place; section dividers run 6px closer to the card edge.
… in the overview card

The Changes section listed one row per repository but labeled each row
with its branch, so two repositories on the same branch looked the same,
and the toggle counted repositories as changes. Rename the section to
Repositories, label each row with the repository name, and show the
branch as the subtitle.
…ies in the overview card

Show "No branch" when HEAD is detached instead of an empty subtitle, use
a repository icon now that rows name repositories, and drop a test
assertion on rendered output that the tab order test already covers.
# Conflicts:
#	site/src/pages/AgentsPage/components/ChatOverviewCardView.tsx
Base automatically changed from tk/overview-card-subagents to main November 13, 2026 08:58
@jaaydenh
jaaydenh temporarily deployed to main November 13, 2026 08:58 — with GitHub Actions Inactive
@jaaydenh
jaaydenh temporarily deployed to main November 13, 2026 09:27 — with GitHub Actions Inactive
@jaaydenh
jaaydenh temporarily deployed to main November 16, 2026 14:47 — with GitHub Actions Inactive
@jaaydenh
jaaydenh temporarily deployed to main November 17, 2026 05:53 — with GitHub Actions Inactive
…without its error text

The smaller attachments alert no longer shows the request's error detail,
so EarlierAttachmentsRefetchAfterFailedRetry could not find
"context deadline exceeded" and failed in Pixel. Hold the Retry response
and wait for the button to disable and re-enable instead.
@jaaydenh
jaaydenh temporarily deployed to main November 17, 2026 06:12 — with GitHub Actions Inactive
@jaaydenh
jaaydenh merged commit 47c1357 into main Nov 17, 2026
25 of 26 checks passed
@jaaydenh
jaaydenh deleted the tk/overview-card-share branch November 17, 2026 06:24
@jaaydenh
jaaydenh temporarily deployed to main November 17, 2026 06:24 — with GitHub Actions Inactive
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 17, 2026

This branch had an error being deployed

1 failed and 1 inactive deployments
docs-preview — 89c4e219 Deployed Nov 17, 2026 by jaaydenh via cleanup #153
main — 89c4e219 Deployed Nov 17, 2026 by jaaydenh via cla #258402
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants