Skip to content

feat: show the overview card in Coder Agents chats - #31412

Merged
jaaydenh merged 91 commits into
mainfrom
tk/overview-card-mount
Nov 18, 2026
Merged

jaaydenh merged 91 commits into
mainfrom
tk/overview-card-mount

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Shows the overview card container from #31590 in Coder Agents chats. The card sits in the chat's top-right corner, and a list button in the chat top bar shows and hides it, as in the Codex desktop app. The card and the button exist only while the right panel is closed, the transcript is not full width, and the page is not an embed. Both show only from an 84rem chat, so the card never covers the transcript and the transcript never moves. Below 84rem the card does not mount, so its cost and attachment requests do not run. Phones and narrow windows do not show the card.

The card shows by default and stays open until the user hides it. The choice is stored in localStorage under agents.overview-card-open, for every chat. The right panel keeps its own saved preference. A row opens the right panel on its tab, which hides the card. The card returns when the panel closes.

The Repositories section lists every repository the git watcher reports, by folder name with its branch below. A clean repository shows +0 −0, so a chat keeps a Repositories row when AI Gateway turns cost off. The card reads the attachments through useChatAttachments from #31411, so it shows the Summary panel's list and shares its query. When the earlier attachments fail to load, the card shows the error and a Retry button in Attachments, as the Summary panel does.

The docs describe the card in the Coder Agents overview and add it to the places that show spend. #31260 (do not merge) stays the hands-on reference.

1600px chat with the card open:

1600px chat with the overview card open

1600px chat after the user hid the card:

1600px chat after the user hid the card

960px chat, no card and no button:

960px chat without the card or the button

Decision and open questions for Jaayden

