Skip to content

agentHost: Synchronize session read state from chats - #339732

Merged
Sandeep Somavarapu (sandy081) merged 4 commits into
mainfrom
sandy081/agents/sync-session-read-aggregate
Oct 5, 2026
Merged

Sandeep Somavarapu (sandy081) merged 4 commits into
mainfrom
sandy081/agents/sync-session-read-aggregate

Conversation

@sandy081

Copy link
Copy Markdown
Member

What Changed

  • Synchronize the session read state in Agent Host when a participating chat changes read state.
  • Promote the session only when the last unread participating chat becomes read.
  • Keep hidden and tool chats outside the aggregate, and preserve an explicitly unread session on redundant chat-read actions.
  • Add state-manager and Agent Service coverage for single-chat, multi-chat, and persistence behavior.

Why

When a completed turn marked both the chat and session unread, viewing the chat only marked the chat read. The session could therefore remain unread and become visibly unread again after a later session-list refresh. Agent Host owns the complete chat catalog, so it now performs the aggregate transition authoritatively instead of relying on the client.

Testing

  • npm run compile — passed
  • npm run hygiene — passed
  • ./scripts/test.sh --run src/vs/platform/agentHost/test/node/agentHostStateManager.test.ts --run src/vs/platform/agentHost/test/node/agentService.test.ts --grep "marking a chat unread|marking the sole unread chat read|only the last unread aggregate chat|keeps the session unread when another chat is unread|promotes and persists the session when the last unread chat becomes read" — 5 passing

Dispatch the session-level read action whenever a participating chat changes the effective aggregate, while leaving hidden and tool chats independent.

Co-authored-by: Copilot <[email protected]>
Move aggregate read-state authority to Agent Host so clients only dispatch chat changes. Promote the session when the last participating unread chat becomes read, while preserving explicitly unread sessions on redundant chat updates.

Co-authored-by: Copilot <[email protected]>
Keep session aggregate synchronization as an Agent Host implementation detail without changing the existing protocol action contract.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 5, 2026 11:00
@sandy081 Sandeep Somavarapu (sandy081) added this to the 1.141.0 milestone Oct 5, 2026

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.

Copilot review overview

🟢 Approval recommended

The implementation matches the stated aggregation rules and includes focused coverage for transitions, exclusions, and persistence.

Review effort: Balanced
Findings: None

What changed in this PR

Synchronizes Agent Host session read state with participating chats while preserving explicit unread state.

Changes:

  • Promotes sessions when the final unread participating chat becomes read.
  • Excludes hidden and tool chats from aggregation.
  • Adds state, persistence, and multi-chat tests plus documentation.
File Description
AGENT_HOST_SESSIONS_PROVIDER.md Documents read-state synchronization.
agentService.test.ts Tests multi-chat behavior and persistence.
agentHostStateManager.test.ts Covers aggregation and redundant actions.
agentHostStateManager.ts Implements bidirectional read-state synchronization.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: 16023148 Current: abc87d51

Changed (1)

chat/aiCustomizations/aiCustomizationManagementEditor/DiscoverPluginsLoadingMore/Light
Before After
before after

2 insignificant change(s) omitted (≤20 px, Δ≤2). See CI logs for details.

Apply an explicit session read action before synchronizing its sole chat so the chat transition does not recursively promote and persist the same session state twice.

Co-authored-by: Copilot <[email protected]>
@sandy081
Sandeep Somavarapu (sandy081) merged commit 7da3a97 into main Oct 5, 2026
35 checks passed
@sandy081
Sandeep Somavarapu (sandy081) deleted the sandy081/agents/sync-session-read-aggregate branch October 5, 2026 12:56
@sandy081 Sandeep Somavarapu (sandy081) added the ~release-cherry-pick Trigger: cherry-pick this PR to the latest release branch label Oct 5, 2026
@vs-code-engineering vs-code-engineering Bot added release-cherry-pick Automated cherry-pick between release and main branches and removed ~release-cherry-pick Trigger: cherry-pick this PR to the latest release branch labels Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-cherry-pick Automated cherry-pick between release and main branches

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants