Skip to content

agentHost: add session-specific metadata#305348

Merged
connor4312 merged 8 commits intomainfrom
connor4312/edit-metadata
Mar 27, 2026
Merged

agentHost: add session-specific metadata#305348
connor4312 merged 8 commits intomainfrom
connor4312/edit-metadata

Conversation

@connor4312
Copy link
Copy Markdown
Member

Adds a SQLite DB for session-specific metadata. Stores edits in there. It can almost restore edits, but I still need to make undoStops be similarly persisted. That is a project for later this evening.

Adds a SQLite DB for session-specific metadata. Stores edits in there.
It can _almost_ restore edits, but I still need to make undoStops be
similarly persisted. That is a project for later this evening.
Copilot AI review requested due to automatic review settings March 26, 2026 22:47
@connor4312 connor4312 enabled auto-merge (squash) March 26, 2026 22:47
@connor4312 connor4312 self-assigned this Mar 26, 2026
@vs-code-engineering
Copy link
Copy Markdown
Contributor

vs-code-engineering bot commented Mar 26, 2026

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@jrieken

Matched files:

  • src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.ts

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds per-session persistent storage to the agent host by introducing a SQLite-backed session database. This enables restoring session-specific metadata (notably file-edit snapshots) across server lifetimes and wiring those snapshots into tool result rendering via session-db: content URIs.

Changes:

  • Introduces SessionDatabase (SQLite + migrations) and exposes it via a ref-counted ISessionDataService.openDatabase() API.
  • Persists edit-tool file snapshots into the DB and restores file-edit metadata into mapped tool results using session-db: URIs.
  • Adjusts session removal semantics (removeSession vs deleteSession) and adds/updates tests for the new persistence and mapping behavior.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.ts Minor catch-clause tweak while reading snapshots.
src/vs/platform/agentHost/test/node/sessionStateManager.test.ts Updates tests for new removeSession vs deleteSession behavior.
src/vs/platform/agentHost/test/node/sessionDatabase.test.ts New comprehensive test suite for migrations, turns, and file-edit persistence.
src/vs/platform/agentHost/test/node/sessionDataService.test.ts Adds tests for DB ref-counting via openDatabase().
src/vs/platform/agentHost/test/node/mapSessionEvents.test.ts New tests for mapping session events and restoring file edits from DB.
src/vs/platform/agentHost/test/node/fileEditTracker.test.ts Updates tests to use DB-backed snapshots and session-db: URIs.
src/vs/platform/agentHost/test/node/agentSideEffects.test.ts Updates ISessionDataService mock to include openDatabase().
src/vs/platform/agentHost/test/node/agentService.test.ts Updates ISessionDataService mock to include openDatabase().
src/vs/platform/agentHost/node/sessionStateManager.ts Splits removal into non-notifying removeSession and notifying deleteSession.
src/vs/platform/agentHost/node/sessionDatabase.ts New SQLite-backed DB implementation with migrations + file-edit APIs.
src/vs/platform/agentHost/node/sessionDataService.ts Adds ref-counted DB collection and openDatabase() implementation.
src/vs/platform/agentHost/node/copilot/mapSessionEvents.ts New standalone mapper that can restore file edits from the DB.
src/vs/platform/agentHost/node/copilot/fileEditTracker.ts Persists before/after snapshots to DB and emits session-db: URIs.
src/vs/platform/agentHost/node/copilot/copilotAgent.ts Integrates DB + event mapper and persists edits per tool completion.
src/vs/platform/agentHost/node/agentSideEffects.ts Fetches session-db: content by reading file-edit blobs from the DB.
src/vs/platform/agentHost/node/agentService.ts Uses deleteSession and restores sessions on subscribe when needed.
src/vs/platform/agentHost/common/sessionDataService.ts Extends the public agent-host API with ISessionDatabase + openDatabase().
src/vs/platform/agentHost/common/agentHostUri.ts Avoids bypassing wrapping for local non-file schemes (e.g. session-db:).
src/vs/platform/agentHost/common/agentHostFileSystemProvider.ts Treats session-db: as a file-like resource for stat.

DonJayamanne
DonJayamanne previously approved these changes Mar 26, 2026
DonJayamanne
DonJayamanne previously approved these changes Mar 27, 2026
@bpasero
Copy link
Copy Markdown
Member

bpasero commented Mar 27, 2026

@connor4312 looks like real unit test failures on Windows

bpasero
bpasero previously approved these changes Mar 27, 2026
@connor4312 connor4312 disabled auto-merge March 27, 2026 16:47
@connor4312 connor4312 enabled auto-merge March 27, 2026 16:48
roblourens
roblourens previously approved these changes Mar 27, 2026
@connor4312 connor4312 merged commit fa311ec into main Mar 27, 2026
18 checks passed
@connor4312 connor4312 deleted the connor4312/edit-metadata branch March 27, 2026 18:44
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.

5 participants