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 after the user hid the card:

960px chat, no card and no 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 (#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 (#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 #31590.
<details>
<summary>Review history</summary>
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`
(#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 #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.
</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>