Skip to content

chat: page long Agent Host chats from the gutter and Find - #349371

Merged
Osvaldo Ortega (osortega) merged 10 commits into
mainfrom
agents/chat-history-paging-ux
Nov 20, 2026
Merged

Osvaldo Ortega (osortega) merged 10 commits into
mainfrom
agents/chat-history-paging-ux

Conversation

@osortega

@osortega Osvaldo Ortega (osortega) commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • At the top of the expanded gutter, click anywhere on the horizontal chevron button to see the previous page of prompts without jumping the transcript. While the page loads, the chevron cycles through one, two, and three dots (a steady ellipsis with reduced motion). The button also works with Enter or Space and disappears at the start of history. Scrolling up or pressing Up on the first prompt still loads a page while keeping that prompt in place.
  • Find checks loaded messages first. If it needs an older match, it reads one page at a time until it finds one or exhausts history. Closing Find stops further search reads. A partial or interrupted search is not reported as “No results.”
  • The host bounds replies. Deploy the host first: updating only the client cannot guarantee a smaller response from a host that ignores the requested view.

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

  1. Run this branch on both the host and the client and open a long chat. Verify that the newest turns appear first and a second chat remains usable.
  2. Without scrolling the transcript, open the gutter and click near either end of the chevron strip. Check that one page of earlier prompts appears, the transcript does not jump, and hovering alone loads nothing. Press Enter or Space on the focused strip to load another page. Separately, press Up from the first prompt: older prompts should appear above it while focus stays on that prompt.
  3. Reopen at the latest turn. Use Find for text unique to an early reply, without scrolling first. Verify that it reveals the correct occurrence. Try closing Find partway through a different search; no further pages should be requested for that search.

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.

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>
Copilot AI balanced review requested due to automatic review settings November 20, 2026 02:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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>
@osortega
Osvaldo Ortega (osortega) marked this pull request as ready for review November 20, 2026 04:29
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@osortega
Osvaldo Ortega (osortega) added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit a2ac30c Nov 20, 2026
38 checks passed
@osortega
Osvaldo Ortega (osortega) deleted the agents/chat-history-paging-ux branch November 20, 2026 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants