Repository navigation
chat: page long Agent Host chats from the gutter and Find - #349371
Merged
Merged
Conversation
Page older turns on demand so opening a long chat does not exceed the relay message limit. Keep each subscriber's history window independent and preserve the transcript, checkpoints, and pending sends across reconnects. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Share the existing chat history page request between the transcript and its navigation controls. Keep the current row in place, and distinguish missing history from an exhausted cursor when a remote host goes offline. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Search loaded turns first, then share the backward pager with the gutter when navigation needs older messages. Keep partial results usable when a read fails, release stale searches, and wait for restored matches to enter the transcript before revealing them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved reconnect and pagination defects can resend accepted prompts, omit checkpoints for completed turns, and cause Find to report no results before fetched history is applied.
3 open issues
What changed in this PR
This PR adds on-demand history paging for long Agent Host chats, using the existing protocol. Relay chats open at recent turns, while the transcript, prompt gutter, and Find share backward paging.
Changes:
- Bounds host history replies and preserves paging state through reconnect and authentication recovery.
- Adds gesture-driven loading and incremental Find, with focus preservation and incomplete-search status.
- Updates history reconciliation, checkpoints, accessibility help, and regression tests.
| File | Description |
|---|---|
| src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.ts | Supports partial counts, search status, and stale-result protection. |
| src/vs/workbench/contrib/chat/test/common/chatService/chatService.test.ts | Tests history prepends and authoritative reconciliation. |
| src/vs/workbench/contrib/chat/test/browser/widget/chatListWidget.test.ts | Tests paging gestures and scroll/focus preservation. |
| src/vs/workbench/contrib/chat/test/browser/widget/chatFindWidget.test.ts | Tests incremental search, cancellation, and recovery. |
| src/vs/workbench/contrib/chat/test/browser/widget/chatFindModel.test.ts | Tests completed-row caching and invalidation. |
| src/vs/workbench/contrib/chat/test/browser/remoteAgentHost/cloudSandboxSessionHandler.test.ts | Tests paging availability across suspension. |
| src/vs/workbench/contrib/chat/test/browser/promptTimeline/promptTimelineModel.test.ts | Tests partial prompt totals. |
| src/vs/workbench/contrib/chat/test/browser/promptTimeline/promptTimelineGutterRail.test.ts | Tests gutter paging, focus retention, and retries. |
| src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts | Tests demand paging, reconnect history, and checkpoint boundaries. |
| src/vs/workbench/contrib/chat/test/browser/agentHost/agentHostSnapshotController.test.ts | Tests checkpoint preservation during paging and restoration. |
| src/vs/workbench/contrib/chat/common/model/chatViewModel.ts | Distinguishes historical insertions from new requests. |
| src/vs/workbench/contrib/chat/common/model/chatModel.ts | Exposes paging state and preserves pending edit events. |
| src/vs/workbench/contrib/chat/common/chatSessionsService.ts | Defines session paging and history ownership contracts. |
| src/vs/workbench/contrib/chat/common/chatService/remoteChatSessionRestorer.ts | Coordinates page loading and model reconciliation. |
| src/vs/workbench/contrib/chat/browser/widget/chatWidget.ts | Connects Find to model visibility and refreshed content. |
| src/vs/workbench/contrib/chat/browser/widget/chatListWidget.ts | Loads older history through transcript navigation. |
| src/vs/workbench/contrib/chat/browser/widget/chatFind/chatFindWidget.ts | Searches older pages and reports incomplete results. |
| src/vs/workbench/contrib/chat/browser/widget/chatFind/chatFindModel.ts | Caches completed-row matches and navigates newly loaded hits. |
| src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionHandler.ts | Forwards paging state across live-source changes. |
| src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxReadOnlySessionHandler.ts | Marks incomplete recorded history. |
| src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineWidgetContrib.ts | Connects the gutter to the shared pager. |
| src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineStickyHeader.ts | Hides totals when history is incomplete. |
| src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineModel.ts | Exposes older-history loading and partial totals. |
| src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineGutterRail.ts | Adds boundary paging while preserving focused rows. |
| src/vs/workbench/contrib/chat/browser/promptTimeline/media/promptTimeline.css | Styles paging indicators and load errors. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSnapshotController.ts | Preserves checkpoint boundaries when older turns arrive. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts | Integrates paging, history windows, and checkpoint safeguards. |
| src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.ts | Documents keyboard paging and Find behavior. |
| src/vs/platform/agentHost/test/node/protocolServerHandler.test.ts | Tests bounded pages, isolation, authorization, and reconnects. |
| src/vs/platform/agentHost/test/electron-browser/agentHostProtocolClient.test.ts | Tests paged subscriptions and pending-message recovery. |
| src/vs/platform/agentHost/node/protocolServerHandler.ts | Serves bounded per-subscription history views. |
| src/vs/platform/agentHost/node/chatHistoryView.ts | Implements page budgets, cursors, and resume tracking. |
| src/vs/platform/agentHost/node/agentHostStateManager.ts | Allocates distinct snapshot sequence numbers. |
| src/vs/platform/agentHost/common/state/agentSubscription.ts | Tracks pending turn delivery across partial snapshots. |
| src/vs/platform/agentHost/common/agentService.ts | Adds the optional connection paging API. |
| src/vs/platform/agentHost/browser/agentHostProtocolClient.ts | Requests paged relay history and verifies pending turns. |
| src/vs/platform/agentHost/AGENTS.md | Documents paging and reconnect invariants. |
Review effort: Balanced
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Verify accepted turns even when the host returns an empty cursor. Reconcile completed checkpoints without moving local requests past their steering turns, and let Find finish a page only once its messages are searchable. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep the editor-window gutter keyboard tests alongside the paging tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Osvaldo Ortega (osortega)
marked this pull request as ready for review
November 20, 2026 04:29
Osvaldo Ortega (osortega)
enabled auto-merge
November 20, 2026 04:29
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Dmitriy Vasyura (dmitrivMS)
approved these changes
Nov 20, 2026
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.

What changed
Open long Agent Host chats at the latest turns. The transcript, prompt gutter and Find share the same backward pager. Opening a chat or expanding a populated gutter does not download the rest of the conversation.
This is the standalone first step for #349287. It uses the existing Agent Host Protocol and does not depend on microsoft/agent-host-protocol#620. Searching far back can still transfer every intervening page; direct jumps and host-side search are separate work.
How to test
Validation
The affected Electron suites and shared webview Find suite passed locally: 2,804 passing, 1 pending. Client type-check, scoped lint, repository hygiene and whitespace checks passed. In an offline 45 MiB synthetic chat, the pager recovered all 200 turns in order; the largest encoded reply was about 2.5 MiB. The updated gutter Electron suite passed locally (21 tests), including clicks near both ends, keyboard activation, duplicate clicks, focus as prompts arrive, the loading-dot sequence, and reduced motion. Find was also verified over the relay with a synthetic chat. The new button has not yet been manually tested over the relay.