microsoft / microsoft/vscode

Agent Host logs superseded turn-changeset subscriptions as Resource not found

Open
#334,196 0 comments 0 reactions 1 assignee Claimed by @roblourens View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

## Observation

A recent Code - Insiders session logged repeated failed subscriptions to per-turn changesets as missing resources. In each case, the Agent Host emitted changeset actions for the same channel immediately before reporting it as not found.

```text
2026-09-02 18:40:45.633 [trace] [AgentHostStateManager] Emitting envelope: seq=365, channel=copilotcli:/a81525fa-5266-4560-9c00-f86907e40bc3/changeset/turn/da598b42-3426-4669-bff0-7b8a560483bd, type=changeset/contentChanged
2026-09-02 18:40:45.633 [trace] [ProtocolServer] Broadcasting action: changeset/contentChanged
2026-09-02 18:40:45.633 [trace] [AgentHostStateManager] Emitting envelope: seq=366, channel=copilotcli:/a81525fa-5266-4560-9c00-f86907e40bc3/changeset/turn/da598b42-3426-4669-bff0-7b8a560483bd, type=changeset/statusChanged
2026-09-02 18:40:45.633 [trace] [ProtocolServer] Broadcasting action: changeset/statusChanged
2026-09-02 18:40:45.633 [error] [ProtocolServer] Request 'subscribe' failed Resource not found: copilotcli:/a81525fa-5266-4560-9c00-f86907e40bc3/changeset/turn/da598b42-3426-4669-bff0-7b8a560483bd
```

The same pattern happened for another turn 36 ms later, while a subscription for a different turn succeeded:

```text
2026-09-02 18:40:45.669 [trace] [AgentHostStateManager] Emitting envelope: seq=367, channel=copilotcli:/a81525fa-5266-4560-9c00-f86907e40bc3/changeset/turn/f54935d3-a51c-4a36-bf91-58988129a420, type=changeset/contentChanged
2026-09-02 18:40:45.669 [trace] [AgentHostStateManager] Emitting envelope: seq=368, channel=copilotcli:/a81525fa-5266-4560-9c00-f86907e40bc3/changeset/turn/f54935d3-a51c-4a36-bf91-58988129a420, type=changeset/statusChanged
2026-09-02 18:40:45.669 [error] [ProtocolServer] Request 'subscribe' failed Resource not found: copilotcli:/a81525fa-5266-4560-9c00-f86907e40bc3/changeset/turn/f54935d3-a51c-4a36-bf91-58988129a420
2026-09-02 18:40:45.670 [trace] [AgentService] subscribe done: copilotcli:/a81525fa-5266-4560-9c00-f86907e40bc3/changeset/turn/a07308b5-9643-406c-8465-393d383387be (servedFromMemory=false)
2026-09-02 18:40:45.670 [trace] [ProtocolServer] Request 'subscribe' id=307 succeeded
```

I do not currently have a reliable standalone reproduction. This happened while an existing Agent Host session with many turns was being restored/hydrated.

## Possible explanation (unconfirmed)

AI's guess is that the Agents Window's `Last Turn Changes` derived subscription changes while chat/session state is hydrating. A pending subscription to the previously selected turn may be unsubscribed or superseded as a newer turn becomes selected.

`ProtocolServerHandler` detects replacement/cancellation of pending subscriptions, but its `subscribe` catch path converts non-`ProtocolError` failures (including a possible `Subscription cancelled` error) into `AHP_SESSION_NOT_FOUND` with `Resource not found`. The shared request handler then logs that at error level. If so, this is an expected cancellation being misclassified rather than a genuinely absent changeset.

That is only a hypothesis; it is also possible that the client is retaining stale turn changeset URIs. Recent related work includes #331050 and #333110.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.