Skip to content

refactor(site/src/pages/AgentsPage/components/ChatElements/tools): add ToolCall.Scrollable - #30648

Merged
DanielleMaywood merged 2 commits into
mainfrom
toolcall-scrollable
Oct 13, 2026
Merged

DanielleMaywood merged 2 commits into
mainfrom
toolcall-scrollable

Conversation

@DanielleMaywood

Copy link
Copy Markdown
Contributor

Adds ToolCall.Scrollable and moves the 13 tool-call ScrollArea blocks in the Agents chat onto it. The component owns the shared behavior: a labelled, keyboard-focusable scroll region, the thin tool-call scrollbar, and an opt-in followEnd that keeps the newest content in view while the reader is at the end. It is otherwise unstyled, so each consumer keeps its own border, margin, height cap, and padding (unchanged from main).

followEnd replaces the hand-rolled viewportRef + useLayoutEffect(followLogEnd, [logs]) copies in WorkspaceBuildLogSection and WorkspaceAgentLogSection. It watches the content with a ResizeObserver instead of a data dependency, so it also catches growth from children that rerender on their own (smoothly streamed text), which is what the ACP wait_agent transcript in #30561 needs. One visible side effect: on main the build log can settle 1px short of the end when content grows after mount without logs changing; it now lands exactly at the end, so Pixel may flag the start/stop workspace stories by 1px.

Refs #30561

Decision log
  • Scope: 13 of 14 tool-call ScrollArea usages migrated. TerminalOutput is left alone: its border lives on an outer wrapper with the command header, and enabling follow-to-end for execute/process_output is a behavior change worth deciding separately. Non-tool ScrollArea users in AgentsPage (sidebar, search, debug panel, settings, Response) are out of scope; the shared #/components/ScrollArea is unchanged.
  • Unstyled: an earlier iteration had default border/margin/max-h-64 plus tall and padded props. Dropped because consumers differ (diffs need 80vh, EditFilesTool relies on parent space-y, ACP wants max-h-96 and its own card), so callers pass className/viewportClassName like they did with ScrollArea. The scrollbar width stays in the component because every consumer used the same value.
  • Follow mechanism: ResizeObserver on a content wrapper (only rendered when followEnd is set) driving the existing followLogEnd helper, rather than a dependency prop, so streamed children that update internally are followed. Growth while the reader is at the end scrolls; after the reader scrolls up, their place is kept.
  • Possible follow-ups (not in this PR): ReasoningDisclosure preview uses a native overflow-y-auto box that unconditionally snaps to the bottom; it could use followEnd. The ACP wait_agent card in feat(site): support ACP subagents on the frontend #30561 could adopt ToolCall.Scrollable with followEnd.
  • Verification: new Vitest coverage in ToolCall.test.tsx for follow and keep-place (confirmed the follow test fails with the observer callback disabled). Before/after Storybook screenshots of 162 tool stories showed no differences beyond shimmer/background noise and the 1px build-log end position described above.

Generated by Coder Agents on behalf of @DanielleMaywood.

…d ToolCall.Scrollable

Moves the tool-call ScrollArea boilerplate (focusable labelled region,
thin scrollbar, follow-to-end for logs) into ToolCall.Scrollable. Callers
keep their own box styling.
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 12, 2026
@coder coder unlocked this conversation Oct 12, 2026
@DanielleMaywood

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T13:49:08.081474Z 5196193 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 519619360f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@DanielleMaywood
DanielleMaywood marked this pull request as ready for review October 12, 2026 13:44
@DanielleMaywood
DanielleMaywood requested a review from a team as a code owner October 12, 2026 13:44
@pr-queue-manager
pr-queue-manager Bot requested a review from jaaydenh October 12, 2026 13:45

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 519619360f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


it("follows new content while the reader is at the end", () => {
renderLog();
expect(log().scrollTop).toBe(200);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Replace DOM-geometry assertions with visual coverage

Both new cases make scrollTop the asserted outcome while mocking the element's geometry, so they verify the implementation in jsdom rather than an allowed non-visual behavior. The frontend testing contract assigns rendered layout to Storybook/Pixel and prohibits implementation-detail assertions; move this scroll-follow coverage to visual coverage, or assert a callback or state outcome instead.

AGENTS.md reference: site/AGENTS.md:L73-L75

Useful? React with 👍 / 👎.

@linear-code

linear-code Bot commented Oct 13, 2026

Copy link
Copy Markdown

CODAGT-1120

@jaaydenh jaaydenh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅

@DanielleMaywood
DanielleMaywood merged commit ff5edf2 into main Oct 13, 2026
68 checks passed
@DanielleMaywood
DanielleMaywood deleted the toolcall-scrollable branch October 13, 2026 12:24
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 13, 2026
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