agentHost: centralize session list metadata in sessions_v2 - #332410
Draft
Sandeep Somavarapu (sandy081) wants to merge 4 commits into
Draft
agentHost: centralize session list metadata in sessions_v2#332410Sandeep Somavarapu (sandy081) wants to merge 4 commits into
Sandeep Somavarapu (sandy081) wants to merge 4 commits into
Conversation
Add a backward-compatible sessions_v2 catalog, legacy-first synchronization receipts, reconciliation, shadow validation, central fallback reads, and durable chat metadata while retaining open-only content in per-session databases.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adapt the sessions_v2 catalog and reconciliation work to the latest Agent Host composition, adoption, metadata, and test infrastructure changes.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Make sessions_v2 an independent current registry, import directly from current, legacy, and provider sources, mirror runtime identities for downgrade compatibility, and reconcile cross-version changes with durable exclusions and versioned markers.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move catalog source resolution and downgrade-compatible peer chat persistence out of AgentService into focused helpers without changing migration or runtime behavior.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot started reviewing on behalf of
Sandeep Somavarapu (sandy081)
August 24, 2026 19:08
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Introduces a centralized, verified sessions_v2 catalog for efficient Agent Host session listing, migration, downgrade compatibility, and recovery.
Changes:
- Adds catalog schemas, canonical projections, synchronization receipts, migration, reconciliation, and shadow validation.
- Integrates central listing with session mutations, peer chats, Git state, titles, and legacy adoption.
- Adds extensive persistence, compatibility, recovery, and rollout tests.
Show a summary per file
| File | Description |
|---|---|
src/vs/platform/agentHost/common/agent.ts |
Extends adoption results with recovered list metadata. |
src/vs/platform/agentHost/common/sessionDataService.ts |
Defines catalog synchronization receipt APIs. |
src/vs/platform/agentHost/node/agentHostBootstrap.ts |
Wires catalog persistence into bootstrap. |
src/vs/platform/agentHost/node/agentHostCatalogListReader.ts |
Converts verified catalog rows into list metadata. |
src/vs/platform/agentHost/node/agentHostCatalogProjection.ts |
Implements canonical bounded projections and hashing. |
src/vs/platform/agentHost/node/agentHostCatalogReconciliationService.ts |
Repairs interrupted or stale synchronization. |
src/vs/platform/agentHost/node/agentHostCatalogShadowValidator.ts |
Compares central and legacy listing results. |
src/vs/platform/agentHost/node/agentHostCatalogSourceResolver.ts |
Resolves canonical catalog source metadata. |
src/vs/platform/agentHost/node/agentHostCatalogSyncService.ts |
Coordinates local-first catalog synchronization. |
src/vs/platform/agentHost/node/agentHostDatabase.ts |
Adds sessions_v2, exclusions, and compatibility migrations. |
src/vs/platform/agentHost/node/agentHostGitStateService.ts |
Persists Git summaries through the catalog path. |
src/vs/platform/agentHost/node/agentHostPeerChatStore.ts |
Persists downgrade-compatible peer-chat membership. |
src/vs/platform/agentHost/node/agentHostServices.ts |
Registers catalog-aware persistence dependencies. |
src/vs/platform/agentHost/node/agentHostSessionTitleController.ts |
Routes title metadata through catalog synchronization. |
src/vs/platform/agentHost/node/agentHostSessionsV2MigrationService.ts |
Implements direct, resumable v2 migration. |
src/vs/platform/agentHost/node/agentService.ts |
Integrates migration, listing, synchronization, and peer chats. |
src/vs/platform/agentHost/node/agentServiceComposition.ts |
Supplies catalog persistence callbacks. |
src/vs/platform/agentHost/node/agentSessionRegistry.ts |
Adds dual-registry compatibility behavior. |
src/vs/platform/agentHost/node/agentSideEffects.ts |
Persists list-visible state changes centrally. |
src/vs/platform/agentHost/node/copilot/copilotAgent.ts |
Updates legacy adoption and metadata recovery. |
src/vs/platform/agentHost/node/localCommands/localChatCommand.ts |
Extends coordinated metadata persistence. |
src/vs/platform/agentHost/node/localCommands/renameLocalCommand.ts |
Persists title and title-source metadata together. |
src/vs/platform/agentHost/node/sessionCoordination.ts |
Integrates catalog-aware session coordination. |
src/vs/platform/agentHost/node/sessionDatabase.ts |
Adds synchronization snapshot storage and transactions. |
src/vs/platform/agentHost/test/common/sessionTestHelpers.ts |
Extends test database helpers for receipts. |
src/vs/platform/agentHost/test/node/agentHostCatalogListReader.test.ts |
Tests central row conversion and eligibility. |
src/vs/platform/agentHost/test/node/agentHostCatalogProjection.test.ts |
Tests canonicalization, limits, and verification. |
src/vs/platform/agentHost/test/node/agentHostCatalogReconciliationService.test.ts |
Tests repair and interrupted-write recovery. |
src/vs/platform/agentHost/test/node/agentHostCatalogShadowValidator.test.ts |
Tests shadow mismatch classification. |
src/vs/platform/agentHost/test/node/agentHostCatalogSourceResolver.test.ts |
Tests source and legacy metadata resolution. |
src/vs/platform/agentHost/test/node/agentHostCatalogSyncService.test.ts |
Tests synchronization ordering and recovery. |
src/vs/platform/agentHost/test/node/agentHostDatabase.test.ts |
Tests v2 schema and compatibility behavior. |
src/vs/platform/agentHost/test/node/agentHostGitStateService.test.ts |
Tests catalog-backed Git persistence. |
src/vs/platform/agentHost/test/node/agentHostPeerChatStore.test.ts |
Tests peer-chat storage and malformed data handling. |
src/vs/platform/agentHost/test/node/agentHostServices.test.ts |
Tests service dependency registration. |
src/vs/platform/agentHost/test/node/agentHostSessionTitleController.test.ts |
Tests coordinated title persistence. |
src/vs/platform/agentHost/test/node/agentHostTurnTelemetry.test.ts |
Updates telemetry fixtures for persistence wiring. |
src/vs/platform/agentHost/test/node/agentService.test.ts |
Tests rollout modes, migration, compatibility, and adoption. |
src/vs/platform/agentHost/test/node/agentServiceTestUtils.ts |
Extends AgentService database test doubles. |
src/vs/platform/agentHost/test/node/agentSessionRegistry.test.ts |
Tests dual-registry session lifecycle behavior. |
src/vs/platform/agentHost/test/node/agentSideEffects.test.ts |
Tests catalog persistence from state changes. |
src/vs/platform/agentHost/test/node/copilotAgent.test.ts |
Tests legacy adoption metadata behavior. |
src/vs/platform/agentHost/test/node/sessionCoordination.test.ts |
Tests catalog-aware coordination behavior. |
src/vs/platform/agentHost/test/node/sessionDatabase.test.ts |
Tests receipt migration and atomic persistence. |
src/vs/sessions/contrib/providers/agentHost/AGENT_HOST_SESSIONS_PROVIDER.md |
Documents the centralized catalog architecture. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 44/45 changed files
- Comments generated: 7
- Review effort level: Balanced
| legacyMetadata: { customTitle: 'one', [META_GIT_STATE]: '{"branch":"first"}' }, | ||
| }); | ||
|
|
||
| test('advances changed content beyond a newer local pending revision after central failure', async () => { |
| repairs: 1, | ||
| }); | ||
|
|
||
| test('validates central-only rows against durable top-level eligibility', async () => { |
| ...(peerChatOrigin !== undefined ? { origin: peerChatOrigin } : {}), | ||
| }, | ||
| ]; | ||
| this._catalogSyncSuppressedSessions.add(sessionKey); |
Comment on lines
+3311
to
+3316
| // The host owns list-visible state (title / read): report it back so it | ||
| // lands in the session catalog and the per-session database together, | ||
| // instead of writing a half of it here. | ||
| const listVisible = customTitle !== undefined | ||
| ? { title: customTitle, titleSource: 'user' as const, isRead: true } | ||
| : { isRead: true }; |
| return { status: 'incomplete' }; | ||
| } | ||
|
|
||
| const newlyRegistered = !effectiveCandidate.current; |
Comment on lines
+3189
to
+3193
| const catalogChats = [ | ||
| ...existingCatalogChats, | ||
| { | ||
| uri: chat.toString(), | ||
| kind: 'peer' as const, |
Comment on lines
+3336
to
+3339
| [customChatTitleSourceMetadataKey(chatKey)]: '', | ||
| }, | ||
| this._catalogChatsFromState(state).filter(candidate => candidate.uri !== chatKey), | ||
| ); |
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
This change introduces an independent, host-wide
sessions_v2registry/catalog for Agent Host session and chat list metadata.The current session list path reconstructs each entry by enumerating providers and opening individual per-session databases. That makes startup/listing dependent on provider availability and causes work proportional to the number of sessions. It also spreads host-owned list metadata across provider state and many
session.dbfiles.sessions_v2stores one bounded, verified row per session so current builds can list eligible sessions centrally. Turns, messages, drafts, annotations, detailed changesets, and opaque provider backing remain insession.dband continue to load only when a session or chat is opened.What changed
Central session catalog
sessions_v2registry/catalog toagent-host.db.sessionsregistry as an optional compatibility source rather than a prerequisite.Direct migration
sessions_v2, optional predecessorsessionsrows, and provider/SDK discovery by stable session URI.Cross-version compatibility
sessionsduring the cooling window.Crash recovery and reconciliation
Read rollout
legacy,shadow,centralWithFallback, andcentralmodes.Code organization
This reduces the migration-specific growth in
AgentServiceby roughly 482 lines compared with the initial implementation.Why
session.dbduring normal verified listing.Compatibility and safety
Validation
npm run compilenpm run typecheck-clientnpm run valid-layers-checkReviewer notes
The production default remains conservative; central read modes are internal rollout controls. The larger diff is primarily the database migration/compatibility contract and focused failure/recovery tests rather than UI behavior.