Skip to content

Fix agent permission row flicker when scrolled away from a tall plan - #58689

Merged
miguelraz merged 1 commit into
mainfrom
martin/ai-372-scrolling-to-top-breaks-claude-acp-thread-in-plan-mode
Jun 5, 2026
Merged

Fix agent permission row flicker when scrolled away from a tall plan#58689
miguelraz merged 1 commit into
mainfrom
martin/ai-372-scrolling-to-top-breaks-claude-acp-thread-in-plan-mode

Conversation

@MartinYe1234

Copy link
Copy Markdown
Contributor

When a pending tool call awaiting permission contains tall content (e.g. a full plan in Claude Code plan mode) and the inline prompt is scrolled out of view, the floating awaiting-permission row embeds that content and can grow to consume the entire panel, squeezing the conversation list to zero height. ListState::item_is_above_viewport / item_is_below_viewport returned None for a zero-height viewport, so the row's visibility decision oscillated from frame to frame, flickering between the conversation and the permission prompt and making the thread unusable.

This PR fixes the root cause and hardens the UI:

  • gpui: item_is_above_viewport / item_is_below_viewport now answer definitively from the last layout bounds even when the viewport is zero-height, so callers that size sibling UI based on these queries can't oscillate. Adds a regression test.
  • agent_ui: adds a Floating tool call layout used by the awaiting-permission row that caps the embedded tool call content with a scrollable max height, so the row can never crowd the conversation list out of view while keeping the permission buttons visible. Adds an integration test that drives real window draws and asserts the row's visibility is stable across frames.

Closes AI-372

Closes #58564

Release Notes:

  • Fixed the agent panel flickering and becoming unusable when a permission prompt with tall content (such as a plan awaiting approval) was scrolled out of view.

The floating awaiting-permission row embeds the pending tool call, so a
tall plan awaiting approval could consume the entire panel and squeeze
the conversation list to zero height. ListState's viewport queries
returned None for a zero-height viewport, making the row's visibility
oscillate between frames.

Make item_is_above/below_viewport answer definitively for a zero-height
viewport, and cap the floating row's content with a scrollable max
height so it can never crowd out the conversation list.
@MartinYe1234 MartinYe1234 self-assigned this Jun 5, 2026
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jun 5, 2026
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label Jun 5, 2026
@MartinYe1234
MartinYe1234 marked this pull request as ready for review June 5, 2026 18:20
@miguelraz

Copy link
Copy Markdown
Contributor

Ran this PR locally and confirmed the bug is no longer reproducible on this branch. Ship it! :shipit:

@miguelraz
miguelraz added this pull request to the merge queue Jun 5, 2026
@miguelraz

Copy link
Copy Markdown
Contributor

@zed-industries/approved

Merged via the queue into main with commit 1cecd7d Jun 5, 2026
43 checks passed
@miguelraz
miguelraz deleted the martin/ai-372-scrolling-to-top-breaks-claude-acp-thread-in-plan-mode branch June 5, 2026 18:54
@mgoodness

Copy link
Copy Markdown

Thank you!

TomPlanche pushed a commit to TomPlanche/zed that referenced this pull request Jun 8, 2026
…ed-industries#58689)

When a pending tool call awaiting permission contains tall content (e.g.
a full plan in Claude Code plan mode) and the inline prompt is scrolled
out of view, the floating awaiting-permission row embeds that content
and can grow to consume the entire panel, squeezing the conversation
list to zero height. `ListState::item_is_above_viewport` /
`item_is_below_viewport` returned `None` for a zero-height viewport, so
the row's visibility decision oscillated from frame to frame, flickering
between the conversation and the permission prompt and making the thread
unusable.

This PR fixes the root cause and hardens the UI:

- `gpui`: `item_is_above_viewport` / `item_is_below_viewport` now answer
definitively from the last layout bounds even when the viewport is
zero-height, so callers that size sibling UI based on these queries
can't oscillate. Adds a regression test.
- `agent_ui`: adds a `Floating` tool call layout used by the
awaiting-permission row that caps the embedded tool call content with a
scrollable max height, so the row can never crowd the conversation list
out of view while keeping the permission buttons visible. Adds an
integration test that drives real window draws and asserts the row's
visibility is stable across frames.

Closes AI-372

Closes zed-industries#58564

Release Notes:

- Fixed the agent panel flickering and becoming unusable when a
permission prompt with tall content (such as a plan awaiting approval)
was scrolled out of view.
This was referenced Jun 18, 2026
jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 2026
…ed-industries#58689)

When a pending tool call awaiting permission contains tall content (e.g.
a full plan in Claude Code plan mode) and the inline prompt is scrolled
out of view, the floating awaiting-permission row embeds that content
and can grow to consume the entire panel, squeezing the conversation
list to zero height. `ListState::item_is_above_viewport` /
`item_is_below_viewport` returned `None` for a zero-height viewport, so
the row's visibility decision oscillated from frame to frame, flickering
between the conversation and the permission prompt and making the thread
unusable.

This PR fixes the root cause and hardens the UI:

- `gpui`: `item_is_above_viewport` / `item_is_below_viewport` now answer
definitively from the last layout bounds even when the viewport is
zero-height, so callers that size sibling UI based on these queries
can't oscillate. Adds a regression test.
- `agent_ui`: adds a `Floating` tool call layout used by the
awaiting-permission row that caps the embedded tool call content with a
scrollable max height, so the row can never crowd the conversation list
out of view while keeping the permission buttons visible. Adds an
integration test that drives real window draws and asserts the row's
visibility is stable across frames.

Closes AI-372

Closes zed-industries#58564

Release Notes:

- Fixed the agent panel flickering and becoming unusable when a
permission prompt with tall content (such as a plan awaiting approval)
was scrolled out of view.
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
…ed-industries#58689)

When a pending tool call awaiting permission contains tall content (e.g.
a full plan in Claude Code plan mode) and the inline prompt is scrolled
out of view, the floating awaiting-permission row embeds that content
and can grow to consume the entire panel, squeezing the conversation
list to zero height. `ListState::item_is_above_viewport` /
`item_is_below_viewport` returned `None` for a zero-height viewport, so
the row's visibility decision oscillated from frame to frame, flickering
between the conversation and the permission prompt and making the thread
unusable.

This PR fixes the root cause and hardens the UI:

- `gpui`: `item_is_above_viewport` / `item_is_below_viewport` now answer
definitively from the last layout bounds even when the viewport is
zero-height, so callers that size sibling UI based on these queries
can't oscillate. Adds a regression test.
- `agent_ui`: adds a `Floating` tool call layout used by the
awaiting-permission row that caps the embedded tool call content with a
scrollable max height, so the row can never crowd the conversation list
out of view while keeping the permission buttons visible. Adds an
integration test that drives real window draws and asserts the row's
visibility is stable across frames.

Closes AI-372

Closes zed-industries#58564

Release Notes:

- Fixed the agent panel flickering and becoming unusable when a
permission prompt with tall content (such as a plan awaiting approval)
was scrolled out of view.
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.

Claude Agent plan breaks on scroll to top

3 participants