Skip to content

agent_ui: Remeasure changed entries in the thread view list#53017

Merged
eholk merged 1 commit intomainfrom
thread-list-measurement-bug
Apr 2, 2026
Merged

agent_ui: Remeasure changed entries in the thread view list#53017
eholk merged 1 commit intomainfrom
thread-list-measurement-bug

Conversation

@danilo-leal
Copy link
Copy Markdown
Member

This PR fixes an issue where, sometimes, you couldn't scroll all the way to the bottom of the thread's content. The scrollbar would show up at the bottom of the scrollable container but the content was visibly cut off. Turns out that's a consequence of the top-down thread generation introduced in #52440, where changing the list alignment to Top made it visible that sometimes, the maximum scroll area would get underestimated because the items in the thread view's list would have a stale height measurement. So, the way this PR fixes the issue is by calling splice_focusable in the EntryUpdated event, too, so that the height of the items in the overdraw area get marked as unmeasured, triggering a list re-render and re-measuring.

We started by writing a test at the list level that would reproduce the regression but then later figured out that this is not an inherent list problem; it was rather a problem with its use within the thread view layer. Then, we explored writing a test that documented the regression, but it turned out to be very hard to simulate this sort of set up in which certain elements would have its height changed during streaming, which would be how you'd get to a mismatched height situation.

Therefore, given AcpThreadEvent::NewEntry already called splice_focusable and don't have a test for it, we figure it'd be safe to move forward without one, too. We then introduced a helper that's now shared between AcpThreadEvent::NewEntry and AcpThreadEvent::EntryUpdated.

Release Notes:

  • Agent: Fixed an issue where sometimes you couldn't scroll all the way to the bottom of the thread even though there's visibly more content below the fold.

Co-authored-by: Eric Holk <eric@zed.dev>
@danilo-leal danilo-leal requested a review from eholk April 2, 2026 18:01
@danilo-leal danilo-leal self-assigned this Apr 2, 2026
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Apr 2, 2026
@zed-community-bot zed-community-bot bot added the staff Pull requests authored by a current member of Zed staff label Apr 2, 2026
@eholk eholk enabled auto-merge (squash) April 2, 2026 18:05
@eholk eholk merged commit 34f51c1 into main Apr 2, 2026
41 checks passed
@eholk eholk deleted the thread-list-measurement-bug branch April 2, 2026 18:15
mikayla-maki added a commit that referenced this pull request Apr 3, 2026
…#53101)

Follow up to #53017

This PR does some significant refactoring of the `follow_tail` feature
in the GPUI list. That's only used by the agent panel's thread view and
given to the height-changing nature of streaming agent responses, we
were seeing some scroll snapping bugs upon scrolling while the thread is
generating. In the process of fixing it, we introduced a
`remeasure_items` method as an alternative to `splice` so that we could
get the remeasurement fix without scroll position changes. We already
had a `remeasure` method that did that for all of the indexes, but we
needed something more scoped out for the agent panel case, so as to not
remeasure the entire list's content on every new streamed token.

Effectively, this ends up reverting what the PR linked above introduced,
but it improved the API in the process.
 
Release Notes:

- N/A

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
rtfeldman pushed a commit that referenced this pull request Apr 4, 2026
…#53101)

Follow up to #53017

This PR does some significant refactoring of the `follow_tail` feature
in the GPUI list. That's only used by the agent panel's thread view and
given to the height-changing nature of streaming agent responses, we
were seeing some scroll snapping bugs upon scrolling while the thread is
generating. In the process of fixing it, we introduced a
`remeasure_items` method as an alternative to `splice` so that we could
get the remeasurement fix without scroll position changes. We already
had a `remeasure` method that did that for all of the indexes, but we
needed something more scoped out for the agent panel case, so as to not
remeasure the entire list's content on every new streamed token.

Effectively, this ends up reverting what the PR linked above introduced,
but it improved the API in the process.
 
Release Notes:

- N/A

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants