Skip to content

agentHost: pass telemetry flag to runtime - #341661

Merged
Vijay Upadya (vijayupadya) merged 7 commits into
mainfrom
roasted-cricket
Oct 15, 2026
Merged

Vijay Upadya (vijayupadya) merged 7 commits into
mainfrom
roasted-cricket

Conversation

@vijayupadya

Copy link
Copy Markdown
Contributor

Summary

Passes enableSessionTelemetry to the Copilot SDK runtime

Changes

  • CopilotSessionLauncher (copilotSessionLauncher.ts):
    • Added isCopilotSessionTelemetryEnabled to evaluate the most restrictive telemetry level between ITelemetryService.telemetryLevel (launch flags, env vars, product config, and monotonic ratcheting) and AgentHostTelemetryLevelConfigKey in IAgentConfigurationService.
    • Passes enableSessionTelemetry: false in _buildSessionConfig (covering both createSession and resumeSession) and createCustomizationPolicySession when telemetry is disabled.
  • Per-session mid-run telemetry revocation (copilotAgent.ts, copilotAgentSession.ts):
    • When root config lowers telemetryLevel below USAGE, immediately releases the hidden customization policy session, tears down idle runtime sessions, and marks busy sessions so they are torn down as soon as their active turn/subagents finish (or refreshed before their next turn) without blocking on global idleness across other chats.

Validation

  • npm run build-fast -- --client-only (passed)
  • .\scripts\test.bat --run src/vs/platform/agentHost/test/node/copilotSessionLauncher.test.ts --grep "enableSessionTelemetry" (passed)
  • .\scripts\test.bat --run src/vs/platform/agentHost/test/node/copilotAgent.test.ts --grep "revokes session telemetry" (passed)
  • npm run eslint -- src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts src/vs/platform/agentHost/node/copilot/copilotSessionLauncher.ts src/vs/platform/agentHost/node/copilot/copilotAgent.ts src/vs/platform/agentHost/test/node/copilotSessionLauncher.test.ts src/vs/platform/agentHost/test/node/copilotAgent.test.ts (passed)

Copilot AI balanced review requested due to automatic review settings October 15, 2026 00:56

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.

🟡 Changes recommended

Revocation misses service-level changes and pending launches, while teardown loses open canvas state.

3 open findings
What changed in this PR

Passes effective telemetry preferences to the Copilot runtime and adds per-session cleanup after opt-out.

Changes:

  • Disables runtime session telemetry when either service or root configuration disallows usage telemetry.
  • Tears down idle sessions and marks busy sessions for restart after revocation.
  • Adds launch-flag and revocation tests.
File Description
src/​vs/​platform/​agentHost/​test/​node/​copilotSessionLauncher.test.ts Tests telemetry flags for create, resume, and policy sessions.
src/​vs/​platform/​agentHost/​test/​node/​copilotAgent.test.ts Tests idle and busy session revocation.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotSessionLauncher.ts Computes effective telemetry permission and passes runtime flags.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgentSession.ts Tracks telemetry-triggered restart requirements.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgent.ts Handles revocation, teardown, and session refresh.

🧠 Review effort: Balanced


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

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: 922ce6a4 Current: 9781cd6d

Changed (1)

sessions/chatCompositeBar/OverflowingTabs/Light
Before After
before after

@vijayupadya
Vijay Upadya (vijayupadya) requested a balanced review from Copilot October 15, 2026 05:29

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.

🟡 Changes recommended

A post-launch initialization race can leave runtime telemetry enabled after opt-out, and disabled policy sessions are unnecessarily created twice.

2 open findings
3 resolved since last review

🧠 Review effort: Balanced

Update policy-session mocks and the GitHub host argument for the current authentication API.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve telemetry revocation and MCP resume behavior across the chat ownership refactor.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vijayupadya
Vijay Upadya (vijayupadya) marked this pull request as ready for review October 15, 2026 17:31
@vijayupadya
Vijay Upadya (vijayupadya) merged commit 0b36205 into main Oct 15, 2026
55 of 56 checks passed
@vijayupadya
Vijay Upadya (vijayupadya) deleted the roasted-cricket branch October 15, 2026 17:32
@vs-code-engineering vs-code-engineering Bot added this to the 1.143.0 milestone Oct 15, 2026
Ulugbek Abdullaev (ulugbekna) added a commit that referenced this pull request Oct 15, 2026
…ementation

Resolve the conflict with #341661 in CopilotAgentSession, which
subscribes runtime events through a per-launch store: the canvas closed
listener keeps that registration and routes the event through
_handleCanvasClosed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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