feat(terminal): jump to latest agent message (#11816)#11924
Conversation
Adds a pure model method that scans the block list from the tail and returns the BlockIndex of the most recent visible AIBlock rich-content item. Includes 4 unit tests covering empty, single, multiple, and mixed-type cases (TDD: tests written first, confirmed failing, then passing). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…entView) Agent messages (AIBlock) are hidden (should_hide, zero height) once you leave the agent view back to the terminal; only the collapsed EnterAgentView entry marker stays visible. Broaden latest_agent_block_index to return the latest *visible* agent-related rich content so the jump works both in the agent view (lands on the AIBlock) and after returning to the terminal (lands on the visible conversation entry). Rename from latest_ai_block_index to reflect this.
"Jump to Latest Agent Message" re-enters the agent view for the most recent conversation, landing on its latest message. Agent messages only render inside the agent view; once you ESC back to the terminal they collapse to a hidden, zero-height block, so scrolling the terminal viewport can never reveal them. Re-entering the agent view is the only mechanism that actually shows the message. - jump_to_latest_agent_message: resolve the most recent conversation via BlocklistAIHistoryModel::last_conversation_id and enter its agent view through the existing enter_agent_view_for_conversation path. No-op when there is no agent conversation. - Add AgentViewEntryOrigin::JumpToLatestAgentMessage (+ telemetry mapping) so the entry point is attributed correctly. - TerminalAction::JumpToLatestAgentMessage, command-palette only, with no default keybinding. This replaces the earlier terminal-scroll approach, which could not work: in terminal mode the agent AIBlocks are hidden, so the jump only reached the collapsed conversation-entry marker, never the message itself. Fixes warpdotdev#11816
Address fresh-context review: - Guard `jump_to_latest_agent_message` with `FeatureFlag::AgentView`, so it doesn't route into the agent-view-only `enter_agent_view_for_conversation` when the flag is off (matches `handle_continue_conversation` / `ResumeConversation` idiom). - Drop the redundant trailing `ctx.notify()` — entering the agent view already emits its own events and dirties rich content.
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
Adds a command-palette action that re-enters Agent View for a recent conversation, along with the terminal action plumbing and telemetry attribution. The PR includes visual evidence, and the attached spec context contains no approved repository spec to validate against.
Concerns
- The command currently chooses the last-created live conversation, which can differ from the conversation containing the latest or currently active agent message after users switch between conversations.
Verdict
Found: 0 critical, 1 important, 0 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
| let Some(conversation_id) = | ||
| BlocklistAIHistoryModel::as_ref(ctx).last_conversation_id(self.id()) |
There was a problem hiding this comment.
last_conversation_id returns the last conversation created in this terminal, not the conversation with the latest or active agent message. If a user switches back to an older conversation and receives a newer response there, this command will still jump to the newer-created conversation; use active_conversation_id(self.id()) or the latest-exchange helper so the command follows actual agent activity.
Oz review: last_conversation_id returns the last-created conversation, not the one with the latest/active agent message. Switching back to an older conversation and receiving a newer response there would jump to the wrong conversation. Use the history model's active_conversation_id (most recently streamed, persists across ESC to terminal) and fall back to last_conversation_id only when there is no active conversation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Thanks for the review, @oz-for-oss — addressed the IMPORTANT concern in 0ab8e5a. The command now follows actual agent activity instead of creation order: it uses the history model's
/oz-review |
|
I'm re-reviewing this pull request in response to a review request. You can view the conversation on Warp. I reviewed this pull request and requested human review from: Comment Powered by Oz |
Oz no longer requests changes for this pull request after the latest automated review.
There was a problem hiding this comment.
Overview
Adds a command-palette-only terminal action that re-enters Agent View for the active/latest conversation and wires telemetry for the new entry path.
Concerns
- No blocking concerns found in the changed diff. Security review found no issues, and no approved spec context was available to compare against.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
Description
Adds a "Jump to latest agent message" command (#11816). When you're in an agent conversation,
ESCback to the terminal, and then run commands in the same thread, the agent's last message gets buried. This command takes you straight back to it.Key behavior: agent messages only render inside the agent view — once you return to the terminal they collapse to a hidden, zero-height block. So there is nothing to scroll the terminal viewport to; the only way to actually show the latest agent message is to re-enter the agent view. This command does exactly that, re-entering the agent view for the most recent conversation (which lands on its latest message).
Implementation (minimal):
TerminalView::jump_to_latest_agent_message(app/src/terminal/view.rs): looks up the most recent conversation viaBlocklistAIHistoryModel::last_conversation_idand calls the existingenter_agent_view_for_conversation. No-op when there is no agent conversation.AgentViewEntryOrigin::JumpToLatestAgentMessage(+ telemetry mapping inTelemetryAgentViewEntryOrigin) so this entry point is attributed correctly.TerminalAction::JumpToLatestAgentMessage, registered in the command palette (init.rs). No default keybinding.It reuses
enter_agent_view_for_conversation, which already handles the live / in-memory / load-from-disk conversation cases (with error toasts), so this adds no new state or traversal logic.Questions for reviewers
Linked Issue
Fixes #11816
ready-to-specorready-to-implement. (Auto-bookmark the last agent output so you can jump back after running commands #11816 isready-to-implement)Testing
./script/run.Repro: start an agent conversation →
ESCto the terminal → runseq 1 400(orgit log) to bury the conversation → command palette → Jump to Latest Agent Message. The agent view re-opens on the most recent conversation, showing its latest message.Screenshots / Videos
PR11924-jump-to-latest-agent-message-1.5x.mp4
Agent Mode