Skip to content

Show progress for pending agent host sessions#316818

Draft
roblourens wants to merge 1 commit into
mainfrom
agents/vsckb-implement-fix-316543-b940d2b2
Draft

Show progress for pending agent host sessions#316818
roblourens wants to merge 1 commit into
mainfrom
agents/vsckb-implement-fix-316543-b940d2b2

Conversation

@roblourens
Copy link
Copy Markdown
Member

@roblourens roblourens commented May 16, 2026

Fixes #316543

Summary

  • surface locally-created Agent Host chat sessions once their first turn starts\n- keep pending in-progress session rows visible across refresh until backend listing reconciles them\n- add unit coverage for pending local session progress visibility\n\n## Validation\n- npm run compile-check-ts-native\n- ./scripts/test.sh --run src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts --grep "pending new session|newChatSessionItem creates"\n- node --experimental-strip-types build/hygiene.ts src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionListController.ts src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts\n- npm run valid-layers-check

Copilot AI review requested due to automatic review settings May 16, 2026 23:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 if listSessions() 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

Comment on lines +143 to +173
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;
}
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@roblourens roblourens force-pushed the agents/vsckb-implement-fix-316543-b940d2b2 branch from 9bc0b6d to 2528391 Compare May 17, 2026 00:04
@roblourens roblourens force-pushed the agents/vsckb-implement-fix-316543-b940d2b2 branch from 2528391 to cded887 Compare May 17, 2026 00:39
@roblourens
Copy link
Copy Markdown
Member Author

Updated after discussing the scope: cded887 uses the narrower fix. The item returned by newChatSessionItem is inserted into the controller list and emitted immediately, then preserved only until backend listing reconciliation. This avoids the extra action-driven pending-state handling.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot's findings

Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionListController.ts:227

  • In refresh, if listSessions() throws, the catch block clears this._items and 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 _items to 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

@roblourens roblourens force-pushed the agents/vsckb-implement-fix-316543-b940d2b2 branch from cded887 to 6a4683e Compare May 17, 2026 01:14
@roblourens
Copy link
Copy Markdown
Member Author

Refined the simple fix in the latest push: _pendingNewSessions is back to just a Set of draft ids. The actual running row is inserted into _items at newChatSessionItem, and refresh() preserves existing _items rows whose ids are still pending and not yet backend-listed.

@roblourens roblourens force-pushed the agents/vsckb-implement-fix-316543-b940d2b2 branch 2 times, most recently from 1dd5eca to 28341ed Compare May 17, 2026 01:51
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>
@roblourens roblourens force-pushed the agents/vsckb-implement-fix-316543-b940d2b2 branch from 28341ed to 53443e3 Compare May 17, 2026 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AgentHost: local AH sessions don't show progress in vscode

2 participants