Skip to content

agent_ui: Scroll to AskUserQuestion Other answers - #64007

Merged
smitbarmase merged 7 commits into
zed-industries:mainfrom
seth-wood:slw/fix-askuser-scroll
Oct 6, 2026
Merged

smitbarmase merged 7 commits into
zed-industries:mainfrom
seth-wood:slw/fix-askuser-scroll

Conversation

@seth-wood

@seth-wood seth-wood commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Objective

Solution

  • Typed Other answers are stored on an accepted session elicitation linked to a ToolCall, not as UserMessage.
  • Added AcpThread::is_user_authored_scroll_target in crates/acp_thread/src/acp_thread.rs. It matches a UserMessage, or a ToolCall whose id is referenced by an accepted session elicitation (scope.tool_call_id).
  • Turn-end, fallback, and prev/next user-message navigation in crates/agent_ui/src/conversation_view/thread_view.rs share that matcher.
  • Left the harmless "Scroll to user message" icon on the first message alone.

Sibling of #63901. That PR skips <task-notification> UserMessage entries. This PR counts accepted elicitation ToolCalls. They touch the same rposition / scroll_to_user_message_index sites. A merge should keep both.

Testing

  • Yes. Added test_scroll_to_user_message_lands_on_ask_user_elicitation_answer and ran:
cargo test -p agent_ui --features test-support test_scroll_to -- --nocapture

Result: 3 passed (including the new test). The synthesized thread is [UserMessage, ToolCall, Elicitation, AssistantMessage]. Scroll lands on item_ix == 1 (the tool call), not 0.

image
Screen.Recording.2026-09-12.at.9.07.08.AM.mov

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content adheres to Zed's UI standards (UX/UI and icon guidelines)
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Release Notes:

  • Fixed "Scroll to User Message" so it lands on typed answers to AskUserQuestion

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Sep 10, 2026
@seth-wood
seth-wood marked this pull request as ready for review September 10, 2026 04:40
@smitbarmase

Copy link
Copy Markdown
Member

Thanks for working on this! Our contribution guidelines ask for screenshots or recordings for changes visible in the UI. Can you add them?

@smitbarmase smitbarmase added area:ai/agent thread Feedback for Zed's Agent Thread area:ai/acp Feedback for Zed's Agent Client Protocol labels Sep 10, 2026
@seth-wood

Copy link
Copy Markdown
Contributor Author

@smitbarmase absolutely. will update these accordingly for you. thanks for flagging.

@smitbarmase smitbarmase self-assigned this Sep 17, 2026

@smitbarmase smitbarmase left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for fixing this.

  • Have you tested it with Zed’s built-in agent too? I don’t think scrolling to an ask_user answer works there yet. The tool card uses a scoped ID like 1:call_1, but the question request sends call_1, so the new lookup won’t match them. I think we need to figure out where the id mismatch is happening and also cover it in test.

  • Also, I think accepting a link to continue in the browser should not make its tool a user-message scroll target. URL elicitations also become Accepted, but that does not mean the user submitted an answer. Lets handle that case too?

Thanks again.

@seth-wood

Copy link
Copy Markdown
Contributor Author

Hey @smitbarmase thanks for your guidance on these. See below for a rundown of the issues and the fixes based on the suggestions here.

Built-in agent: The mismatch was in ToolCallEventStream::request_elicitation in crates/agent/src/thread.rs. It built the elicitation's tool call ID from the raw tool_use_id (call_1), but the tool card uses the scoped tool_call_id (1:call_1). It now passes the scoped ID, so the two match. I added an end-to-end test in crates/agent/src/tests/mod.rs that runs ask_user through a native thread with a fake model and checks that the elicitation targets the card's ID. That test fails without the fix. I also extended the ask_user_tool test to assert the ID. I checked this in a real Zed build with the built-in agent as well: answering with Other and then clicking "Scroll to User Message" lands on the answer.

URL elicitations: tool_call_has_accepted_user_answer now only counts accepted form-mode elicitations. Accepting a URL elicitation no longer makes its tool a scroll target. There's a new test for this in conversation_view.rs.

Let me know if anything else is off here. Happy to run through it again.

@smitbarmase
smitbarmase force-pushed the slw/fix-askuser-scroll branch 2 times, most recently from ae6030b to 7aab9b1 Compare October 6, 2026 17:13

@smitbarmase smitbarmase left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! I made rebase since it had conflicts.

@smitbarmase
smitbarmase added this pull request to the merge queue Oct 6, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 6, 2026
seth-wood and others added 7 commits October 6, 2026 23:53
Scroll-to-user currently targets only UserMessage entries, so a typed
Other reply stored on the ask_user tool call is skipped.
The Other reply is stored on a tool call linked to an accepted
elicitation, not as a UserMessage. Use one matcher for turn-end
scroll, fallback, and prev/next navigation.
The production fix landed separately in zed-industries#64086; this keeps the end-to-end
coverage that an answered ask_user tool call is a scroll target.
Accepting a URL elicitation only consents to opening a link in the browser; the user never types an answer. Only accepted form elicitations now make their tool call a Scroll to User Message target.
@smitbarmase
smitbarmase force-pushed the slw/fix-askuser-scroll branch from 7aab9b1 to e0eccb7 Compare October 6, 2026 18:39
@smitbarmase
smitbarmase enabled auto-merge October 6, 2026 18:43
@smitbarmase
smitbarmase added this pull request to the merge queue Oct 6, 2026
Merged via the queue into zed-industries:main with commit c3ab556 Oct 6, 2026
36 checks passed
@tredondo

tredondo commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

@smitbarmase , thanks as well for your guidance on PRs! Would you have a moment to review mine?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ai/acp Feedback for Zed's Agent Client Protocol area:ai/agent thread Feedback for Zed's Agent Thread cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Scroll to user message" ignores user message in response to AskUserQuestion

3 participants