Skip to content

[Perf] agentHost: reduce Mission Control relay overhead - #341223

Merged
roblourens merged 2 commits into
mainfrom
roblou/agents/session-backcompat-load-issue
Oct 13, 2026
Merged

roblourens merged 2 commits into
mainfrom
roblou/agents/session-backcompat-load-issue

Conversation

@roblourens

@roblourens roblourens commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Summary

Pipeline fragments of one Mission Control relay payload instead of waiting for a Web PubSub acknowledgement after every fragment. Up to four fragments can be in flight within a 4 MiB window. The next whole payload still waits for every fragment's acknowledgement, preserving ordering across response/notification groups, closure notices, and connection generations. Outstanding queue limits include in-flight frames and bytes, and acknowledgement timeouts follow the oldest outstanding frame.

Add metadata-only trace diagnostics and agentHost.missionControlPublishSummary telemetry. Summaries aggregate publication bytes/counts, queue wait, acknowledgement latency, queue high-water marks, and bounded failure/backpressure counters. There is one shared five-minute emission budget per host across clients, mirroring, errors, and reconnects. Performance is eligible while connected to the MC service, including background mirroring; idle periods emit nothing. Errors may report without a connection under the same cap. No payloads, paths, group names, credentials, or client/session identifiers are included.

Existing agentHost.clientConnection telemetry is reused for MC client identity; regression coverage verifies the transport-observed MC route and optional declared names. This does not add iOS identification: clients must supply clientInfo for that.

Fix a redundant session/activeClientSet publication loop discovered during the live soak. Reconciliation compares both the echoed host snapshot and the last published snapshot with scoped equality that recursively ignores undefined object properties, as JSON does, while preserving null, actual values, and ordered arrays. Object-key insertion order does not affect equality. Global object equality and protocol schemas are unchanged. The customization bundler also omits absent _meta; actual standalone/MCP metadata is retained. Correctness no longer depends on each producer omitting every optional property.

No associated issue. Per-client scheduling, mirror batching, and mobile lazy/concurrent file fetching are out of scope.

Performance evidence

A controlled read-only comparison exercised the baseline and candidate publisher against real relay service acknowledgements using an inert 8 MiB payload: 13 fragments, approximately 11.19 MB of serialized relay traffic, three interleaved samples per implementation.

  • Baseline: 1,279 / 1,606 / 1,744 ms; median 1,606 ms.
  • Candidate: 664 / 706 / 744 ms; median 706 ms.
  • Candidate peak in-flight fragments: 4; median publication time was 56% shorter.

This measures publication through service acceptance, not mobile receipt/rendering. It does not demonstrate that chunk pipelining alone fixes the original mobile changes-loading delay.

Live reliability soak

Collected 90.13 minutes of measured workloads using two isolated Code OSS instances, real Copilot sessions, and two read-only relay load clients: a 65-minute baseline/candidate comparison, a 15-minute experimental duplicate-suppression phase, and a 10-minute confirmation running the actual bundler source fix with experimental suppression removed.

The primary comparison changed the fragment window between one and four on the same production publisher at payload boundaries, not between complete old/new application builds. The repeated changes workload loaded 17 synthetic files totaling approximately 7.32 MB per complete batch. Phase counts were unequal; latency distributions include only complete batches, while failures remain in reliability counters.

Median One fragment Four fragments Reduction
Large chunked publication 833 ms 359 ms 56.9%
Complete changes load, sequential reads 6,592 ms 5,855 ms 11.2%
Complete changes load, four concurrent reads 2,650 ms 2,391 ms 9.8%
  • Primary run: 1,778/1,788 successful load RPCs, four host relay losses (one ACK timeout, three socket failures), seven official-viewer socket close events, and 15/15 successful scheduled viewer UI visits after recovery.
  • The host sent approximately 1.24 GB during this deliberately heavy primary run, mostly repeated full-file/history transfers. These are serialized WebSocket payload bytes, not TCP/TLS packet counts, and are not representative of ordinary editing.
  • Average service ACK latency was typically 62–80 ms, but maximum queue wait reached 21 seconds. The 405 mirror-backpressure pauses were flow control, not 405 failed publications.
  • The production bundler-fix confirmation completed 520/520 successful RPCs, 5/5 UI visits, with no socket closures or publication failures over 10.12 minutes. Official-viewer outgoing bytes per minute fell 98.3% versus the primary run. This is a sequential before/after observation, not randomized proof that the loop caused every earlier outage; ten clean minutes do not establish long-term reliability.
  • Across the three phases, 6/3/2 summary events were observed. Minimum spacing was 300.43 seconds, including errors/reconnects, confirming the five-minute cap.

