Skip to content

fix(site/src): split live Working blocks at assistant text and scroll to their end on expand - #30656

Merged
ibetitsmike merged 3 commits into
mainfrom
mike/working-block-scroll-to-end
Oct 27, 2026
Merged

ibetitsmike merged 3 commits into
mainfrom
mike/working-block-scroll-to-end

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Expanding a collapsed Working block in the Agents chat kept the view where it was (#29354), so a block that expanded near the bottom of the view opened its steps below the fold, and the reader had to scroll to reach the latest one.

Expanding a Working block now brings its end into view. If the expanded block ends below the viewport, the transcript scrolls smoothly until the block's end sits at the bottom of the view; if it already ends in view, nothing moves. A block taller than the view scrolls only until its header reaches the top of the view, so the header button and the first step stay in view, and the reveal never scrolls up. If the reader prefers reduced motion, the view jumps instead of gliding. If a step then grows and pushes the end back out of view (an image loading), the view scrolls toward the new end the same way, until the reader scrolls or toggles a row, 2 seconds pass after its last scroll starts, or the block changes width because the view resized. When the block is the last row of the transcript, expanding it jumps to the end and resumes following new output. While a turn is anchored at the top of the view and one of its blocks expands in view, the view stays put and the anchor hold hands off to following once the reply fills the view, even with rows below the block; if the expansion already used up the hold's tail spacer, it hands off at once. Collapsing is unchanged.

ToolCall.Root gets an opt-in revealEndOnExpand prop, set only by WorkingBlockDisclosure, so other tool rows keep their behavior. It passes { revealEnd } to the vendored message scroller's userLayoutIntent, whose toggle-commit MutationObserver calls the new revealItemEnd. When the reveal scrolls, it places the row and the tail spacer itself, so the existing resize pass (the anchor hold) runs only when the reveal does not scroll. The reveal records the row's size and an expiry, and the scroller's resize handler scrolls to the row's new end while that jump is still settling and the expiry has not passed. A change in the row's width ends the reveal. The jsdom MessageScroller layout harness moves from ToolCall.test.tsx to site/src/testHelpers/messageScrollerLayout.tsx so WorkingBlockDisclosure.test.tsx can reuse it.

Working blocks also split at assistant text while a turn runs. Text the assistant wrote between steps streamed below the live block, then folded into it when the next tool call arrived. While the turn runs or waits on the reader, every assistant text now closes the open block, and the next step opens a new block below it. That includes OpenAI narration and the lead-in before a provider-executed call such as a web search, which #30529 folded into the block. Files the agent attaches with attach_file do not close a block: as on main since #30788, they stay in the block of the step that attached them.

groupWorkingBlocks splits each message row into alternating work and output pieces. Parsing records each content part's block index (ParsedMessageContent.partBlockIndices), so grouping can place each part without parsing the message again.

Finished turns fold back into one Working block, as on main: the steps, the files the agent attached, the text between steps, the text before the first step, and labeled narration go into the block, and only the final message stays below it. A turn is finished once a later prompt exists or the chat status leaves running, interrupting, and requires_action, so nothing folds and unfolds while the agent works. Rows that never fold (questions, plans, hook notices, cleared or summarized context) still split a finished turn. The fold always starts collapsed. Its expansion is recorded under a key taken from the turn's last work piece, so what the reader expanded while the turn ran does not carry over, and what they expand afterwards survives paging and later turns. The fold takes over the scroller item of the turn's last block, so a focused summary keeps focus.

The fold keeps the reader's place. Focus inside what the fold removes (a control in an expanded earlier block, a link in text between steps, the summary of a block only the stream had) moves to the fold's summary instead of falling to the page body. An open image, text file, recording, or Mermaid diagram lightbox stays open: lightboxes opened from the timeline render in a LightboxHost above its rows instead of in the component that opened them. One lightbox opens at a time, so a text preview whose fetch finishes after the reader opened another lightbox is dropped. A Markdown text preview has a host of its own, so a diagram in it still opens over the preview.

Splitting blocks at text puts one-line block rows and narration rows next to each other, so transcript rows now sit 12px apart instead of 8px, the gap the chat loading skeleton already uses. Steps inside an expanded block keep their 8px gap.

While the turn runs, the text between two steps closes the first Working block, and the next step opens a new block below it:

A running turn: a finished one-step Working block, the text the assistant wrote, then the live Working block of the next step

Once the turn finishes, the same steps and the text between them fold into one Working block (expanded here), and only the final message stays below it:

The finished turn: one Working block with both steps and the text between them, then the final message

Review notes

Deliberate choices from self-review (frontend-review FE1 to FE10 and coder-frontend-review):

  • A smooth scroll from script bypasses the reduced-motion rule in site/src/index.css (scroll-behavior: auto), and the growth chase repeats the reveal's scroll without a gesture, so the reveal reads prefers-reduced-motion and passes behavior: "auto" when it is set. The existing chat scroll commands (submitChatTurn.ts, the scrollToMessage callers in ConversationTimeline.tsx) still pass behavior: "smooth". Each runs once per reader action, and moving them to the same check is a follow-up.
  • The last-row reveal jumps instead of gliding: following pins the end with an instant scroll on the next resize, which cut a smooth scroll short after one frame (measured in Chromium).
  • Following a growing block starts only after a reveal that scrolled, and ends 2 seconds after its last scroll starts, so later growth (a re-render, a late image) does not move a reader who stopped scrolling. A smooth glide uses part of that window. Each chase scroll renews the window, so images that load one after another stay followed. A width change ends it at once: a resize re-wraps the steps taller, and that is not growth the reader asked to follow.
  • Following a growing block stops on any scroll up, including one with no gesture (a focus move, find in page): the reveal only scrolls down, so a scroll up came from somewhere else. It only scrolls when growth pushes the end below the view, so it never pulls the view back up.
  • A block that does not fit in the view with its margins aligns its start with the top of the view instead of its end with the bottom, so the focused header button and the next Tab stop, the block's first step, stay in view. The reveal never scrolls up: when the header is already at or above the top, the view stays where it is. Expanding the last row of the transcript is the exception, because it jumps to the end and resumes following new output, so a last block taller than the view still scrolls its header above the top.
  • If rows below an expanded block already used up the anchor hold's tail spacer, the hold stays and the view does not follow the reply, as on main. Remote UAT hit this at 1440x560; at 1440x700 the view handed off. Handing off in that case would mean jumping to the end at the expand, which moves the block the reader just opened.
  • Collapsing a block that was revealed at the end of the chat can drop its header down the view: the content shrinks and the browser clamps scrollTop. main jumps the same way from the same scroll position; the collapse path is unchanged here.
  • The harness stubs requestAnimationFrame with setTimeout. jsdom runs frames on the global setInterval, and the existing live-label test fakes timers while a motion component requests a frame, which stalls every later frame in the file.
  • The test-only BlockRow stays separate from ToolCall.test.tsx's ToolRow: sharing them would add a render-prop abstraction for two callers.

Working block grouping:

  • As on main, files the agent attaches are work pieces of the step that attached them, a slice outside every block hides its files (main lists them under Attachments in the Summary panel), and an agent row of only files outside a block renders nothing. While a turn runs, only text closes a block.
  • File-reference parts stop closing blocks too. Only user messages carry them, and a user message already closes the block.
  • New stories: TextBetweenStepsOpensNextBlock and AttachmentFoldsIntoLiveBlock show the live split, TextBetweenStepsFolds and RequiresActionKeepsTextBetweenSteps the fold, and PaginatedFromAttachedFile the paging case below.
  • frontend-review FE9 asks for story variants in named constants, while coder-frontend-review TS3 and TS4 ask for overrides at the call site and no single-use story constants, and that skill lets its checkpoints win. The two new single-use message variants in ConversationTimelineWorkingBlocks.stories.tsx stay inline, like the file's existing ones.
  • The mock attach_file result carries only name, the one field AttachFileLabel reads.
  • Reasoning at the start of a turn, before the first text, renders on its own above that text: the text closes the block, and completed reasoning with no steps stays visible, as main already shows for a turn with no tools. While that reasoning streams, a live Working block shows and dissolves when the text arrives. The same applies to reasoning between two texts. A block the reader focused or toggled stays a block instead, so focus and the content the reader opened stay where they were. ConversationTimeline keeps those block keys in component state, so once the timeline remounts, for example after a reload, that reasoning renders on its own again.
  • When one render brings a live-only block's prompt page, its persisted step, and a cleared stream, the block keeps its scroller key by matching the start it recorded while live. The stream carries no reasoning timestamps, so a block that starts after text and streams reasoning before its first tool call can still remount in that render. If the reader focused its header, focus falls back to <body>: the block has its step, so grouping keeps it anyway, and keeping a block the reader focused does not change the key it gets in that render.

Finished-turn fold:

  • A turn starts at a user row only, because chatd stores mid-turn hook notices as system rows.
  • ChatMessage has no turn ID (chatd's turn ID is per prompt, for hooks, and is not stored), so the turn key is working:turn: plus the slice key of the turn's last work piece. A turn's newest work always loads first, so older pages do not change it.
  • An output run is keyed by the count of output pieces before it in its row, folded or not, so the answer keeps its scroller item when the fold takes the lead-in text before it in the same row. A row of narration and then the answer, with no step between them, renders whole while the turn runs and split once the narration folds, so that answer still remounts.
  • The chat status is null until the chat record hydrates and counts as finished, so a running chat whose messages hydrate first renders folded for one render. Treating null as running would flash split blocks on finished chats.
  • As on main, a finished turn that ends in text and then narration, with no later work, folds both.
  • A provider call that renders no row of its own counts toward the block that the next row starts, even when that row starts with text, which the fold takes into the block.
  • FoldFocusRestorer is a class component because only getSnapshotBeforeUpdate sees the focused element before React commits the fold; a layout effect runs after the element is gone. It finds the focused element's scroller item through data-message-id and focuses the first ended-turn block whose persisted message IDs include one of that item's. A block that only the stream had has no persisted rows; its content persists as messages newer than any rendered before, so it matches the fold that holds one of those.

Lightboxes:

  • Openers (attachment previews in messages, tool result images, recordings, Mermaid diagrams) open through useLightbox; outside a host they keep the lightbox themselves, as before.
  • Image, text file, and diagram lightboxes return focus to the button that opened them, as on main since feat: list every chat attachment in the Summary panel #31140. Each open keeps its own opener (returnFocusTo in useDialogFocusReturn.ts) instead of the hook's shared ref: the host drops an open while another lightbox is open, so a text preview that loaded late would otherwise have moved the open lightbox's focus return to its own button.
  • Known limit: when the fold has unmounted the opener of an open lightbox, closing the lightbox leaves focus on the page body. Sending it to the fold's summary needs the host to own focus return for every opener; that is a follow-up.
  • VideoLightbox now uses the shared Lightbox, which unmounts on close like the image and diagram lightboxes. It drops its open prop and its exit fade, and RecordingPreview drops the key it bumped to reset the video's error state, since each open now mounts a new VideoLightbox.
  • About 65 of the changed lines in ConversationTimeline.tsx only re-indent the timeline items under <LightboxHost>.
  • Known limit: the Mermaid lightbox shows the SVG it opened with, so a theme change while it is open does not restyle it.

Row spacing:

  • The 12px gap applies to every transcript row, so Pixel shows a diff on every story that renders a chat transcript through ChatMessageScroller (the ConversationTimeline, ChatPageContent, AgentChatPageView, and AgentChatPage stories). The WorkingBlocks and LiveWorkingBlocks stories render a bare MessageScroller.Content with no gap, so they do not change.
  • The vendored scroller reads the computed row gap (getFlexGap in geometry.ts), so its spacer math follows the class.
Delivery record
  • Remote dogfood UAT through Coder Agents on an isolated dev deployment, desktop viewport, 8 scenarios on ccbb338f5cb. Round 1: FAIL on the collapse clamp above, which reproduces on main from the same scroll position; that scenario was reworded to record the clamp as an observation. Round 2 on the same SHA: PASS. That run did not test a turn split across history pages or non-desktop viewports; the later run below does. Between runs, unit tests and a Chromium probe story (not committed) that records every scrollTo call and the scroll position each frame cover the changes.

  • Nine new WorkingBlockDisclosure scroller tests (11 cases). Removing the reveal call, the prop, the !expanded guard, the in-view check, the anchored hand-off, the whole anchored branch, the spacer check, the growth chase, its settling-jump check, its in-view check, either height record, the clear on another jump, or the clear on a scroll up each fails at least one of them. The chase's growth check is only visible in a browser, where jsdom's instant scrollTo hides it: in the Chromium probe, removing it re-issued the smooth scroll on every resize during the glide (3 calls instead of 1 when a row below the block grew mid-glide).

  • Chromium probe on the final code: a block that grew 300 px mid-glide got a second smooth scroll at the growth and settled with its end 24 px above the bottom of the view; growth after the glide settled did the same; after focus() moved the view up to an earlier row, a later growth left the view there.

  • Codex round 1 on 715f799a8ed: two P2 findings (a cut-short smooth reveal at the last row; no hand-off when the expansion used up the anchor spacer). Both confirmed by execution and fixed in c7f98a67d99.

  • Codex round 2 on c7f98a67d99: one P2 finding (content that grows after the reveal, such as a lazy image, pushed the end back out of view). Confirmed with a failing test and fixed in 990cb3542af. Self-review then found that a scroll with no gesture left that chase armed; fixed in b928354858d and d7053a2de50.

  • Codex round 3 on d7053a2de50: no findings.

  • Rebased onto main at 99afdc3b0fb to pick up fix: fold web searches, answer reasoning, and OpenAI narration into working blocks #30529, which folds an answer's reasoning into the Working block it ends. The first commit now also exports isViewport from testHelpers/messageScrollerLayout.tsx, because the ToolCall.Scrollable tests from refactor(site/src/pages/AgentsPage/components/ChatElements/tools): add ToolCall.Scrollable #30648 use it and this PR moved it there. Commit SHAs above are from before the rebase; each rebased commit keeps its subject. Codex round 4 on the pre-rebase merge bde29b9a1cc: no findings. Codex round 5 on ab2fdeec307: no findings.

  • Self-review: coder-frontend-review (eight roles) and frontend-review (FE1 to FE10) over five rounds, the last on the Codex fixes, re-running each failing role after its fix until every role passed on d7053a2de50; findings fixed or justified above.

  • Working block grouping, f97f2a911d3 to 5f87b148d88: written and reviewed on a separate branch, then cherry-picked onto ab2fdeec307 with no conflicts and the same patch (git patch-id). coder-frontend-review ran 13 rounds until all eight roles passed, and frontend-review FE1 to FE10 passed apart from the FE9 note above. Red-green: letting attached files close the block fails both new attached-file tests, and the old live rule fails the live one.

  • On 5f87b148d88: tsc, biome, oxlint (including the design-system config), knip, the React Compiler check, and dpdm pass, and so do the unit tests in src/pages/AgentsPage, src/vendor, and src/testHelpers (2128 passed, 2 skipped) and the ChatConversation story tests (118).

  • A long dogfood chat with attached files, loaded read-only and rendered with the attached-file fix: the reasoning before the final answer is the last row inside its block, and the files and the answer follow the block. The rebase onto feat(site/src/pages/AgentsPage): keep agent attachments in working blocks and list them under Attachments #30788 below replaced that file placement.

  • Row gap, aac53217c4a: compared 8px, 12px, and 16px on the same read-only dogfood chat in Chromium at 1280 and 390 px widths. The story tests that render ChatMessageScroller pass (7 files, 215 tests), and coder-frontend-review (eight roles) and frontend-review FE1 to FE10 pass.

  • Review by @jaaydenh on aac53217c4a, fixed in 29a3bcb14b6: the growth chase had no end besides user input, and an expand forced up to four full transcript layouts. The chase now expires and ends on a width change. The reveal runs before the anchor hold, which it replaces when it scrolls, and the row's rect is read once, before the scroll's writes. Two new cases (the window passes, the block re-wraps at a new width) each fail with their check removed. The reorder changes no test outcome (29 pass either way); in a throwaway jsdom probe, an anchored expand made 21 getBoundingClientRect calls instead of 69. Not measured in a browser. coder-frontend-review passed after four rounds; the size check reuses SCROLL_POSITION_EPSILON, which upstream also applies to row positions. Site checks pass on the new head (unit 2130 passed, 2 skipped; ChatConversation stories 118).

  • Codex round 6 on 29a3bcb14b6: two P2 findings. When the newest loaded page opened with files the agent attached and later rows continued their block, the files rendered above a block labeled complete, and loading the older page moved the block above the files. Confirmed with a failing test and fixed in ffcae5a6b7e: the block on that page is partial and renders above the files from the start (story PaginatedFromAttachedFile). Since the rebase onto feat(site/src/pages/AgentsPage): keep agent attachments in working blocks and list them under Attachments #30788, the files open that partial block instead. Declined: running the scroller tests in a real layout engine. They assert the rows the scroller publishes as visible, with the jsdom model main already uses, and the Chromium probe and remote UAT cover browser behavior.

  • Codex round 7 on ffcae5a6b7e: five style and structure findings. Fixed in acbd47dcc88: a hidden-entry assignment that nested a ternary, a nullish fallback, and a conditional, and a doc comment that restated a field name. Declined: extracting the row renderer into a component (the closure is on main, and the file goes from 795 to 798 lines), a named props type for the Transcript test helper (moved unchanged from ToolCall.test.tsx), and splitting a streamed row once rather than once per slice (the live row holds only the current step; in jsdom, a streamed update cost 0.04 ms for 3 sections and 1.8 ms for 50).

  • Codex round 8 on acbd47dcc88: one P2 finding. A live-only block that starts after text in the same stream remounted, collapsed, and lost focus when its prompt page, its persisted step, and a cleared stream arrived in one render. Confirmed with a failing test and fixed in 8bb9e94b76b. Codex round 9 on da079c0b460: no findings.

  • Remote UAT through Coder Agents on dogfood: an isolated dev deployment, real Anthropic and OpenAI models, desktop and 390 px viewports. Run 1 on 29a3bcb14b6: the reveal, the last row, the anchored turn, growth follow, grouping with real models, the row gap, collapse, and the mobile viewport pass, and the collapse clamp matches main. It also found gaps that main does not handle either: an anchored expand of a block with attached files below it never handed off to following (da079c0b460 fixes it while some tail spacer is left), an expand within about 30 ms of an older page starting to load loses the reveal, and growth after an expand that did not scroll is not followed. Part 2 on acbd47dcc88: with the page boundary at the attached files, the partial block renders above the files before and after the older page loads (the control, 29a3bcb14b6, reorders them); the reveal, growth follow, and real-model grouping pass, and the grouping refactor renders 4 web-search chats the same as ffcae5a6b7e. Part 3 on da079c0b460, with acbd47dcc88 as the control: an anchored expand of the live block with attached files below it hands off to following at 1440x700 (2 of 2 runs, control 0 of 1), and so does an expand of an earlier block of the turn (2 of 2, control 0 of 2); the reveal below the fold and the anchored expand of the last block pass. At 1440x560 the files used up the tail spacer before the expand, so the hold stayed, as on the control and main (see the review notes). Verdict on da079c0b460: PASS. Not tested: an OpenAI lead-in before a web search, OpenAI narration across three or more tool calls, and a real image that loads late inside a block (the growth checks injected it).

  • On da079c0b460: tsc, biome, oxlint (including the design-system config), knip, the React Compiler check, and dpdm pass, and so do the unit tests in src/pages/AgentsPage, src/vendor, and src/testHelpers (2134 passed, 2 skipped) and the ChatConversation story tests (119). coder-frontend-review (eight roles) and frontend-review FE1 to FE10 pass on each fix, with the failing roles re-run after their fixes.

  • CI on da079c0b460: the required checks pass. The Storybook (Pixel) job fails on one story this PR does not touch: the UserEngagementChart Loaded story's play function cannot find its "User engagement" group. fix(site/src): replace role="application" on recharts charts #30375 added that check to main with the wrong case, and fix: match chart accessible name in story #30907 fixed it on main after this run started. A re-run reuses this run's merge commit, so the job stays red until the next push.

  • Rebased onto main at 23c7f1fa61e to pick up feat(site/src/pages/AgentsPage): keep agent attachments in working blocks and list them under Attachments #30788, which keeps the files an agent attaches in their Working block and lists files outside every block under Attachments. 5cb3cb519a0 replaces this PR's files below the block with that model and moves getSliceContent into workingBlockGrouping.ts beside splitRowPieces. Partial blocks render in place again, so files at the top of a page open the block. The files-below-block test and story are gone. Commit SHAs above are from before this rebase. 88f9d835f5d trims a story comment after frontend review.

  • On 5cb3cb519a0: biome, tsc, oxlint, knip, the React Compiler check, and the ChatConversation unit and story tests pass. CI passes on 5cb3cb519a0 and 88f9d835f5d.

  • Accessibility review by @jaaydenh on 88f9d835f5d, fixed in 1b737f2064d and 52530bb2ca1. The reveal aligns a block taller than the view with the top of the view and never scrolls up, the reveal and its growth chase honor prefers-reduced-motion, and a reasoning-only block the reader focused or toggled stays a block when text follows it. New tests: a tall block stops at its header, and later growth does not pull the view back up; the reveal passes smooth or auto by motion preference; a focused or expanded reasoning-only block keeps its summary button through the next text and the persisted message. Removing the start alignment, the never-up check, the motion check (always smooth or always auto), the kept-key check in grouping, or either call that records a kept block each fails at least one of them. Not changed: the last-row reveal and the remount in the paging render (both above), and the near-identical block names from the review summary (answered in a PR comment). coder-frontend-review passed after three rounds with one finding declined (splitting the PR), and frontend-review FE1 to FE10 pass. On 52530bb2ca1: the pre-commit hook (make pre-commit, which runs biome, oxlint, tsc, dpdm, the React Compiler check, and knip for the site) and the design-system oxlint config pass, and so do the unit tests in src/pages/AgentsPage, src/vendor, and src/testHelpers (2214 passed, 2 skipped; the 8 failures are all in ProjectChatsList.test.tsx, which also fails on 88f9d835f5d without these changes) and the ChatConversation story tests (121).

  • Folded feat(site/src): fold each finished turn into one Working block #31025 (finished-turn fold), fix(site/src/pages/AgentsPage/components/ChatConversation): move focus the turn's fold removes to its summary #31138 (fold focus), and fix(site/src/pages/AgentsPage/components): keep an open lightbox through the turn's fold #31139 (lightboxes through the fold) into this PR and rebased it onto main at 7283fff69fe as one commit, a2d857aea5e; the three PRs are closed. Before the fold, each passed frontend-deep-review (eight roles, three rounds), a test audit, and frontend-review FE1 to FE10, with CI green. Each of their new tests failed without its fix: every fold focus case without the restorer, the image test without the timeline's host, the late text preview test when a late open replaces the open lightbox, and the diagram test without the Markdown preview's own host.

  • Rebase conflicts with feat: list every chat attachment in the Summary panel #31140 and feat: show web searches and the pages they found in chats #29861, resolved to keep both sides: lightbox openers keep useLightbox and feat: list every chat attachment in the Summary panel #31140's focus return, and grouping counts only provider calls that render no row as searches (web searches now render as tool rows) and skips cited sources when a provider tool row is in the block. Three grouping tests that used a web_search call as a call with no row now use a code_execution call, as feat: show web searches and the pages they found in chats #29861 did for its own tests.

  • frontend-deep-review of the resolution (one reviewer over the eight roles) found that a text preview loading while another lightbox was open replaced that lightbox's focus return target, so closing it focused the text file. db53e1872eb gives each open its own opener, and the late text preview test now also checks that focus returns to the image; that check fails without the fix. The re-review found the hook member this left unused, which df1fb8a4cb8 removes. Not changed: the two known limits under Lightboxes. frontend-review FE1 to FE10 pass on both commits.

  • On db53e1872eb: the story tests of the ChatConversation and ChatElements folders and VideoLightbox pass (414), and so do the unit tests in src/pages/AgentsPage, src/vendor, and src/testHelpers (2303 passed, 2 skipped) apart from 30 failures in five project and create-page test files this PR does not touch. Those fail the same way on main in this workspace, where requests that escape the mocks reach a local server on port 3000 (skillsQuery.data?.filter is not a function and similar); CI's test-js passes on df1fb8a4cb8. On df1fb8a4cb8, which only drops the unused member: the pre-commit hook (biome, oxlint, tsc, dpdm, the React Compiler check, knip), tsc, and the focus return tests pass.

  • doc-check author self-check: no findings. The docs do not describe how the chat transcript groups steps, so no page changes.

  • The screenshots are from the TextBetweenStepsOpensNextBlock and TextBetweenStepsFolds stories on db53e1872eb; the earlier screenshots showed finished turns split at text, which no longer happens.

Xum opened this PR on behalf of @ibetitsmike.

@ibetitsmike

Copy link
Copy Markdown
Collaborator 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-15T23:46:48.524200Z da079c0 Manual request
ℹ️ 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 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: 715f799a8e

ℹ️ 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".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: c7f98a67d9

ℹ️ 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".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: d7053a2de5

ℹ️ 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".

@linear-code

linear-code Bot commented Oct 13, 2026

Copy link
Copy Markdown

CODAGT-1114

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

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: bde29b9a1c

ℹ️ 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".

@ibetitsmike
ibetitsmike force-pushed the mike/working-block-scroll-to-end branch from bde29b9 to ab2fdee Compare October 14, 2026 00:59
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: ab2fdeec30

ℹ️ 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".

@ibetitsmike ibetitsmike changed the title fix(site): scroll to the end of a Working block when it expands fix(site): split Working blocks at assistant text and scroll to their end on expand Oct 14, 2026

@jaaydenh jaaydenh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Two performance notes on the reveal chase in the vendored scroller, from reading the code (not measured in a browser).

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: 29a3bcb14b

ℹ️ 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".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: ffcae5a6b7

ℹ️ 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".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

block.isLive && block.startedAt === Date.parse(identity.streamStartedAt)

P2 Badge Preserve later live blocks across simultaneous paging handoff

When a live-only block starts after earlier reasoning or text in the same stream, its startedAt is the later tool timestamp while identity.streamStartedAt remains the stream's initial timestamp. If older history is prepended in the same render that this block persists and the stream clears, the prepend changes its head/ordinal-derived live key, and it has no previously mapped durable piece key; this comparison therefore rejects the only continuation fallback. The disclosure remounts, collapses, and loses keyboard focus, so retain the individual block's live start in the identity instead of comparing it with the whole stream's start.

AGENTS.md reference: site/AGENTS.md:L11-L11

ℹ️ 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".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

Re the Codex finding Preserve later live blocks across simultaneous paging handoff: confirmed and fixed in 8bb9e94. A test reproduced it: a stream of reasoning, text, and then a tool call, with the live block expanded, followed by one render that brings the prompt page, the persisted step, and no stream. The block remounted and lost focus. The live block identity now records the block's own start, and the fallback compares the persisted block's start with it instead of with the stream's start. The new it.each row keeps an open live-only block that started after text mounted when its prompt page and persisted step arrive together fails without the fix, and the existing same-render case still passes.

Xum posted this reply on behalf of @ibetitsmike.

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: da079c0b46

ℹ️ 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".

@ibetitsmike
ibetitsmike requested review from jaaydenh and removed request for jaaydenh October 16, 2026 00:10

@jaaydenh jaaydenh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Accessibility pass on the reveal-on-expand and block-splitting changes. Three inline comments below, roughly in priority order: the first two are worth fixing before merge, the third is worth considering.

One more, smaller point with no single line to anchor it: splitting at every assistant text produces many more Working disclosures with near-identical accessible names (several Worked for 3s (1 step) buttons in one turn). Screen reader users who navigate by the button list cannot tell them apart. That pattern existed before, but this PR makes it much more common; adding some context to the name (for example a short step summary) would help.

The scroll findings follow from how browsers handle focus navigation and the CSSOM behavior option; I did not reproduce them in Chromium.

@ibetitsmike
ibetitsmike added this pull request to stack #31026 October 19, 2026 14:37
ibetitsmike added a commit that referenced this pull request Oct 19, 2026
…ocks and list them under Attachments (#30788)

In `/agents` chats with **Collapse assistant steps** on, files the agent
attaches (`attach_file`, computer-use screenshots, the `propose_plan`
plan file) rendered as the answer after a Working block: the block
closed at the attachment, and a turn that kept working split into
several blocks. They now fold into the Working block of the step that
made them and show when it is expanded. Rows outside every block (an
uncollapsible `propose_plan` or `ask_user_question` row, a parked
running tool) hide their files, and an agent row left with nothing else
is not rendered. With the preference off, the transcript is unchanged,
except that download cards get the focus ring the text-preview button
beside them already has.

To keep those files reachable, the right panel's Summary tab gets a
collapsible **Attachments (N)** section, open by default. It lists the
files the agent attached in the loaded messages, newest first, as the
transcript's download cards (expired tile included); user uploads stay
in their messages. While older history is unloaded, the section says so
and offers **Load earlier messages**. Until the first message page
reaches the chat store, the header shows no count, so a chat with files
never flashes "(0)", and live messages do not make the list blink.

Frontend only: production code changes 366 lines; the rest is tests,
stories, and fixtures. This overlaps #30656, which renders attached
files below the Working block; this PR keeps them inside the block, as
the newer request asks, so whichever lands second reconciles
`workingBlockGrouping.ts` and `ConversationTimeline.tsx`.

**Collapse on.** The turn's files stay in the collapsed Working block,
and the Summary panel lists them under Attachments (3), newest first.

![Collapsed Working block beside the open Attachments
section](https://github.com/user-attachments/assets/5ed406b4-cca6-4e3e-8bd6-aaa46d69cbd0)

**Block expanded.** Each file follows the step that attached it.

![Expanded Working block with each file after its
step](https://github.com/user-attachments/assets/b3171de7-a04f-442b-bb28-2aab0e54e978)

**Expired file.** After `old.zip` expires, the panel shows the expired
tile in its place.

![Attachments section with an expired
tile](https://github.com/user-attachments/assets/400aa5ab-503f-436d-a20e-b06a3975806c)

Follow-ups, out of scope: split `ConversationTimeline.tsx` (795 lines
before, 805 now); keep focus on load-more buttons while they fetch
(`HistorySidebar`, `InboxPopover`, this one); show the fetch error in
both message pagers; share probe-learned expiry between the transcript
and the panel; flag evicted files newer than the newest linked one, such
as an evicted newest file (`deriveEvictedFileIds` cannot yet tell them
from files the chat has not linked yet); name the file on the expired
tile.

## Testing

- `pnpm lint`, the AgentsPage unit tests (122 files, 2133 tests), and
the story tests for the touched area (13 files, 261 tests) pass on
30007ac.
- New unit tests cover a step's attachment staying in its block, rows
outside blocks dropping files, `isAgentAttachmentOnlyRow`,
`getAgentAttachments` (agent files only, newest first), the loading gate
(a live message does not blank the list), and the load button. Each
fails when its behavior breaks.
- New stories: `ChatAttachments` (12 states), four `ChatSummaryPanel`
states, and three working-block states.
- Remote UAT round 4: **PASS** on 3e47d30, on a dev deployment built
from the branch. It checked expired files on both surfaces, mouse and
Enter downloads against the source files' sha256, no "(0)" on reload or
chat switch, one count change per live attachment, and the focus ring.
30007ac changes only a doc comment after it, and the screenshots
come from this round. Rounds 1 to 3 passed on earlier heads; round 3
covered Load earlier messages, rows outside blocks, and 18 real-model
runs on four models.

<details>
<summary>Review record</summary>

- 11 rounds of `coder-frontend-review` (8 global roles),
`frontend-deep-review` (8 project roles), and `frontend-review` (FE1 to
FE10), read-only. Round 9 ran all 17 roles on b53897c; rounds 10 and
11 re-checked the comment-only fixes on 3e47d30 and 30007ac.
- Final verdicts: every checkpoint PASS except FE5 and FE6 (justified
below). RP6's PASS requires the `ConversationTimeline.tsx` split
follow-up listed above.
- Test audit: PASS through b53897c. Every finding not listed below
was fixed.
- Codex: four rounds on 30007ac. Each of its five P2 findings was
declined in its thread with evidence: a spinner for the one-commit
hydration gap, the file name on the shared expired tile, the copy action
for a text-and-file message that chatd never stores, gating the load
button on hydration, and the `ChatAttachments` doc. Round 4 found no
major issues.

Justified FAILs:

- FE5, no error text for a failed page: the transcript's pager shows the
same retry-only state for the same query; follow-up.
- FE6 and SA6, the button disables while fetching and loses focus: the
repo's load-more pattern (`InboxPopover`, `HistorySidebar`); follow-up
for all three.

Dropped findings (finding: reason):

- RO6 stack split: the component is 94 lines, and the hiding needs the
panel, so the halves are not independent.
- RP6 and RO5, split `ConversationTimeline.tsx` now: the PR adds call
sites, a prop, and two flags; follow-up, and #30656 edits it.
- RO1 `SidebarSectionHeader`: a sidebar h2 with no aria-controls; the
section uses the Radix Collapsible in `SectionHeader`.
- RO1 `isFileRenderBlock`: inline `block.type` checks are the grouping
module's idiom.
- RO2 shared retry button: the two share only variant, size, and label.
- RO3 `every` helper: a one-line idiom with different predicates in two
modules.
- RO3 shared guard with `getMemberRow`: two conditions, and #30656
rewrites `getMemberRow`.
- RO3 `Omit` over `Pick`: the `Pick` reuses the exported
`EarlierMessagesProps` types.
- RO3 page-level spread: `AgentChatPageView` passes every prop
explicitly.
- RO4 move `isAgentAttachmentOnlyRow`: it takes the grouping module's
row type and sits beside `getRowBlocks`.
- RO5 transcript focus ring: intended; it matches the text-preview
button.
- SD1 inline single-use story constants, and repeated fixture values:
FE9 asks for named spread constants.
- SD2 `{ message }` wrapper: retyping moves the map into
`ConversationTimeline.tsx`, which #30656 edits.
- SA2 `cva` for `fullWidth`: one boolean in a pre-existing component.
- TN4 inline `type` imports: the repo's style for mixed imports.
- TN4 `ChatStoreHandle`: `ChatStore` is the exported type; the handle is
a file-local alias.
- TN4 named `FileCardProps`: the file types its components inline.
- TN4 `GetRowBlocksOptions`: named like `GroupWorkingBlocksOptions`.
- TN5 `AgentAttachment` beside `readAgentAttachmentText`: that one reads
user uploads, in another module.
- TN6 copy: the repo's paged empty state (`SessionTimeline.tsx`) and the
transcript's retry label.
- CD1 `getAgentAttachments` doc: it states the ordering and the upload
exclusion.
- CD1 trim exported docs: AGENTS.md requires docs on exported symbols.
- CD4 `isHydratingMessages` comment: pre-existing and consistent with
its source.
- CD5 consumers in the `EarlierMessagesProps` doc: the doc states the
contract.
- `splitRowBlocks` doc: the base text stays; a comment at the file
condition gives the reason.
- Hydration comment placement: it sits on the operand it explains.
- Deleted `NotVisible` comment: this PR made it false.
- TS1 and TS5 `NotVisible` assertions: pre-existing.
- TS7 panel story with `hasMoreMessages`: tsc enforces the forward;
`WithEarlierMessages` is the visual.
- TS7 streamed-file story: live rows share the `getRowBlocks` call.
- TS7 text-plus-file case and `ChatError` story: the grouping test fails
on the same break; no new state.
- TS7 raster image fixture: grouping treats every file part alike.
- TS7 text and a file in one message: chatd persists a file as its own
message; the unit test covers the branch.
- Play-function assertions and a collapse test: plays drive state, and
Radix owns collapsing.
- `useChatMessages` unit test: a moved derivation with no new logic.
- Drop `LoadingMessages` and `LiveMessageArriving`: each catches a
call-site break (test audit).
- A store per story, built in render: as `ChatPageContent.stories` does.
- `NotVisible` capture shows the section: it renders whatever
`isVisible` is.
- RP4 hoist the `.map` callback: a single-use wrapper (site/AGENTS.md).
- RP5 `useChatMessages` as a function: it owns two subscriptions that
three components share.
- RP8 pre-existing render helpers: unchanged; the split follow-up covers
them.
- Per-render derivations and a second subscription: pure derivations;
only the queries are gated.
- `useFileProbes()` before the branches: hooks cannot be conditional,
and the default context is safe.
- DF5 share probes with the panel: FileCard never probes; both read
`chat.files`, polled every 5 s while the chat runs.
- DF5 every loaded file evicted: a pre-existing `deriveEvictedFileIds`
gap; follow-up.
- DF5 empty before query data: the page shows its loading view then.
- Spinner before the store fills: a one-commit window, so it would
flash.
- Previous chat after a switch: the page remounts per chat with its own
store.
- `void onFetchMoreMessages()`: `fetchNextPage` reports errors in its
result, and the transcript calls it the same way.
- Later parts first within a message: later parts are newer.
- Up chevron when open: as `ChatSectionHeader` does.
- `messageHelpers.ts` imports `chatAttachments.ts`: the page already
loads it; dpdm finds no cycle.
- Live status on a live row whose file is hidden: intended.
- `m-0` on the empty state: `index.css` sets paragraph margins.
- FileCard's name omits "Download file", and the expired tile names no
file: pre-existing; naming the file is a follow-up.

UAT observations, not failures:

- A file in a message that also holds text after the tool call is listed
only under Attachments, as for any row outside a block. Round 3 first
reported it as a FAIL; only DB-seeded rows had that shape, and 18
real-model runs never did.
- An evicted newest file keeps its link until a newer linked file exists
(follow-up above).
- The panel scroller clips the bottom of a card's focus ring at its
bottom edge.
- The load button has no aria-busy, and after a failure two buttons read
"Retry loading earlier messages".
- One parallel step with two files renders both tool rows before both
cards.
- The transcript's expired tile is 112px wide beside 384px cards, and
its tooltip is mouse-only (pre-existing).

</details>

> Xum opened this PR on behalf of @ibetitsmike.
ibetitsmike added a commit that referenced this pull request Oct 20, 2026
…h finished turn into one Working block

A running or parked turn keeps the split view from #30656, where text
between steps closes the open block. Once the turn ends (any turn before
the latest user prompt, or the latest turn when the chat is no longer
running, interrupting, or requires_action), its text between steps, the
text before its first step, and its labeled narration fold back into one
block per segment, leaving only the final message and attached files
visible. Block and piece keys stay stable, so an expanded block keeps its
scroller item and focus through the fold.
@ibetitsmike
ibetitsmike force-pushed the mike/working-block-scroll-to-end branch from da079c0 to 5cb3cb5 Compare October 20, 2026 12:49
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@jaaydenh thanks for the accessibility pass. The three inline threads are fixed in 1b737f2 and 52530bb, with replies in each thread.

Not changed here: the near-identical accessible names from your summary (several Worked for 3s (1 step) buttons in one turn). A name that tells blocks apart needs a short summary of each block's steps, which is new label copy for every Working block. That is a design and copy change beyond these fixes, so it is left for a separate change. As you noted, main has the same pattern, and this PR makes it more common.

Xum posted this comment on behalf of @ibetitsmike.

@ibetitsmike
ibetitsmike requested a review from jaaydenh October 21, 2026 13:05
ibetitsmike added a commit that referenced this pull request Oct 21, 2026
…h finished turn into one Working block

A running or parked turn keeps the split view from #30656, where text
between steps closes the open block. Once the turn ends (any turn before
the latest user prompt, or the latest turn when the chat is no longer
running, interrupting, or requires_action), its text between steps, the
text before its first step, and its labeled narration fold into one block
per run of rows between rows that never fold, leaving only the final
message visible.

The fold starts collapsed. An ended turn's block records its expansion
under a turn key taken from its last work piece, so what the reader
expanded while the turn ran does not carry over, and what they expand
afterwards survives paging. The fold takes over the scroller item of the
turn's last block, so its summary keeps focus, and an output run is keyed
by the count of output pieces before it in its row, so the answer below
the fold does not remount when the text before it folds.
…box's own opener

The timeline's lightbox host drops an open while another lightbox is open,
but the openers recorded their trigger in a shared ref before opening. A text
preview that loaded while an image lightbox was open replaced the image's
trigger, so closing the image moved focus to the text file instead.

Each open now keeps its own opener through returnFocusTo. The grouping
comment on hidden provider calls now matches the precedence in the code.
… member no opener uses

rememberTriggerButton existed for the timeline's attachment previews, which
now keep their opener per open through returnFocusTo.
@ibetitsmike ibetitsmike changed the title fix(site): split Working blocks at assistant text and scroll to their end on expand fix(site/src): split live Working blocks at assistant text and scroll to their end on expand Oct 27, 2026
@ibetitsmike
ibetitsmike merged commit 083670a into main Oct 27, 2026
33 checks passed
@ibetitsmike
ibetitsmike deleted the mike/working-block-scroll-to-end branch October 27, 2026 21:34
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 27, 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