Repository navigation
sessions: Persist read state per chat - #339500
Merged
Sandeep Somavarapu (sandy081) merged 15 commits intoOct 4, 2026
Merged
Sandeep Somavarapu (sandy081) merged 15 commits into
Sandeep Somavarapu (sandy081) merged 15 commits into
Conversation
Store peer read state in the Agent Host chat catalog, restore missing state as read, and project each chat's status throughout the Agents Window. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Adopt the merged AHP compact chat status contract, persist exact read state for every chat, and keep the session aggregate consistent across activation, archive, restore, and explicit read operations. Co-authored-by: Copilot <[email protected]>
…s-display Co-authored-by: Copilot <[email protected]>
Make per-session Mark as Read and Mark as Unread follow the main chat state shown by the row while preserving the independent session aggregate. Co-authored-by: Copilot <[email protected]>
Update database fixtures, unit expectations, and AHP snapshots for the current payload version and per-chat read-state transitions. Co-authored-by: Copilot <[email protected]>
Provide exact chat read state for every rename-test peer fixture used by the Sessions list renderer. Co-authored-by: Copilot <[email protected]>
…s-display Co-authored-by: Copilot <[email protected]>
Allow default-chat read updates before session-state hydration and preserve legacy session read state when per-chat metadata is absent.\n\nCo-authored-by: Copilot <[email protected]>
Contributor
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Hidden chats affect aggregates, failed read requests are not retried, and recovery can discard persisted peer read state.
Review effort: Balanced
Findings: 3
Open (3)
What changed in this PR
Adds persistent per-chat read state to Agent Host sessions while preserving the independent session-level aggregate.
Changes:
- Persists and synchronizes default and peer-chat read state across protocol, database, catalog, and recovery paths.
- Displays exact unread state per chat and routes session read actions to the main chat.
- Expands documentation, unit tests, fixtures, and E2E snapshots.
| File | Description |
|---|---|
src/vs/platform/agentHost/browser/agentHostProtocolClient.ts |
Handles protocol read-state updates. |
src/vs/platform/agentHost/common/agent.ts |
Extends Agent Host chat contracts. |
src/vs/platform/agentHost/common/state/sessionState.ts |
Defines chat read metadata and aggregation. |
src/vs/platform/agentHost/node/agentHostCatalogListReader.ts |
Reads persisted catalog state. |
src/vs/platform/agentHost/node/agentHostCatalogProjection.ts |
Projects per-chat read state. |
src/vs/platform/agentHost/node/agentHostCatalogSourceResolver.ts |
Reconciles catalog read state. |
src/vs/platform/agentHost/node/agentHostDatabase.ts |
Migrates and stores chat read state. |
src/vs/platform/agentHost/node/agentHostPeerChatStore.ts |
Persists peer-chat read state. |
src/vs/platform/agentHost/node/agentHostStateManager.ts |
Synchronizes chat and aggregate state. |
src/vs/platform/agentHost/node/agentService.ts |
Integrates read state with restoration and catalogs. |
src/vs/platform/agentHost/node/chatContributions/builtInChatContributions.ts |
Registers read-state contributions. |
src/vs/platform/agentHost/node/chatContributions/chatArchive/chatArchiveContribution.ts |
Coordinates archive and read state. |
src/vs/platform/agentHost/node/chatContributions/chatRead/chatReadContribution.ts |
Implements chat-read handling. |
src/vs/platform/agentHost/node/chatContributions/markUnread/markUnreadContribution.ts |
Implements unread transitions. |
src/vs/platform/agentHost/node/protocolServerHandler.ts |
Exposes read operations over AHP. |
src/vs/platform/agentHost/test/electron-browser/agentHostProtocolClient.test.ts |
Tests protocol client behavior. |
src/vs/platform/agentHost/test/node/agentHostCatalogListReader.test.ts |
Tests catalog read-state loading. |
src/vs/platform/agentHost/test/node/agentHostCatalogProjection.test.ts |
Tests catalog projections. |
src/vs/platform/agentHost/test/node/agentHostCatalogSourceResolver.test.ts |
Tests catalog reconciliation. |
src/vs/platform/agentHost/test/node/agentHostDatabase.test.ts |
Tests database migration and persistence. |
src/vs/platform/agentHost/test/node/agentHostPeerChatStore.test.ts |
Tests peer-chat persistence. |
src/vs/platform/agentHost/test/node/agentHostStateManager.test.ts |
Tests aggregate invariants. |
src/vs/platform/agentHost/test/node/agentHostToolCallTelemetry.test.ts |
Updates telemetry fixtures. |
src/vs/platform/agentHost/test/node/agentHostTurnHangTelemetry.test.ts |
Updates hang telemetry fixtures. |
src/vs/platform/agentHost/test/node/agentHostTurnTelemetry.test.ts |
Updates turn telemetry fixtures. |
src/vs/platform/agentHost/test/node/agentService.test.ts |
Tests restore and catalog behavior. |
src/vs/platform/agentHost/test/node/agentSideEffects.test.ts |
Updates side-effect coverage. |
src/vs/platform/agentHost/test/node/chatContributions.test.ts |
Tests read-state contributions. |
src/vs/platform/agentHost/test/node/e2e/providers/__snapshots__/Agent_Host_E2E___Claude_retains_context_across_consecutive_turns.traffic.ahp.yaml |
Updates Claude AHP snapshot. |
src/vs/platform/agentHost/test/node/e2e/providers/__snapshots__/Agent_Host_E2E___Codex_retains_context_across_consecutive_turns.traffic.ahp.yaml |
Updates Codex AHP snapshot. |
src/vs/platform/agentHost/test/node/e2e/providers/__snapshots__/Agent_Host_E2E___Copilot__Copilot-specific__resumes_a_failed_turn_in_place.traffic.ahp.yaml |
Updates failed-turn AHP snapshot. |
src/vs/platform/agentHost/test/node/e2e/providers/__snapshots__/Agent_Host_E2E___Copilot_retained_background_subagent_completes_repeated_follow-up_turns.traffic.ahp.yaml |
Updates subagent AHP snapshot. |
src/vs/platform/agentHost/test/node/e2e/providers/__snapshots__/Agent_Host_E2E___Copilot_retains_context_across_consecutive_turns.traffic.ahp.yaml |
Updates Copilot AHP snapshot. |
src/vs/platform/agentHost/test/node/e2e/suites/multiChatSuite.ts |
Covers multi-chat read behavior. |
src/vs/platform/agentHost/test/node/protocolServerHandler.test.ts |
Tests protocol read commands. |
src/vs/sessions/SESSIONS.md |
Documents read-state semantics. |
src/vs/sessions/browser/parts/chatCompositeBar.ts |
Renders exact chat unread state. |
src/vs/sessions/common/contextkeys.ts |
Clarifies read context semantics. |
src/vs/sessions/contrib/providers/agentHost/AGENT_HOST_SESSIONS_PROVIDER.md |
Documents provider behavior. |
src/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider.ts |
Maps and updates Agent Host read state. |
src/vs/sessions/contrib/providers/agentHost/browser/localAgentHostSessionsProvider.ts |
Routes local read operations. |
src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts |
Tests provider read-state behavior. |
src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHostSessionsProvider.ts |
Routes remote read operations. |
src/vs/sessions/contrib/sessions/browser/media/sessionsList.css |
Styles unread chat rows. |
src/vs/sessions/contrib/sessions/browser/views/sessionsList.ts |
Displays chat and aggregate unread state. |
src/vs/sessions/contrib/sessions/browser/views/sessionsViewActions.ts |
Routes session-row read actions. |
src/vs/sessions/contrib/sessions/test/browser/automationsView.test.ts |
Updates automation read-state coverage. |
src/vs/sessions/contrib/sessions/test/browser/sessionsActions.test.ts |
Tests read actions. |
src/vs/sessions/contrib/sessions/test/browser/sessionsList.test.ts |
Tests unread list rendering. |
src/vs/sessions/contrib/sessions/test/browser/sessionsListContextMenu.test.ts |
Tests context-menu state. |
src/vs/sessions/contrib/sessions/test/browser/sessionsListFixtureUtils.ts |
Adds fixture read-state support. |
src/vs/sessions/contrib/sessions/test/browser/sessionsListTestUtils.ts |
Extends list test utilities. |
src/vs/sessions/contrib/sessions/test/browser/sessionsRename.test.ts |
Updates session test fixtures. |
src/vs/sessions/services/sessions/browser/sessionsManagementService.ts |
Targets main chats for read actions. |
src/vs/sessions/services/sessions/browser/sessionsService.ts |
Automatically reads active chats. |
src/vs/sessions/services/sessions/common/sessionContextKeys.ts |
Publishes main-chat read context. |
src/vs/sessions/services/sessions/common/sessionsManagement.ts |
Updates management contracts. |
src/vs/sessions/services/sessions/common/sessionsProvider.ts |
Adds provider chat-read API. |
src/vs/sessions/services/sessions/test/browser/sessionNavigation.test.ts |
Updates navigation fixtures. |
src/vs/sessions/services/sessions/test/browser/sessionsManagementService.test.ts |
Tests automatic and explicit transitions. |
src/vs/sessions/services/sessions/test/common/sessionContextKeys.test.ts |
Tests read context keys. |
src/vs/sessions/services/sessions/test/common/testSessionBuilder.ts |
Supports mutable test read state. |
src/vs/sessions/test/browser/chatCompositeBar.test.ts |
Tests per-tab unread rendering. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Wait for the terminal chat unread action before E2E turns are treated as drained, and complete component-fixture main-chat read-state mocks. Co-authored-by: Copilot <[email protected]>
Exclude hidden chats from aggregate read state, preserve recovered peer read metadata, and retry automatic read transitions after provider startup no-ops. Co-authored-by: Copilot <[email protected]>
Wait for the current turn's unread action after its terminal notification, while allowing host-local turns to opt out of an action they intentionally do not emit. Regenerate AHP traffic snapshots so read-state changes remain in the originating round. Co-authored-by: Copilot <[email protected]>
Sandeep Somavarapu (sandy081)
marked this pull request as ready for review
October 3, 2026 23:32
Sandeep Somavarapu (sandy081)
enabled auto-merge (squash)
October 3, 2026 23:32
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Benjamin Christopher Simmonds (@benibenj)Matched files:
Ladislau Szomoru (@lszomoru)Matched files:
|
Regenerate the Windows-only consecutive-turn snapshot with unread actions in their originating rounds. Match the selected-model assertion to its prompt-bearing request so later background requests cannot change the observed model. Co-authored-by: Copilot <[email protected]>
Dmitriy Vasyura (dmitrivMS)
approved these changes
Oct 4, 2026
Sandeep Somavarapu (sandy081)
deleted the
sandy081/agents/multi-chat-read-status-display
branch
October 4, 2026 01:12
2 tasks done
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.

Summary
Persist and display exact read state for every user-visible chat in an Agents Window session.
Behavioral details
IChat.isReadrepresents the exact state shown for each chat row.ISession.isReadremains the separately persisted session aggregate.defaultChatIsRead, the default chat inherits the stored session read state during restore.Validation
npm run compile— passed.npm run hygiene— passed.npm run eslint -- src/vs/platform/agentHost/node/agentService.ts src/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider.ts src/vs/platform/agentHost/test/node/agentService.test.ts src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts— passed../scripts/test.sh --run src/vs/platform/agentHost/test/node/agentService.test.ts --grep "restores (an unread default chat with an unread session aggregate|a legacy read session with its default chat read)"— 2 passing../scripts/test.sh --run src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts— 378 passing, 11 pending.One broader
peer chat catalog persistencerun had 54 passing tests and one unrelated, deterministic recovery-membership assertion failure in the existingcold session, recovery completedcase.