The subsequent reconciliation-boundary hardening is covered by failed-before/passed-after tests; another long live soak was not run after adding that comparator.

Validation

The original relay change was rebased onto origin/main; its signed commit and pre-commit hygiene passed. Its Code OSS CI run also passed.

  • npm run transpile-client — passed after rebase and again for the reconciliation follow-up.

  • The following relay suites — 558 passed, 4 pending after rebase:

    npm run test-node -- \
      --run src/vs/platform/agentHost/test/node/missionControlHost.test.ts \
      --run src/vs/platform/agentHost/test/node/missionControlProtocolServer.test.ts \
      --run src/vs/platform/agentHost/test/node/protocolServerHandler.test.ts \
      --run src/vs/platform/agentHost/test/node/missionControlSessionMirror.test.ts \
      --run src/vs/platform/agentHost/test/node/missionControlAuthentication.test.ts \
      --run src/vs/platform/agentHost/test/common/webPubSub/chunking.test.ts \
      --run src/vs/platform/agentHost/test/common/webPubSub/framing.test.ts \
      --run src/vs/platform/agentHost/test/common/connectionDiagnostics.test.ts \
      --reporter dot
  • Relay changed-TypeScript lint — passed:

    npm run eslint -- \
      src/vs/platform/agentHost/common/connectionDiagnostics.ts \
      src/vs/platform/agentHost/node/missionControl/missionControlProtocolServer.ts \
      src/vs/platform/agentHost/node/missionControl/missionControlEnvironment.ts \
      src/vs/platform/agentHost/node/missionControl/missionControlHost.ts \
      src/vs/platform/agentHost/test/node/missionControlProtocolServer.test.ts \
      src/vs/platform/agentHost/test/node/missionControlHost.test.ts \
      src/vs/platform/agentHost/test/node/protocolServerHandler.test.ts
  • Telemetry extractor check — passed after rebase: verified owner, exact field set, and all 19 numeric measurement classifications.

  • git diff --check origin/main...HEAD — passed for the original relay change; git diff --check — passed for the reconciliation follow-up.

  • npm run typecheck-client — passed before rebase. Standard local invocation after rebase and at follow-up remained blocked by the pre-existing shared SDK mismatch: upstream launcher code/tests require imageGeneration fields absent from the shared installed SDK.

  • npm run build-fast -- --client-only — blocked by the same pre-existing dependency mismatch: this checkout declares Copilot runtime 1.0.96-2; the current shared SDK bundles 1.0.95-0. Shared dependencies were not changed.

Reconciliation follow-up validation

  • These boundary regressions failed before the comparator fix for both optimistic local state and last-published state, then passed after:

    ./scripts/test.sh \
      --run src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts \
      --grep 'active-client reconciliation' --reporter dot
  • Affected customization/tool suites — 157 passed:

    ./scripts/test.sh \
      --run src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts \
      --run src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostClientTools.test.ts \
      --run src/vs/workbench/contrib/chat/test/browser/agentSessions/syncedCustomizationBundler.test.ts \
      --grep 'AgentHostChatContribution customizations|AgentHostClientTools|SyncedCustomizationBundler' \
      --reporter dot
  • Full client typecheck — passed with SDK 1.0.20-preview.2 installed only in an isolated temporary directory. The temporary config extended src/tsconfig.json, retained the Electron paths, set rootDir to src, and mapped the two Copilot SDK imports to the matching isolated declarations:

    ./node_modules/.bin/tsc --project .build/wire-equality-tsconfig.json --noEmit --skipLibCheck
  • Follow-up changed-TypeScript lint — passed:

    npm run eslint -- \
      src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts \
      src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/syncedCustomizationBundler.ts \
      src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts \
      src/vs/workbench/contrib/chat/test/browser/agentSessions/syncedCustomizationBundler.test.ts

Tests cover bounded fragment pipelining, out-of-order/duplicate ACKs, whole-message ordering, failures/timeouts, connection replacement, queue/mirror limits, service connection eligibility, idle suppression, 10,000 publishes, and repeated error/reconnect storms without exceeding the telemetry cap. Follow-up coverage includes absent/nested undefined metadata, repeated JSON echoes, reordered object keys, null/primitive/array changes, opaque host session URIs, and fresh/reused/updated ordinary/standalone/MCP bundles.

