Does this issue occur when all extensions are disabled?: Yes. This occurs in the core Agent Host session lifecycle. It was reproduced in automated eval containers using the eval driver extension.
- VS Code Version: Insiders commits
5a36a9c68ce6 (2026-08-10) and 22231c1c3817 (2026-08-11). It was not observed on 8eaafbf4220a (2026-08-07).
- OS Version: Linux x64, containerized
- Feature: Agents window, Agent Host / Copilot CLI provider, new-session flow
Summary
A new Agent Host chat can get stuck on Working... forever before the first model turn starts.
In the failing path, VS Code:
- Materializes a new
copilotcli:/<session-id> session.
- Subscribes to that session in the Agent Host backend.
- Receives
-32001 Session not found on backend.
- Never creates the missing backend session, surfaces the error, or completes the chat request.
This is a timing-dependent regression. In our automated runs it affected roughly 25-34% of attempts across OpenAI, Anthropic, Google, and other models. The model provider is not involved: affected attempts emit no model, chat, or tool spans.
Steps to Reproduce
The race reproduces probabilistically in our environment:
- Run
workbench.action.chat.openNewSessionSidebar.agent-host-copilotcli.
- Immediately run
workbench.action.chat.open with a prompt, without waiting for eager backend-session creation to settle.
- Observe that some attempts remain on Working... indefinitely.
Our harness sends the two commands back to back. Successful attempts had only a 2-66 ms margin between backend createSession and chat.open.
Expected
The backend session is created before it is used. If session creation fails or is superseded, the chat request fails promptly with an actionable error.
Actual
VS Code subscribes to a backend session that does not exist. No model turn starts, and the request remains pending until externally cancelled. In our harness that happened after approximately 105 minutes.
Evidence at a glance
- All 4/4 hung instances sent zero
createSession requests.
- All 6/6 healthy controls sent two
createSession requests.
- Hung instances sent
subscribe and received -32001 Session not found on backend.
- Hung instances emitted zero
invoke_agent, chat, and execute_tool spans.
- Healthy and hung controls came from the same runs, builds, images, and scenarios.
- The regression appeared between
8eaafbf4220a and 5a36a9c68ce6; the evaluation harness did not change across that boundary.
Could the Agent Host owners please investigate the new-session materialization/session-creation race and ensure this path either creates a valid backend session or fails promptly? The detailed evidence below is intended to help with diagnosis; I am deliberately not prescribing the implementation because the owning team has more context.
Technical evidence and investigation notes
First divergence
Failing AHP wire log:
12:28:47.567Z c2s id=6 resolveSessionConfig
12:28:47.659Z c2s id=7 subscribe copilotcli:/24d3feef-7f28-4d16-a07b-df052d4f4c82
12:28:47.806Z s2c id=7 error -32001 Session not found on backend: copilotcli:/24d3feef-7f28-4d16-a07b-df052d4f4c82
There is no createSession request anywhere in the failing wire log.
Matched healthy instance from the same run and build:
14:17:02.618Z c2s id=10 createSession copilotcli:/6de9cc29-f86e-4ae0-809e-4c4effa362c6
14:17:02.695Z c2s id=11 subscribe copilotcli:/6de9cc29-f86e-4ae0-809e-4c4effa362c6
14:17:02.696Z c2s id=12 createSession copilotcli:/1b9e0af5-7246-4ffc-8e6b-243344e02ecd
14:17:02.856Z c2s id=14 subscribe copilotcli:/1b9e0af5-7246-4ffc-8e6b-243344e02ecd
Client log
12:28:47.511Z Starting command execution: workbench.action.chat.openNewSessionSidebar.agent-host-copilotcli
12:28:47.613Z Command ...openNewSessionSidebar... completed in 92ms
12:28:47.622Z Starting command execution: workbench.action.chat.open
12:28:47.646Z ChatService#materializeUntitledSession: Materialized untitled session into real session
12:28:47.787Z [AgentHost] _invokeAgent called
12:28:47.815Z [RemoteAgentHostProtocol] Request 7 failed: -32001 Session not found on backend
12:28:47.816Z [AgentHost] _readEagerlyCreatedSessionState: hydrated value=error(Session not found on backend)
12:28:47.823Z [AgentHost:stderr] SyntaxError: Unexpected end of JSON input
12:28:47.824Z [AgentHost:stderr] SyntaxError: Unexpected end of JSON input
... no agent progress ...
14:13:47.495Z Command workbench.action.chat.open completed in 6299849ms after external cancellation
Evidence matrix
| Population |
Instances |
createSession |
resolveSessionConfig |
Materialize after chat.open |
Model/chat/tool spans |
| Hung |
4 |
0 each |
1 each |
24-46 ms |
0 |
| Healthy controls |
6 |
2 each |
5 each |
221-537 ms |
Present |
The four signals separated the populations with no overlap.
At run level, invoke_agent span counts also reconcile exactly:
| Run |
Instances |
Hung |
invoke_agent spans |
31312886600 |
120 |
0 |
120 |
31387967408 |
120 |
32 |
88 |
31491236537 |
120 |
38 |
82 |
Likely race location
One source path consistent with the observations is _startNewSessionBackend in baseAgentHostSessionsProvider.ts:
void newSession.trackConfigResolution(...);
const { trusted } = await this._workspaceTrustManagementService.getUriTrustInfo(workspaceUri);
if (this._newSessions.get(newSession.sessionId) !== newSession) {
return;
}
newSession.eagerCreate(connection);
If the draft is replaced while awaiting trust information, config resolution has started but eagerCreate() is skipped. That matches the failing wire signature: one resolveSessionConfig, zero createSession, followed by materialization and subscribe.
This source-level explanation is medium confidence; the missing-session behavior itself is directly observed and high confidence.
Regression boundary
| Date |
VS Code commit |
Result |
| Aug 8-9 |
8eaafbf4220a |
Healthy |
| Aug 10 |
5a36a9c68ce6 |
First broken build |
| Aug 11 |
22231c1c3817 |
Still broken |
The boundary contains 111 commits. bba5e40a34c2 (#329839) is a useful early bisect candidate because it reworked the local Agent Host transport, but this is not a causal claim. The new transport-loss branch from that change does not appear in the failing logs.
Related but not duplicates
Suggested validation
A focused regression test could repeatedly open a new Agent Host session and immediately send a prompt, then assert that every first subscribe for a copilotcli:/... channel has a preceding successful createSession, or that the request fails within a bounded time.
References
Does this issue occur when all extensions are disabled?: Yes. This occurs in the core Agent Host session lifecycle. It was reproduced in automated eval containers using the eval driver extension.
5a36a9c68ce6(2026-08-10) and22231c1c3817(2026-08-11). It was not observed on8eaafbf4220a(2026-08-07).Summary
A new Agent Host chat can get stuck on Working... forever before the first model turn starts.
In the failing path, VS Code:
copilotcli:/<session-id>session.-32001 Session not found on backend.This is a timing-dependent regression. In our automated runs it affected roughly 25-34% of attempts across OpenAI, Anthropic, Google, and other models. The model provider is not involved: affected attempts emit no model, chat, or tool spans.
Steps to Reproduce
The race reproduces probabilistically in our environment:
workbench.action.chat.openNewSessionSidebar.agent-host-copilotcli.workbench.action.chat.openwith a prompt, without waiting for eager backend-session creation to settle.Our harness sends the two commands back to back. Successful attempts had only a 2-66 ms margin between backend
createSessionandchat.open.Expected
The backend session is created before it is used. If session creation fails or is superseded, the chat request fails promptly with an actionable error.
Actual
VS Code subscribes to a backend session that does not exist. No model turn starts, and the request remains pending until externally cancelled. In our harness that happened after approximately 105 minutes.
Evidence at a glance
createSessionrequests.createSessionrequests.subscribeand received-32001 Session not found on backend.invoke_agent,chat, andexecute_toolspans.8eaafbf4220aand5a36a9c68ce6; the evaluation harness did not change across that boundary.Could the Agent Host owners please investigate the new-session materialization/session-creation race and ensure this path either creates a valid backend session or fails promptly? The detailed evidence below is intended to help with diagnosis; I am deliberately not prescribing the implementation because the owning team has more context.
Technical evidence and investigation notes
First divergence
Failing AHP wire log:
There is no
createSessionrequest anywhere in the failing wire log.Matched healthy instance from the same run and build:
Client log
Evidence matrix
createSessionresolveSessionConfigchat.openThe four signals separated the populations with no overlap.
At run level,
invoke_agentspan counts also reconcile exactly:invoke_agentspans313128866003138796740831491236537Likely race location
One source path consistent with the observations is
_startNewSessionBackendinbaseAgentHostSessionsProvider.ts:If the draft is replaced while awaiting trust information, config resolution has started but
eagerCreate()is skipped. That matches the failing wire signature: oneresolveSessionConfig, zerocreateSession, followed by materialization andsubscribe.This source-level explanation is medium confidence; the missing-session behavior itself is directly observed and high confidence.
Regression boundary
8eaafbf4220a5a36a9c68ce622231c1c3817The boundary contains 111 commits.
bba5e40a34c2(#329839) is a useful early bisect candidate because it reworked the local Agent Host transport, but this is not a causal claim. The new transport-loss branch from that change does not appear in the failing logs.Related but not duplicates
createSessionmechanism.-32001error through peer-chat replay URI corruption, a different mechanism.Suggested validation
A focused regression test could repeatedly open a new Agent Host session and immediately send a prompt, then assert that every first
subscribefor acopilotcli:/...channel has a preceding successfulcreateSession, or that the request fails within a bounded time.References