3058
*/
3059
private async _releaseSessionResources(sessionId: string): Promise<void> {
3060
>
// Tear down any peer chats owned by this session first so their SDK
copilotAgent.ts
3061
>
// chats don't leak when the parent is deleted/disposed
3062
>
// without each chat being individually disposed via `disposeChat`.
3063
>
this._disposeChildChats(sessionId);
3064
>
// Provisional sessions have no SDK session, no worktree, and no
3065
>
// on-disk metadata — drop the in-memory record and clean up the
3066
>
// active-client snapshot. The state-manager entry is removed by the
3067
>
// caller via {@link IAgentService.disposeSession}.
3068
>
const provisional = this._provisionalSessions.get(sessionId);
3069
>
if (provisional) {
3070
this._provisionalSessions.delete(sessionId);
3071
// Drop any peer-host entry created for this still-provisional