Decision you can reverse: a clean repository row is plain text, not a button. The Git panel lists only repositories with changes, so a click on a clean row used to open the default Git view. To reverse it, give the clean row its onClick back in ChatOverviewCardView.

  1. Should a new chat show the card instead of the Summary panel? This PR keeps the right panel's saved preference as it is.
  2. A chat with no repository and no cost shows "Nothing to show yet". Is that the placeholder you want?
  3. Subagents (feat(site/src/pages/AgentsPage/components): list non-idle subagents in the overview card #31410): the heading says "not idle" instead of "active" because errored subagents stay in the list, and the ones that need the user sort first. Do that wording and order work for you?
  4. A row click (feat: open the exact Git view from the overview card rows #31478) moves focus to the active right panel tab. Do you prefer the Git view switcher instead?

How to test

  1. Open Storybook at pages/AgentsPage/AgentChatPageView, stories OverviewCardBesideTranscript, OverviewCardHiddenWhenNarrow, OverviewCardHiddenInFullWidth, and OverviewCardHiddenByUser.
  2. Run pnpm exec vitest run --project=unit src/pages/AgentsPage/AgentChatPage/AgentChatPage.test.tsx src/pages/AgentsPage/hooks/useChatOverview.test.ts in site/. The page tests set the chat width with the repo's MockResizeObserver. They check that a narrow chat requests none of the card's data, and that Retry in the card requests the earlier attachments again.
  3. In a dev deployment, open a chat in a window at least 84rem wide. Hide the card with the list button, reload, and check that it stays hidden.

What to look at first

  1. hooks/useChatOverview.ts: one canShow value gates both the toggle and the card, so the page only renders what the hook returns. The hook measures the chat's outer element with a ResizeObserver through observeChat, and OVERVIEW_MIN_CHAT_WIDTH_REM holds the 84rem value in one place, so the button and the card cannot disagree.
  2. AgentChatPageView.tsx: the page passes observeChat as the chat element's ref and destructures it from the hook result. The React Compiler treats an object that holds a ref callback as a ref, so the page keeps it apart from the other values.
  3. components/ChatOverviewCard.tsx: this PR adds ChatOverviewToggle to the container from feat(site/src/pages/AgentsPage/components): add the overview card container #31590.
Review history

The repository's frontend-deep-review ran three rounds on the first version, a clean-context advisor ran once, then one strict code quality review ran, then a polish pass and one final review round ran on the whole stack.

Polish pass changes:

  • Split ChatOverviewCard.tsx into the container plus ChatOverviewToggle, with the view in ChatOverviewCardView.tsx (feat(site/src/pages/AgentsPage/components): add the chat overview card view #31409). The getOverviewCost tests moved to ChatOverviewCard.test.tsx unchanged.
  • Added useChatOverview, which owns the visibility gate and the open state.
  • The card builds repository rows with repoLabel, the repository's branch, and countRepoChanges. Before, it filtered repositories through computeRepoStats only to add the clean ones back.
  • The docs say that you cannot select a clean repository row.

Final round fixes: renamed the top bar prop overview to overviewToggle, inlined the toggle value in the hook, and corrected three doc comments.

Follow-up fixes, after the final round:

  • The card no longer mounts below an 84rem chat. Before, it stayed mounted and CSS hid it, so its queries kept running. The repo has no element-size hook, so useChatOverview observes the chat element itself. The @container/chat class and the @min-[84rem]/chat classes are gone.
  • The card wires the earlier attachments request into the view, so a failure shows its error and a retry.
  • New tests: the hook test checks the 84rem boundary on both sides, and two page tests check the narrow chat's requests and the card's retry. Each fails without its fix. The existing page tests now set a 1600px chat width before they look for the card. Their assertions did not change.
  • The container moved to feat(site/src/pages/AgentsPage/components): add the overview card container #31590, because this PR grew past 600 changed lines. GitHub cannot insert a PR in the middle of a stack, so I removed stack #31413 and linked the six PRs again as stack #31591.
  • Safari: Playwright 1.63.0 downloaded WebKit, but WebKit does not start on this host, because system libraries such as libsoup-3.0 and libGLESv2 are missing. I did not check the narrow right panel or the card in WebKit. The @container/chat wrapper that the check was about no longer exists.

Skipped in the polish pass: passing the card's placement class from the page. That keeps the 84rem breakpoint in one file with the toggle, and moving it adds a pass-through prop.

Declined:

  • The page test checks that the card is gone while the right panel is open (toBeNull). That unmount is the behavior under test, and no callback or request captures it.
  • @container/chat traps the right panel's fixed inset-0 overlay below the lg breakpoint. I rendered NarrowWithSidebarPanel at 390px and 900px in Chromium, and the panel still covers the viewport. The follow-up fixes removed @container/chat.
  • try/catch around localStorage in overviewCardStorage.ts. The file follows sidebarTabStorage.ts.
  • Final round: move ChatOverviewToggleProps into the hook. The hook imports only a type from the component file, so no runtime cycle exists.

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.
Mount the overview card in the chat's top-right corner with a "Toggle
overview" list button in the top bar. The card and the button exist
only while the right panel is closed, the transcript is not full width,
and the page is not an embed. Both show only from an 84rem chat, so the
card never covers the transcript.

The card shows by default in a new chat and stays open until the user
hides it with the button. The choice is stored in localStorage under
agents.overview-card-open. A row opens the right panel on its tab, which
hides the card until the panel closes.

The card lists every repository the git watcher reports, with +0 -0 for
a clean one, and reads the attachments through useChatAttachments, the
same list as the Summary panel. GitPanel exports computeRepoStats and
repoLabel, and useChatFullWidth exports its storage key for stories.

Document the card in the Coder Agents overview and in the list of
places that show spend.
@github-actions

Copy link
Copy Markdown
Contributor

Docs preview

Check off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here.

@ThomasK33
ThomasK33 marked this pull request as ready for review October 29, 2026 14:16
@ThomasK33
ThomasK33 requested a review from jaaydenh October 29, 2026 14:16
@ThomasK33
ThomasK33 requested a review from a team as a code owner 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.
…chments loading flag from useChatAttachments
# Conflicts:
#	docs/ai-coder/agents/index.md
#	site/src/pages/AgentsPage/AgentChatPage/AgentChatPageView.tsx
# Conflicts:
#	site/src/pages/AgentsPage/AgentChatPage/AgentChatPageView.stories.tsx
…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.
Move the container, getOverviewCost, and the top bar toggle into
ChatOverviewCard.tsx, next to the view in ChatOverviewCardView.tsx. The
card reads repoBranchLabel and countRepoChanges from gitViews.ts instead
of filtering the repositories through computeRepoStats and adding the
clean ones back. useChatOverview owns the card's visibility gate and
its stored open state, so AgentChatPageView only renders what it
returns. The docs say that a clean repository row cannot be selected.
…t into its section and name the clean repository check
ThomasK33 and others added 2 commits November 18, 2026 13:14
…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.
…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.
Base automatically changed from tk/overview-card-container to main November 18, 2026 11:42
jaaydenh added a commit that referenced this pull request Nov 18, 2026
…tainer (#31590)

Adds `ChatOverviewCard`, the container that builds the overview card's
data and renders `ChatOverviewCardView` from #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). `getOverviewCost` turns 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.

| `Default` | `EarlierAttachmentsError` |
|---|---|
| ![The overview card container with cost, a repository, and a pull
request](https://raw.githubusercontent.com/coder/coder/aade3c26e40f84d6fbe77a64714e00199eafe14d/pr/container-default.png)
| ![The overview card container with a failed earlier attachments
request: the one-line error and Retry in
Attachments](https://raw.githubusercontent.com/coder/coder/aade3c26e40f84d6fbe77a64714e00199eafe14d/pr/container-attachments-error.png)
|

## How to test

1. Open Storybook at `pages/AgentsPage/ChatOverviewCard`, stories
`Default` and `EarlierAttachmentsError`.
2. Run `pnpm test
src/pages/AgentsPage/components/ChatOverviewCard.test.tsx` in `site/`.
The page test in #31412 checks that **Retry** requests the earlier
attachments again.

## What to look at first

1. `ChatOverviewCard`: one place builds the `ChatOverview` model from
the queries and the chat store.
2. `getOverviewCost`: a failed refetch keeps the cost that loaded, and a
chat without AI Gateway requests has no cost row.

<details>
<summary>Review history</summary>

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:

- The container now passes `earlierAttachmentsRequest` to the view, so a
failed request shows its error and a retry.
- `GitPanel/gitViews.ts` exports `countRepoChanges` here, where its
first caller arrives.
- Each repository row gets its `name` from `repoLabel(root)` and its
trimmed `branch`, which the view shows as the subtitle, or "No branch"
when it is empty.
- The stories are new. They give the container's error state a
screenshot. The stories have no `play` assertions, because the page test
in #31412 covers the retry request.

After #31411 merged, this branch was rebased onto `main` with no
conflicts and now targets `main`. It picks up the smaller
`AttachmentsErrorAlert` from #31411 without code changes here, so the
screenshots above are new.

</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>
…erge

# Conflicts:
#	site/src/pages/AgentsPage/components/ChatOverviewCard.tsx
…k and link the toggle to the card

A card row opens the right panel, which unmounts the card and the focused
row. The panel now focuses its active tab once per row click, using the
same focus request that #31478 builds on.

The top bar toggle names the card in aria-controls while it shows and has
a tooltip, and the docs name the button.
…at before using the overview card

The loading view renders its own overview toggle and a skeleton card with
the same accessible names, so the tests acted on elements that unmount once
the chat loads.
@jaaydenh
jaaydenh enabled stacked auto-merge (squash) November 18, 2026 16:48
@jaaydenh
jaaydenh merged commit 2c96f05 into main Nov 18, 2026
31 of 32 checks passed
@jaaydenh
jaaydenh deleted the tk/overview-card-mount branch November 18, 2026 16:55
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 18, 2026

This branch had an error being deployed

1 failed and 1 inactive deployments
docs-preview — d1e68c1a Deployed Nov 18, 2026 by jaaydenh via cleanup #212
main — d1e68c1a Deployed Nov 18, 2026 by jaaydenh via cla #259705
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