sessions: Show per-chat state in the sessions list (#338786) · code/app-vscode@d6b3034 · GitHub
Skip to content

Commit d6b3034

Browse files
sandy081Copilot
andauthored
sessions: Show per-chat state in the sessions list (microsoft#338786)
* sessions: Show per-chat state in the sessions list Display chat-local modified times, activity, and read state while preserving aggregate status on collapsed sessions. Mark opened chats read and propagate Agent Host chat activity and timestamps through live updates. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: Reconcile per-chat state projections Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: Add per-chat state fixtures Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: update chat state screenshot baselines Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: complete rename test chat state Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 808a55e commit d6b3034

21 files changed

Lines changed: 1040 additions & 151 deletions

‎src/vs/platform/agentHost/node/agentHostStateManager.ts‎

Lines changed: 15 additions & 9 deletions

‎src/vs/platform/agentHost/test/node/agentHostStateManager.test.ts‎

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,7 +1444,7 @@ suite('AgentHostStateManager', () => {
14441444
action: {
14451445
type: ActionType.SessionChatUpdated,
14461446
chat: peerChat,
1447-
changes: { status: SessionStatus.Idle | SessionStatus.IsArchived, activity: undefined },
1447+
changes: { status: SessionStatus.Idle | SessionStatus.IsArchived },
14481448
},
14491449
});
14501450
});
@@ -1633,15 +1633,14 @@ suite('AgentHostStateManager', () => {
16331633
);
16341634
});
16351635

1636-
test('a running peer chat forwards its own status to the session catalog so its tab can show progress', () => {
1636+
test('a running peer chat forwards its own progress to the session catalog', () => {
16371637
manager.createSession(makeSessionSummary());
16381638
manager.addChat(sessionUri, peerChat, { title: 'Peer' });
16391639

16401640
const envelopes: ActionEnvelope[] = [];
16411641
disposables.add(manager.onDidEmitEnvelope(e => envelopes.push(e)));
16421642

16431643
const peerCatalogStatus = () => manager.getSessionState(sessionUri)?.chats.find(c => c.resource === peerChat)?.status ?? SessionStatus.Idle;
1644-
const chatUpdatesForPeer = () => envelopes.filter(e => e.action.type === ActionType.SessionChatUpdated && (e.action as { chat: string }).chat === peerChat).length;
16451644

16461645
const idleCatalog = peerCatalogStatus();
16471646

@@ -1652,7 +1651,13 @@ suite('AgentHostStateManager', () => {
16521651
message: { text: 'b', origin: { kind: MessageKind.User } },
16531652
});
16541653
const runningCatalog = peerCatalogStatus();
1655-
const updatesAfterStart = chatUpdatesForPeer();
1654+
const updatesAfterStart = envelopes.filter(e => e.action.type === ActionType.SessionChatUpdated && e.action.chat === peerChat);
1655+
1656+
manager.dispatchServerAction(peerChat, {
1657+
type: ActionType.ChatActivityChanged,
1658+
activity: 'Running tests',
1659+
});
1660+
const updatesAfterActivity = envelopes.filter(e => e.action.type === ActionType.SessionChatUpdated && e.action.chat === peerChat);
16561661

16571662
manager.dispatchServerAction(peerChat, {
16581663
type: ActionType.ChatTurnComplete,
@@ -1665,13 +1670,28 @@ suite('AgentHostStateManager', () => {
16651670
idleCatalogInProgress: (idleCatalog & SessionStatus.InProgress) === SessionStatus.InProgress,
16661671
runningCatalogInProgress: (runningCatalog & SessionStatus.InProgress) === SessionStatus.InProgress,
16671672
finalCatalogInProgress: (peerCatalogStatus() & SessionStatus.InProgress) === SessionStatus.InProgress,
1668-
emittedChatUpdateOnStart: updatesAfterStart >= 1,
1673+
startUpdate: updatesAfterStart.at(-1)?.action,
1674+
activityUpdate: updatesAfterActivity.at(-1)?.action,
16691675
},
16701676
{
16711677
idleCatalogInProgress: false,
16721678
runningCatalogInProgress: true,
16731679
finalCatalogInProgress: false,
1674-
emittedChatUpdateOnStart: true,
1680+
startUpdate: {
1681+
type: ActionType.SessionChatUpdated,
1682+
chat: peerChat,
1683+
changes: {
1684+
status: SessionStatus.InProgress,
1685+
modifiedAt: '2025-01-01T00:00:00.000Z',
1686+
},
1687+
},
1688+
activityUpdate: {
1689+
type: ActionType.SessionChatUpdated,
1690+
chat: peerChat,
1691+
changes: {
1692+
activity: 'Running tests',
1693+
},
1694+
},
16751695
},
16761696
);
16771697
});

‎src/vs/sessions/SESSIONS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ Provider-specific configuration remains opaque to shared Sessions code. Scoped A
167167

168168
### Operations
169169

170-
Providers implement only operations advertised by their contracts, including request sending, model selection, rename, archive, read state, deletion, chat creation, and optional worktree disk-usage measurement. Shared cleanup UI consumes the optional measurement through the management service and remains independent of provider transport or filesystem details. Capability checks happen before invocation. Once invoked, an operation returns a defined result or rejects; unsupported behavior must not be reported as a success-shaped fallback.
170+
Providers implement only operations advertised by their contracts, including request sending, model selection, rename, archive, session read state, optional chat-scoped read state, deletion, chat creation, and optional worktree disk-usage measurement. Opening a chat marks that chat read; providers without chat-scoped state fall back to the owning session's read state. Shared cleanup UI consumes the optional measurement through the management service and remains independent of provider transport or filesystem details. Capability checks happen before invocation. Once invoked, an operation returns a defined result or rejects; unsupported behavior must not be reported as a success-shaped fallback.
171171

172172
### Provider ownership
173173

‎src/vs/sessions/contrib/providers/agentHost/AGENT_HOST_SESSIONS_PROVIDER.md‎

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)