fix: align chat MCP tooling with session project

Resolve chat tooling from the selected session's project instead of the
separately tracked selectedProjectId so project-scoped discovered MCPs do
not appear for the wrong session. Also synchronize selectedProjectId when
a session is selected and add regression tests for both behaviors.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Kaya
2026-03-25 21:57:30 +01:00
co-authored by Copilot
parent e5878ba9e8
commit c8bb9d6f59
5 changed files with 112 additions and 5 deletions
+12
View File
@@ -852,6 +852,18 @@ export class EryxAppService extends EventEmitter<AppServiceEvents> {
async selectSession(sessionId?: string): Promise<WorkspaceState> {
const workspace = await this.loadWorkspace();
if (sessionId) {
const session = this.requireSession(workspace, sessionId);
const project = this.requireProject(workspace, session.projectId);
const didSyncProjectTooling = await this.syncProjectDiscoveredTooling(workspace, project);
if (didSyncProjectTooling) {
this.pruneUnavailableSessionToolingSelections(workspace);
await this.pruneUnavailableApprovalTools(workspace);
}
workspace.selectedProjectId = session.projectId;
}
workspace.selectedSessionId = sessionId;
return this.persistAndBroadcast(workspace);
}