Skip to content

feat(site/src): fold each finished turn into one Working block - #31025

Closed
ibetitsmike wants to merge 24 commits into
mike/working-block-scroll-to-endfrom
mike/working-block-collapse-finished-turns
Closed

ibetitsmike wants to merge 24 commits into
mike/working-block-scroll-to-endfrom
mike/working-block-collapse-finished-turns

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #30656, which splits Working blocks at assistant text. That helps while a turn runs, but finished turns kept the split, so they read as a row of one-step blocks with narration between them.

Finished turns now 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. The running or parked turn keeps the split view, 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.

Finished turn on #30656:

A finished turn on #30656: three one-step blocks alternate with the text written between them

With this PR:

The same finished turn with this PR: one Working block with three steps, then the final message

Review notes
  • This PR was rebuilt from its first commit to cut it from 4,255 changed lines to about 640. Keeping the reader's place when the fold removes what they were in (focus inside the expanded content, an open lightbox) moves to the follow-ups fix(site/src/pages/AgentsPage/components/ChatConversation): move focus the turn's fold removes to its summary #31138 (focus) and fix(site/src/pages/AgentsPage/components): keep an open lightbox through the turn's fold #31139 (lightboxes).
  • 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.
  • When the turn's last block existed only in the stream as the turn ended, with no persisted step yet, the fold gets a new scroller item, and focus on that block's summary is lost.
  • 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 search result with no row of its own now counts toward the block that the next row starts even when that row starts with text, which the fold now takes into the block.
  • LabeledNarrationStaysVisible and LeadInBeforeSearchStaysVisible become LabeledNarrationFolds and LeadInBeforeSearchFolds, TextBetweenStepsSplitsBlocks becomes TextBetweenStepsFolds, and RequiresActionKeepsTextBetweenSteps is new.
  • On a7cb2484a34: frontend-deep-review (this repository's copy of coder-frontend-review) passes all eight roles after three rounds, with one finding declined (RO6, splitting the PR, since the change is one behavior), and frontend-review FE1 to FE10 pass. The pre-commit hook (make pre-commit, which runs biome, oxlint, tsc, dpdm, the React Compiler check, and knip for the site), the design-system oxlint config, the unit tests in src/pages/AgentsPage, src/vendor, and src/testHelpers (2224 passed, 2 skipped; the 5 failures are all in ProjectChatsList.test.tsx, which fails the same way without this PR), and the ChatConversation story tests (122) pass.

Xum opened this PR on behalf of @ibetitsmike.

@ibetitsmike
ibetitsmike added this pull request to stack #31026 October 19, 2026 14:37
@ibetitsmike ibetitsmike changed the title mike/working block collapse finished turns feat(site/src/pages/AgentsPage/components/ChatConversation): fold each finished turn into one Working block Oct 19, 2026
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 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-20T20:38:35.132744Z be5f927 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: db47d239fc

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

Xum posted this comment on behalf of @ibetitsmike.

@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: 93bd464db9

ℹ️ 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 commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: eab78dc19e

ℹ️ 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 commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 48d680523a

ℹ️ 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 commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum posted this comment on behalf of @ibetitsmike.

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

ℹ️ 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 commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum posted this comment on behalf of @ibetitsmike.

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

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

Xum posted this comment on behalf of @ibetitsmike.

@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: 45a33b14cc

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

Xum posted this comment on behalf of @ibetitsmike.

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

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

Xum posted this comment on behalf of @ibetitsmike.

@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: 431cec5789

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

Xum posted this comment on behalf of @ibetitsmike.

@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: 8fbb2555d3

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

Xum posted this comment on behalf of @ibetitsmike.

@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: 064ef2228a

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

Xum posted this comment on behalf of @ibetitsmike.

@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: 8f064bb621

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

Xum posted this comment on behalf of @ibetitsmike.

@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: 11685fa85e

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

…ve block that starts after text mounted across paging

When an older page, a live-only block's persisted step, and the cleared
stream arrive in one render, the block keeps its scroller item key only
if its persisted start matches the start recorded while it was live.
That check used the start of the whole stream, but since text closes a
block, a block that starts after text in the same stream starts at its
own tool call. The block remounted, collapsed, and lost focus. The live
block identity now records the block's own start.
…s attached files

While a turn is anchored, expanding its last block in view lets the
anchor hold hand off to following once the reply fills the view. That
applied only when the block was the scroller's last item, but attached
files now render below the block, so in a turn that attached files the
view never handed off and the answer streamed below the fold. The check
now applies to any row that expands in view inside the anchored turn.
…ched files into their working block

On main, #30788 keeps a step's attached files inside its Working block
and lists the files of rows outside every block under Attachments in the
Summary panel. This branch rendered them below the block, so the rebase
onto main adopts main's model:

- Files are work pieces, so they fold into the block of the step that
  attached them, and only text closes a block.
- A slice outside every block hides its files, and an agent row of only
  files outside a block renders nothing.
- getSliceContent moves beside splitRowPieces in the grouping module and
  takes main's hideAttachments option.
- Partial blocks render in place again: files at the top of a page now
  open the block instead of preceding it.

Main's attachment tests run on the slice layout, the files-below-block
test and story are gone, and the paginated story's block now includes
the attach step's result time.
@ibetitsmike
ibetitsmike force-pushed the mike/working-block-collapse-finished-turns branch from 691fa84 to bd3cb21 Compare October 20, 2026 12:49
@ibetitsmike
ibetitsmike force-pushed the mike/working-block-scroll-to-end branch from da079c0 to 5cb3cb5 Compare October 20, 2026 12:49
@ibetitsmike ibetitsmike changed the title feat(site/src/pages/AgentsPage/components/ChatConversation): fold each finished turn into one Working block feat(site/src/pages/AgentsPage/components): fold each finished turn into one Working block Oct 20, 2026
…ly the constraint in a story comment

The story's name already says its page starts at an attached file.
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum posted this comment on behalf of @ibetitsmike.

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

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

Xum posted this comment on behalf of @ibetitsmike.

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

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

Xum posted this comment on behalf of @ibetitsmike.

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

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

Xum posted this comment on behalf of @ibetitsmike.

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

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

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: be5f92700d

ℹ️ 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 feat(site/src/pages/AgentsPage/components): fold each finished turn into one Working block feat(site/src): fold each finished turn into one Working block Oct 20, 2026
…educed motion on reveal

Expanding a Working block taller than the view aligned its end with the
bottom of the view, which pushed the focused header button above the
top. The next Tab moved focus to the first step, the browser scrolled it
back into view, and that scroll up ended the reveal. A block that does
not fit in the view with its margins now aligns its start instead, and
the reveal never scrolls up, so the header and the next Tab stop stay in
view.

A smooth scroll from script also bypasses the reduced-motion rule in
index.css, and the growth chase repeats it without a gesture. The reveal
and the chase now jump instead of gliding when the reader prefers
reduced motion.
…asoning-only Working block the reader focused or toggled

Text closes the open Working block, and a closed block with no steps is
dropped, so reasoning that streams between two texts showed a live
Working button that unmounted when the next text arrived. A reader who
had focused or expanded it lost focus to the body, and the content they
opened collapsed into an inline reasoning row. The timeline now records
the blocks the reader focused or toggled, and grouping keeps them even
without steps.
@linear-code

linear-code Bot commented Oct 21, 2026

Copy link
Copy Markdown

CODAGT-1114

…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.
@mafredri

Copy link
Copy Markdown
Member

Check: a finished turn whose last step is text followed by attach_file folds that text into the turn's block, and nothing renders below the block.

Shape from a real chat (Claude):

  1. assistant: reasoning, text (the ~6,000-character final answer), tool-call attach_file
  2. assistant: file
  3. tool: tool-result attach_file

The model then ended the turn without another step. At a7cb2484a3, groupWorkingBlocks puts the whole turn in one block (working:turn:message:10891850), answer included: the text waits in pendingText, and the attach_file piece folds it in (line 510). #30656 alone keeps the answer visible. main and #31145 fold it too, though #31145 shows the pill.

Could an ended turn's trailing work that only attaches files leave the last text as the answer, with the attach_file step folding into the block? With #31145, the pill would then sit under the answer. Alternatively: in an ended turn, the last text is the answer when no text follows it. That also covers an answer followed by save_memory or cleanup calls, but an interrupted turn would show its lead-in text as the answer.

🤖 This review was automatically generated with Coder Agents.

@ibetitsmike
ibetitsmike force-pushed the mike/working-block-scroll-to-end branch from 52530bb to a2d857a Compare October 27, 2026 18:49
@ibetitsmike
ibetitsmike removed this pull request from stack #31026 October 27, 2026 18:58
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

Folded into #30656: its single commit, rebased onto main, now carries this change, so review continues there.

Xum closed this PR on behalf of @ibetitsmike.

@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