agentHost: centralize session and chat catalog metadata - #332410
Draft
Sandeep Somavarapu (sandy081) wants to merge 19 commits into
Draft
agentHost: centralize session and chat catalog metadata#332410Sandeep Somavarapu (sandy081) wants to merge 19 commits into
Sandeep Somavarapu (sandy081) wants to merge 19 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
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>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adopts the upstream Agent Host provider-service and chat-contribution refactors while keeping the session-catalog (Option D) work: - Rebases the durable `sessions.modified_time` column onto the sessions_v2 chain as migration 9, and adds `sessions_v2.modified_time` as migration 10 so the authoritative registry owns recency in both tables. - Threads `modifiedTime` through every sessions_v2 read, registration, envelope upsert and receipt, and makes `updateSessionModifiedTime` advance both registries in one transaction. - Moves provider registration onto `IAgentHostProviderService` while preserving catalog reconciliation scheduling and serialized discovery registrations, and routes deferred provider catalogs through the sessions_v2 importer. - Renames the catalog payload's artifact flag to `isArtifact` and adopts the upstream artifact parse contract. - Lets the catalog list reader serve the fresher of the payload and registry recency, and withholds the readable-catalog marker when an import pass leaves candidates unimported. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| )`, | ||
| ].join(';\n'), | ||
| }, | ||
| ] as const; |
There was a problem hiding this comment.
These are all coming in in one PR, so they can be collapsed into a single migration.
| @@ -116,11 +226,167 @@ const migrations = [ | |||
| }, | |||
| { | |||
| version: 4, | |||
There was a problem hiding this comment.
v4 is an existing migration, you'll need to make a new one as it won't re-run
|
|
||
| constructor(private readonly _dependencies: IAgentHostCatalogSourceResolverDependencies) { } | ||
|
|
||
| async buildCatalogSyncRequest(session: URI, state: ICatalogSourceState, metadataOverrides: Readonly<Record<string, string>>, preferPersistedMetadata: boolean): Promise<IAgentHostCatalogSyncRequest> { |
There was a problem hiding this comment.
Seems easy to miss something here. Could we centralize metadata definitions to have like
- Each session metadata being defined through some well-known
ISessionMetadataKeyinstance that defines the key+necessary behaviors - A single array of all
ISessionMetadataKey[]so this function just maps over those well-known keys?
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>
Contributor
|
Base:
|
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>
…on-db-data-migration-plan
…on-db-data-migration-plan
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Centralizes Agent Host session-list data in
agent-host.dbwhile retaining isolated per-session and per-chat databases for data needed only after opening a conversation.The final model has three explicit ownership boundaries:
sessions_v2envelope is authoritative session identity and provenance;Turns, drafts, annotations, attachments, detailed changesets, file-edit contents, and provider-native conversation data remain isolated in their session/chat databases.
Data ownership
sessions_v2envelope inagent-host.dbsession_chat_catalogs/session_chatsinagent-host.dbThe aggregate payload is therefore a materialized list view, not a second authority. It contains resolved session presentation, primary source-control summaries, bounded artifacts/change counts, and lightweight chat summaries. If it is missing or stale, it can be rebuilt from the authoritative central registry plus provider and session/chat-local state.
Terminology note: “Chat” may later be renamed to sub-session, nested session, or runtime session.
Central catalog
sessions_v2registry/catalog.Authoritative chat membership
session_chat_catalogsandsession_chatstables.Each chat database remains self-contained for chat-local state. Chat titles and provider backing are persisted locally, while the central catalog retains the lightweight copies needed to enumerate, route, and present the containing session.
Downgrade compatibility
peerChatssession metadata during the cooling period.sessionsregistry compatibility, tombstones, exclusions, and old-build pending catalog receipts.After the compatibility window, the legacy participant/importer and duplicated
peerChatsmetadata can be removed without changing the central authority model.Rebuildable aggregate
The central payload contains only list-ready session information:
It is rebuilt from central identity/membership, provider state, and session/chat-local metadata. Normal session listing reads the stored aggregate and does not open every conversation database.
Migration and recovery
Validation
Scope
This does not centralize conversation history or file-edit BLOBs. The per-chat database boundary remains load-bearing for turn ordering, deletion cost, concurrency isolation, and corruption blast radius.