905
}
906
return s;
908
>
909
>
// Overlay any session known to state but missing from the providers'
910
>
// `listSessions` snapshot, so renderer-side caches don't evict a
911
>
// live/active session (which would close the chat view holding the
912
>
// in-flight response bubble). Two cases need this: a provider can
913
>
// transiently drop a session (e.g. `CopilotAgent.listSessions` returns
914
>
// an empty array right after `session/turnComplete`), and a provisional
915
>
// session (created but not yet materialized — see `createSession`) that
916
>
// has had any turn activity must stay visible until it materializes.
917
>
// Idle provisional sessions are deliberately *not* overlaid so the
918
>
// new-session composer's eagerly-created session doesn't leak into the
919
>
// list before its first message (#321269).
920
>
const known = new Set(withStatus.map(s => s.session.toString()));
921
>
const additions: IAgentSessionMetadata[] = [];
922
>
for (const summary of this._stateManager.getOverlaySessionSummaries()) {
923
if (known.has(summary.resource)) {
924
continue;