Skip to content

Add Agent Host hung turn lifecycle diagnostics - #332045

Merged
roblourens merged 5 commits into
mainfrom
roblou/agents/telemetry-product-feedback-loop-e5db8883
Aug 22, 2026
Merged

Add Agent Host hung turn lifecycle diagnostics#332045
roblourens merged 5 commits into
mainfrom
roblou/agents/telemetry-product-feedback-loop-e5db8883

Conversation

@roblourens

Copy link
Copy Markdown
Member

Summary

Adds bounded lifecycle attribution to the existing agentHost.turnHung event so provider-stage hangs can be assigned to an owning boundary without adding telemetry for healthy turns.

  • records provider diagnostic availability and Copilot send/fleet call state
  • records whether the Copilot SDK turn started and whether its session is active, disconnecting, disconnected, or shut down
  • records whether the initiating AHP client remains connected
  • derives process-wide client liveness from authoritative ProtocolServerHandler records rather than mirrored transport state
  • keeps missing chats/turns and diagnostic failures explicit and bounded

Motivation

On the complete 2026-08-20 UTC day, Copilot noProgress hangs affected 83 of 3,271 Linux Agents Window SSH messages (2.5375%) and 63 of 2,648 WSL messages (2.3792%), versus 311 of 104,282 local Windows Agents Window messages (0.2982%). In the preceding complete-day cohort, only 6.897% of SSH and 3.333% of WSL provider-stage noProgress turns completed within 24 hours, compared with 75.362% for local Windows Agents Window turns.

Current telemetry cannot distinguish a pending provider call, a resolved/rejected call with no provider turn start, a missing provider chat/turn, a dead SDK session, or initiating-client loss. This change adds that attribution while preserving existing timeout, cancellation, and recovery behavior.

Validation

  • 15,120 full node unit tests passed in final review
  • 1,023 directly affected Agent Host tests passed after the final changes
  • npm run typecheck-client
  • pre-commit hygiene hook

(Written by Copilot)

(Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings August 21, 2026 21:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds bounded provider and client-liveness diagnostics to agentHost.turnHung.

Changes:

  • Tracks Copilot call, turn, and session lifecycle state.
  • Replaces mirrored connection tracking with a process-wide service.
  • Expands lifecycle and telemetry tests.
Show a summary per file
File Description
src/vs/platform/agentHost/common/agent.ts Defines diagnostic contracts.
src/vs/platform/agentHost/node/agentHostBootstrap.ts Registers the connection service.
src/vs/platform/agentHost/node/agentHostClientConnectionService.ts Aggregates authoritative client connections.
src/vs/platform/agentHost/node/agentHostClientConnectionTelemetry.ts Removes the superseded tracker.
src/vs/platform/agentHost/node/agentHostMain.ts Uses service-based tracking.
src/vs/platform/agentHost/node/agentHostServerMain.ts Removes manual tracker wiring.
src/vs/platform/agentHost/node/agentHostTelemetryReporter.ts Emits new hang attributes.
src/vs/platform/agentHost/node/agentHostTurnTracker.ts Collects lifecycle and liveness snapshots.
src/vs/platform/agentHost/node/agentSideEffects.ts Preserves agent and initiator context.
src/vs/platform/agentHost/node/copilot/copilotAgent.ts Exposes turn diagnostics.
src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts Tracks provider calls and turn starts.
src/vs/platform/agentHost/node/copilot/copilotSessionWrapper.ts Tracks session lifecycle.
src/vs/platform/agentHost/node/protocolServerHandler.ts Supplies authoritative connection records.
src/vs/platform/agentHost/test/node/agentHostTelemetryReporter.test.ts Verifies telemetry fields.
src/vs/platform/agentHost/test/node/agentHostToolCallTelemetry.test.ts Updates test DI.
src/vs/platform/agentHost/test/node/agentHostTurnHangTelemetry.test.ts Tests hang diagnostics.
src/vs/platform/agentHost/test/node/agentHostTurnTelemetry.test.ts Updates test DI.
src/vs/platform/agentHost/test/node/agentServiceTestUtils.ts Wires the service in tests.
src/vs/platform/agentHost/test/node/agentSideEffects.test.ts Updates side-effect test setup.
src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts Tests provider lifecycle states.
src/vs/platform/agentHost/test/node/mockAgent.ts Supports mock diagnostics.
src/vs/platform/agentHost/test/node/protocolServerHandler.test.ts Tests connection aggregation and rollback.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 22/22 changed files
  • Comments generated: 3
  • Review effort level: Balanced

Comment thread src/vs/platform/agentHost/node/copilot/copilotSessionWrapper.ts Outdated
Comment thread src/vs/platform/agentHost/node/protocolServerHandler.ts
Comment thread src/vs/platform/agentHost/node/protocolServerHandler.ts
roblourens and others added 3 commits August 21, 2026 15:00
(Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
(Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
(Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@roblourens
roblourens marked this pull request as ready for review August 21, 2026 22:58
@roblourens
roblourens enabled auto-merge (squash) August 21, 2026 22:58
@roblourens
roblourens merged commit e6ac244 into main Aug 22, 2026
27 checks passed
@roblourens
roblourens deleted the roblou/agents/telemetry-product-feedback-loop-e5db8883 branch August 22, 2026 00:02
@vs-code-engineering vs-code-engineering Bot added this to the 1.135.0 milestone Aug 22, 2026
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.

4 participants