Support multi-root Agent Host session metadata (#328863)

* Support multi-root Agent Host session metadata

Persist Editor workspace provenance on Agent Host sessions and use it for authoritative multi-root session filtering. Remove the temporary workspace membership memento.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address multi-root session review feedback

Apply workspace-file filtering across folder-count transitions, sanitize provider metadata before database fallbacks, and exercise cache deserialization in tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Don Jayamanne
2026-08-03 23:52:54 +00:00
committed by GitHub
co-authored by Copilot
parent e64d2d1571
commit dce00340cb
21 changed files with 539 additions and 690 deletions
@@ -788,22 +788,25 @@ suite('ProtocolServerHandler', () => {
assert.deepStrictEqual(result.items.map(item => item._meta), [undefined]);
});
test('createSession returns null and broadcasts project in sessionAdded summary', async () => {
test('createSession forwards request metadata and broadcasts project in sessionAdded summary', async () => {
const transport = connectClient('client-create');
transport.sent.length = 0;
const responsePromise = waitForResponse(transport, 2);
const newSession = URI.parse('copilot:///created-session').toString();
transport.simulateMessage(request(2, 'createSession', { channel: newSession }));
const _meta = { multiRoot: { workspaceFile: 'file:///demo.code-workspace', name: 'Demo' } };
transport.simulateMessage(request(2, 'createSession', { channel: newSession, _meta }));
const resp = await responsePromise;
const added = findNotifications(transport.sent, 'root/sessionAdded')[0];
assert.deepStrictEqual({
result: (resp as { result: null }).result,
project: (added!.params as SessionAddedParams).summary.project,
_meta: agentService.createSessionConfigs.at(-1)?._meta,
}, {
result: null,
project: { uri: 'file:///created-project', displayName: 'Created Project' },
_meta,
});
});