Full smoke/E2E suites and live mobile end-to-end rendering were not run.

(Written by Copilot)

Pipeline up to four fragments of one relay payload while preserving acknowledgement barriers between whole messages, connection generations, bounded outstanding bytes and failure handling.

Add typed publication diagnostics and host-wide performance/error summaries limited to one event every five minutes across relay reconnects. Include background mirroring while connected to Mission Control, keep idle periods silent, and reuse existing MC client identity telemetry.

Cover ordering, out-of-order acknowledgements, timeouts, queue accounting, failure handling, service lifecycle and telemetry-rate limits with focused regressions.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 13, 2026 01:59

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.

🔵 Needs a closer look

The timing-sensitive transport and telemetry lifecycle changes warrant human review despite strong focused coverage.

0 open findings

What changed in this PR

Pipelines Mission Control payload fragments while preserving payload ordering and adds bounded publication diagnostics and telemetry.

Changes:

  • Allows four fragments within a 4 MiB in-flight window.
  • Adds queue, acknowledgement, failure, and connection telemetry.
  • Expands protocol, telemetry, identity, and lifecycle tests.
File Description
connectionDiagnostics.ts Supports typed diagnostic observers.
missionControlProtocolServer.ts Implements fragment pipelining and diagnostics.
missionControlEnvironment.ts Forwards current-server diagnostics.
missionControlHost.ts Aggregates and emits publish telemetry.
MISSION_CONTROL.md Documents pipelining and telemetry behavior.
missionControlProtocolServer.test.ts Tests scheduling, limits, failures, and diagnostics.
missionControlHost.test.ts Tests telemetry aggregation and emission budgets.
protocolServerHandler.test.ts Verifies Mission Control client identity telemetry.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Compare active-client snapshots without undefined object properties at both reconciliation boundaries, preserving actual metadata changes and array ordering. Omit absent bundler metadata and cover optimistic updates, JSON echoes, and unacknowledged publications.

Co-authored-by: Copilot <[email protected]>
@roblourens roblourens changed the title [Perf] agentHost: pipeline Mission Control chunks [Perf] agentHost: reduce Mission Control relay overhead Oct 13, 2026
@roblourens
roblourens marked this pull request as ready for review October 13, 2026 16:05
@roblourens
roblourens enabled auto-merge (squash) October 13, 2026 16:05
@roblourens
roblourens merged commit 78f0c3f into main Oct 13, 2026
35 checks passed
@roblourens
roblourens deleted the roblou/agents/session-backcompat-load-issue branch October 13, 2026 16:51
@vs-code-engineering vs-code-engineering Bot added this to the 1.143.0 milestone Oct 13, 2026
Don Jayamanne (DonJayamanne) added a commit that referenced this pull request Oct 13, 2026
…xploration-vscode

* origin/main: (40 commits)
  MSRC fixes (#341342)
  chat: render input attachments for the input model's session (#341350)
  chat: center subagent tool activity hooks (#341258)
  Manage Copilot plugin marketplaces through Agent Host (#341301)
  fix: linux setuid sandbox helper permissions (#341292)
  agentHost: resolve #chat chips on the host of the chat that shows them (#341332)
  [Perf] agentHost: limit archived sessions over Mission Control (#341327)
  Remember expanded state for "Other Models" in model picker (#341335)
  Offer Stop for copilot detached background shells  (#341310)
  agentHost: allow inherited peer chats to move workspaces (#341317)
  [Perf] agentHost: reduce Mission Control relay overhead (#341223)
  Fix Customizations modal spacing (#341144)
  Fix dependency cycle in QuickInputService and EditorResolverService (#341321)
  Fix Explorer refresh on restoring deleted workspace root folder (#341323)
  chat: Share and rate-limit core utility model requests (#340100)
  agentHost: open #chat chips on the connection that owns the chat (#341313)
  Fix flaky StorageMainService tests by awaiting storage warm-up (#341305)
  agentHost: record the default chat role instead of reading the default chat URI shape (#341293)
  welcome: preserve tab icon color with Modern Icons
  Fix flaky test in diskFileSystemProvider.test.ts (#341304)
  ...

# Conflicts:
#	src/vs/platform/agentHost/node/agentService.ts
#	src/vs/platform/agentHost/node/protocolServerHandler.ts
#	src/vs/platform/agentHost/test/node/protocolServerHandler.test.ts
#	src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts
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.

3 participants