Sessions list can show stale In Progress status when input is needed
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
## Repro / user impact
1. Start an Agent Host session that has multiple chats, such as a main chat and a tool-created subagent chat.
2. Leave the session open long enough for the provider's 30-second full session-state subscription lease to expire, or switch away so that the session is no longer visible.
3. Let the main chat reach a point where it asks the user for input.
4. Observe the session in the Sessions list.
5. Click the session to open it.
**Actual:** Before opening the session, its list row can continue to show **In Progress** even though the session is waiting for input. Opening it immediately changes the row to **Input Needed**.
**Expected:** The Sessions list should change to **Input Needed** as soon as the main chat requests input, without requiring the user to open the session.
This makes sessions that require attention look as if they are still doing background work, so users can miss or delay required input.
## Confirmed behavior
An Agent Host debug trace captured the following sequence:
- The main chat started an `ask_user` tool call.
- The host emitted `session/chatUpdated` with `InputNeeded`.
- The host emitted `root/sessionSummaryChanged` with `InputNeeded | IsRead`.
- Later `listSessions` responses also returned `InputNeeded | IsRead`.
- The Sessions list continued to show the stale state until the session was opened.
This confirms that the Agent Host's session summary is current; the stale state is in the VS Code-side presentation path.
## Root cause
The primary Sessions list intentionally derives the parent row from the main chat rather than the aggregate `session.status`. It also shows `InProgress` when any chat is active:
https://github.com/microsoft/vscode/blob/main/src/vs/sessions/contrib/sessions/browser/views/sessionsList.ts#L224-L234
For multi-chat Agent Host sessions, `mainChat.status` comes from a separate default-chat status override populated by the full `SessionState` chat catalog:
https://github.com/microsoft/vscode/blob/main/src/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider.ts#L1289-L1294
The provider releases that full session-state subscription after 30 seconds when it is no longer pinned by a visible session:
https://github.com/microsoft/vscode/blob/main/src/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider.ts#L5392
After the lease expires, `root/sessionSummaryChanged` correctly updates the aggregate `session.status`, but it does not update the cached default-chat status. The list continues reading the stale `mainChat.status`. Opening the session re-establishes the full-state subscription and applies the current chat catalog, which makes the row update.
There is already a provider test that demonstrates the underlying stale-cache behavior after the subscription expires:
https://github.com/microsoft/vscode/blob/main/src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts#L6573
## Fix considerations
Copying the aggregate status into `mainChat.status` is not generally correct: a peer chat can promote the aggregate session to `InputNeeded`, while the parent row is intentionally supposed to reflect the main chat. A complete fix likely needs either:
- enough default-chat/active-chat information in the lightweight session summary and its deltas; or
- a different subscription strategy that keeps the status inputs used by visible list rows current.
The relevant parent-row behavior was introduced in #332931 and extended in #333999.
(Written by Copilot)
Contributor guide
Assessment
This issue has not been assessed yet.