Repository navigation
Load deferred tool outputs in one request without scroll animation - #231
Merged
Merged
Conversation
Restored tool results whose outputs were deferred came back one by one as UpdateToolStatus, the live agent path, which starts the smooth scroll to the bottom. Opening a session with several expanded cards replayed that animation once per arriving output. SessionService::load_tool_outputs now loads all outputs a session view needs in one call. They arrive as UiEvent::ToolOutputsLoaded, tagged with their session so GPUI drops answers for a session it no longer shows, and a transcript that follows its tail jumps to stay at the bottom instead of animating.
terminate_agent stopped and aborted the run before dropping the sleep
guard and agent lock. The stopped setup task resolves the turn outcome on
another worker thread, so a waiter could observe the outcome while the
wake lock was still held. pending_setup_does_not_keep_its_owner_alive
failed this way on CI ("shutdown leaked the run's wake lock").
Release first, like the run task already does before publishing idle.
a_message_sent_while_the_agent_works_waits_for_it sent its second message as soon as the session reported AgentRunning. Until the agent's first iteration starts, it takes a waiting message into its request, so the message showed up in the transcript instead of waiting, and the test timed out (136 of 400 runs under load). Wait for WaitingForResponse instead, as the core test for queued skill triggers already does. Also put the scroll_state doc comment back above its own method.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Opening a session with several expanded tool cards whose outputs are stored as blobs replayed the "scroll to bottom" animation several times.
Cause: every expanded block with a deferred output requested it on its own, and each answer came back as
UiEvent::UpdateToolStatus— the live agent path, which callsauto_scroll_if_followingand starts the spring animation.scroll_to_endonly holds until the next layout (it then becomes a regular top anchor), so each arriving output that grew a visible block pushed the bottom out of view again, and the animation chased it — once per output.A second issue: those answers carried no session ID and were applied to whatever session was shown when they arrived, including triggering the animation there. Tool IDs are only unique per session.
Changes
SessionService::load_tool_outputs(session_id, tool_ids)replacesload_tool_outputand reads all requested blobs in one call. A result that can't be read (or an unknown tool ID) is left out with a warning instead of failing the batch.UiEvent::ToolOutputsLoaded { session_id, results }instead of reusingUpdateToolStatus. ACP ignores it.BlockView::claim_deferred_outputhands out the tool ID once, and the event loop collects all of them after applying tool results and sends a single request. Expanding an inline block sends a request for that one ID.ToolOutputsLoadedfor a session no longer shown is dropped.keep_tail_in_view) instead of animating; a list that doesn't follow keeps its anchor.docs/session-storage.md,AGENTS.md.Tests
loaded_outputs_keep_a_following_transcript_at_the_bottom_without_animating— failed on!animatingbefore the fix (reproduces the bug).outputs_loaded_for_a_session_no_longer_shown_are_droppedcargo test --workspace,cargo fmt --checkandcargo clippy --all-targets --all-features -D warningspass. Not yet verified in the running app.Notes for review
Gpuiglobal. Both always exist in the app; only relevant for tests without the global.