Show progress for pending agent host sessions#316818
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves the Chat Sessions sidebar experience for Agent Host–backed sessions by ensuring locally-created sessions become visible once their first turn starts, and remain visible across refreshes until the backend session listing catches up.
Changes:
- Track locally-created “pending” Agent Host sessions with additional metadata and surface them in the list when the first turn starts.
- Preserve pending in-progress session rows across
refresh()even iflistSessions()doesn’t include them yet. - Add unit tests covering pending-session visibility and in-progress status behavior.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionListController.ts | Adds pending-session tracking and action-driven list updates to show progress and keep rows visible across refresh. |
| src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts | Adds/extends unit coverage asserting pending session progress visibility and persistence across refresh. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 1
| switch (action.type) { | ||
| case ActionType.SessionTurnStarted: { | ||
| const item = this._makeItem(rawId, { | ||
| title: action.userMessage.text.trim() || pending.title, | ||
| status: SessionStatus.InProgress, | ||
| createdAt: pending.createdAt, | ||
| modifiedAt: Date.now(), | ||
| }); | ||
| this._pendingNewSessions.set(rawId, { ...pending, item }); | ||
| this._upsertItem(item); | ||
| this._onDidChangeChatSessionItems.fire({ addedOrUpdated: [item] }); | ||
| break; | ||
| } | ||
| case ActionType.SessionTurnComplete: | ||
| case ActionType.SessionTurnCancelled: | ||
| case ActionType.SessionError: { | ||
| if (!pending.item) { | ||
| return; | ||
| } | ||
| const item = this._makeItem(rawId, { | ||
| title: pending.item.label, | ||
| status: action.type === ActionType.SessionError ? SessionStatus.Error : SessionStatus.Idle, | ||
| createdAt: pending.createdAt, | ||
| modifiedAt: Date.now(), | ||
| }); | ||
| this._pendingNewSessions.set(rawId, { ...pending, item }); | ||
| this._upsertItem(item); | ||
| this._onDidChangeChatSessionItems.fire({ addedOrUpdated: [item] }); | ||
| break; | ||
| } | ||
| } |
There was a problem hiding this comment.
Handled in 2528391. Pending rows now track session/inputRequested, session/inputCompleted, and session/activityChanged before backend listing reconciliation, and the focused test covers the NeedsInput/activity transitions.
9bc0b6d to
2528391
Compare
2528391 to
cded887
Compare
|
Updated after discussing the scope: cded887 uses the narrower fix. The item returned by |
There was a problem hiding this comment.
Copilot's findings
Comments suppressed due to low confidence (1)
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionListController.ts:227
- In
refresh, iflistSessions()throws, thecatchblock clearsthis._itemsand immediately emits an empty list. Since pending local sessions are now tracked in_pendingNewSessions, this will temporarily hide in-progress pending rows on transient backend errors (which can look like the session was cancelled). Consider preserving/re-emitting the pending items in the error path (e.g. set_itemsto the pending values, or merge them into the empty list) so refresh failures don’t drop locally-created sessions from the sidebar.
}
this._cacheValid = true;
} catch {
this._cachedSummaries.clear();
this._items = [];
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
cded887 to
6a4683e
Compare
|
Refined the simple fix in the latest push: |
1dd5eca to
28341ed
Compare
Track locally-created Agent Host chat sessions while they are pending backend listing and surface them as in-progress once a turn starts. Fixes #316543 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
28341ed to
53443e3
Compare
Fixes #316543
Summary