Repository navigation
feat(site/src/pages/AgentsPage/components): add the overview card container - #31590
Merged
Merged
Conversation
This was referenced Oct 30, 2026
ThomasK33
marked this pull request as ready for review
October 30, 2026 22:41
ThomasK33
added a commit
that referenced
this pull request
Nov 10, 2026
…d view (#31409) Adds `ChatOverviewCardView`, a small card that lists a chat's cost, its repositories with their uncommitted line counts, the pull requests, and the attachments. Nothing mounts the view yet, so this PR changes no page. #31412 mounts it in the chat's top-right corner while the right panel is closed. A row calls `onOpenTarget({ tabId })` with the right panel tab that holds its details: **Summary** for cost and attachments, **Git** for repositories and pull requests. A repository row shows the repository's folder name, with its branch below it, or "No branch" when HEAD is on no branch. A repository without uncommitted changes shows `+0 −0` as plain text, with no hover state and no click, because the Git panel has nothing to show for it. A button row's label truncates in the 16rem card. When the label or subtitle is cut off, a tooltip shows it in full on hover and on keyboard focus. A row that fits gets no tooltip, so a screen reader does not hear its text twice. The plain-text row wraps instead, and it takes no tab stop. Long lists show three rows and a toggle that names the section, such as "Show all 5 repositories" and "Show fewer repositories". While the card is empty and loading, it shows skeleton rows in a `status` region that reads "Loading overview", and the card is marked `aria-busy`. The card has no animation. The code comes from the prototype in #31260 (do not merge), adapted to the `MessageAttachment` type from #31140. #31260 stays the hands-on reference for the whole card. The card with a long list, where the third repository has no branch:  The expanded list, and a clean repository without cost:   A repository row whose branch is cut off, on hover:  The loading state:  ## How to test 1. Open Storybook at `pages/AgentsPage/ChatOverviewCardView` and step through the stories. `TruncatedRowTooltip` hovers a repository row whose branch is cut off. 2. Run `pnpm exec vitest run --project=unit src/pages/AgentsPage/components/ChatOverviewCardView.test.tsx` in `site/`. The tests check the target each row sends, that a clean repository row is not a button, that a truncated row's tooltip opens on hover, that a row that fits gets no tooltip, and that Tab skips a clean repository row. ## What to look at first 1. `OverviewRow`: one row renders as a button with `onClick`, or as plain text without it, inside the shared `Tooltip`. 2. `OverviewListSection`: the shared "title, first three rows, toggle" list for Repositories, Pull requests, and Attachments. 3. `hasChanges` and `RepoDiffStat`: the clean repository rule lives in one predicate. <details> <summary>Review history</summary> Review follow-up: the Changes section listed repositories but labeled each row with its branch, so two repositories on the same branch looked the same, and the toggle counted repositories as changes. The section is now **Repositories**: each row shows the repository name, with the branch (or "No branch") as the subtitle and a repository icon. The view model gained `name`, and #31590 fills it. The stack above was updated by merges. The repository's frontend-deep-review ran three rounds on the first version, then one strict code quality review ran, then a polish pass and one final review round (a code quality review plus frontend-deep-review) ran on the whole stack. Polish pass changes in this PR: - Renamed the file to `ChatOverviewCardView.tsx`. The container lives in `ChatOverviewCard.tsx` in #31590 and the toggle joins it in #31412, like `AgentChatPage` and `AgentChatPageView`. - `onOpenTab(tab)` became `onOpenTarget({ tabId })`, so #31478 only adds a Git view to the target. The existing row test now expects `{ tabId: tab }` instead of `tab`. That is the only changed assertion, and it follows the rename. - Added `OverviewListSection`, `RepoDiffStat`, and `hasChanges`. - Clean repository rows became plain text. Before, a click opened the default Git view. The new test "opens nothing from a repository without changes" fails without this change. Final round fixes: folded `OverviewList` into `OverviewListSection`, named the clean repository check `hasChanges`, made `getCostSubtitle` return `undefined` instead of an empty string, and shortened the card's doc comment. Accessibility review from Jaayden (four threads) and an audit against site/AGENTS.md "Accessibility and robustness", FE6 and the frontend-deep-review SA6 checkpoint: - The clean repository row is plain text again: no `tabIndex`, no tooltip, no `oxlint` exception, and its label wraps. This reverses the follow-up fix below. The keyboard test now checks that Tab skips the row and lands on the next button, found by role. - The loading state uses skeleton rows in `role="status"` with screen reader text, and the card gets `aria-busy`. - The list toggle drops `aria-expanded` and names the section in its visible label. - The tooltip opens only when the text is truncated, measured with a `ResizeObserver` as the Git panel does for its PR title. New test: "adds no tooltip to a row whose label fits". - New story `TruncatedRowKeyboardFocus` screenshots the focus ring and the tooltip from the keyboard. - Declined from the audit: `aria-expanded` on the toggle (the review asked for one state signal), moving focus after a subagent link opens another chat (the sidebar chat links behave the same way), and moving focus when the window shrinks below 84rem while focus is in the card (rare). - Declined from the advisor: `useCallback` for the measuring ref. The React Compiler memoizes it, and the frontend rules forbid manual memoization in compiled folders. - I merged `origin/main` into this branch and carried it up the stack by merges, without a force push. Follow-up fixes, after the final round: - Added the row tooltip, with the shared `Tooltip` primitive. The plain-text row gets `tabIndex={0}` and an `oxlint` exception with its reason, as `SecretsTable.tsx` does, so the keyboard can open its tooltip. Its earlier "no focus" behavior changes for that reason only. - Two new tests check the tooltip through the row's accessible description, by hover and by keyboard. Each fails when the tooltip stays closed. The test file now renders with `renderComponent`, which adds the tooltip provider. No existing assertion changed. - New story `TruncatedRowTooltip` gives the open tooltip a screenshot. - The PR grew to 605 changed lines, most of them stories and tests. I kept it in one PR. Skipped in the polish pass: - A cost model that carries `coversWholeTree`. It moves a conditional into the container and changes the tested `getOverviewCost` contract without deleting a branch. - A shared helper for the unpriced-requests sentence. The two copies are short and use different punctuation, and the helper would touch `ChatSummary` in an unrelated PR. - A `CostRow` component from the final round. It overlaps the cost model item above and saves about three lines. Declined in earlier rounds: - Story fixture factories (`mockRepo`, `mockAttachment`) instead of named `Mock*` constants. They build view-model rows for one component, not shared API entities. - Stories for the "Pull request" and attachment name fallbacks, and for merged, closed, and draft pull request icons. `getPRIconConfig` and `getAttachmentDisplayName` are shared helpers with their own coverage. - A fallback label in the view for an empty branch name. The container passes `repoBranchLabel(root, repo)`, the same label as the Git panel. - A loading line while some sections already show data. Sections render as their data arrives, by design. </details> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_ --------- Co-authored-by: Jaayden Halko <jaayden.halko@gmail.com>
jaaydenh
added a commit
that referenced
this pull request
Nov 17, 2026
…t view helpers with the overview card (#31411) 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 | |---|---| |  |  | ## 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. <details> <summary>Review history</summary> 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. </details> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_ --------- Co-authored-by: Jaayden Halko <jaayden.halko@gmail.com>
jaaydenh
force-pushed
the
tk/overview-card-container
branch
from
November 17, 2026 06:24
49b39ed to
f75e10e
Compare
…ntainer story to its error state
…nd branch to the overview card The card now labels each repository row with its folder name and shows the branch as the subtitle, so the container passes both values instead of one branch-or-folder label.
jaaydenh
force-pushed
the
tk/overview-card-container
branch
from
November 18, 2026 06:14
f75e10e to
fdc606e
Compare
…emoved hydration state Main's #30478 removed isHydratingMessages from useChatAttachments and replaceMessages from the chat store, so the container no longer type checked after the rebase.
jaaydenh
approved these changes
Nov 18, 2026
jaaydenh
had a problem deploying
to
docs-preview
November 18, 2026 11:42 — with
GitHub Actions
Failure
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
ChatOverviewCard, the container that builds the overview card's data and rendersChatOverviewCardViewfrom #31409. Nothing mounts it yet, so this PR changes no page. #31412 mounts it in the chat.The container reads the chat cost query, the git watcher's repositories, the pull request statuses, the subagent statuses, and the attachments from
useChatAttachments(#31411).getOverviewCostturns the cost query into the card's three cost states. When the earlier attachments fail to load, the container passes the request to the view. Attachments then shows the same one-line "Failed to get attachments" alert with a Retry button as the Summary panel.I split this PR out of #31412 when that PR grew past 600 changed lines. The code is the same container that #31412 reviewed before, without the top bar toggle, which stays in #31412 with its only caller.
DefaultEarlierAttachmentsErrorHow to test
pages/AgentsPage/ChatOverviewCard, storiesDefaultandEarlierAttachmentsError.pnpm test src/pages/AgentsPage/components/ChatOverviewCard.test.tsxinsite/. The page test in feat: show the overview card in Coder Agents chats #31412 checks that Retry requests the earlier attachments again.What to look at first
ChatOverviewCard: one place builds theChatOverviewmodel from the queries and the chat store.getOverviewCost: a failed refetch keeps the cost that loaded, and a chat without AI Gateway requests has no cost row.Review history
This container was reviewed as part of #31412 through three frontend-deep-review rounds, a code quality review, a polish pass, and a final review round. It moved here in the follow-up pass that fixed the open follow-ups:
earlierAttachmentsRequestto the view, so a failed request shows its error and a retry.GitPanel/gitViews.tsexportscountRepoChangeshere, where its first caller arrives.namefromrepoLabel(root)and its trimmedbranch, which the view shows as the subtitle, or "No branch" when it is empty.playassertions, because the page test in feat: show the overview card in Coder Agents chats #31412 covers the retry request.After #31411 merged, this branch was rebased onto
mainwith no conflicts and now targetsmain. It picks up the smallerAttachmentsErrorAlertfrom #31411 without code changes here, so the screenshots above are new.Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high