Skip to content

agentHost: report where a subagent's task model came from - #334184

Draft
Bhavya U (bhavyaus) wants to merge 1 commit into
mainfrom
dev/bhavyau/agent-host-subagent-task-model-source
Draft

agentHost: report where a subagent's task model came from#334184
Bhavya U (bhavyaus) wants to merge 1 commit into
mainfrom
dev/bhavyau/agent-host-subagent-task-model-source

Conversation

@bhavyaus

Copy link
Copy Markdown
Collaborator

Summary

Adds subagentTaskModelSource to the agentHost.turnCompleted telemetry event for subagent turns, so we can tell where a subagent's model input came from. The value is read off the Copilot SDK's subagent.started event (github/copilot-agent-runtime#18727, github/copilot-sdk#2497), stored with the subagent chat reference, and emitted on the initial, nested, and resumed turns of that subagent. Root turns leave it undefined; unknown wire values are dropped to undefined.

Value What it tracks
task_argument The parent agent passed task.model
subagent_configuration No task.model; the per-subagent settings entry supplied a concrete model
custom_agent_definition No task.model; a user-defined custom agent's definition supplied its model
unset Neither the task call nor structured configuration supplied a model

It does not say which model actually ran; the existing model column on the same row does. The existing modelSelectionKind is unchanged: it describes VS Code's top-level client selection, not subagent provenance.

Draft until

The SDK PR lands and @github/copilot-sdk is bumped. readSubagentTaskModelSource currently casts e.data because the pinned SDK (1.0.13-preview.2) does not yet have the field type; after the bump the cast can go, but the validation switch should stay as the unknown-value guard.

How to test

./scripts/test.sh --grep "turn tracker telemetry|forwards only known subagent task model sources" — 34 tests. The AgentSideEffects suite asserts the field on root (undefined), initial, nested, and resumed subagent turns; the CopilotAgentSession test asserts each known value passes through and unknown/absent values become undefined.

Read the optional `taskModelSource` off `subagent.started`, keep it on
the subagent chat reference, and emit it as `subagentTaskModelSource`
on `agentHost.turnCompleted` for every subagent turn, including nested
and resumed ones. Root turns leave it undefined; unknown wire values
are dropped.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 3, 2026 05:48

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.

Copilot review overview

🟡 Changes recommended

The required Copilot SDK dependency bump is missing, leaving the telemetry field dependent on an untyped cast.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 1 Medium severity

New issues introduced by this change (1)
Severity Finding
Medium severity src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgentSession.ts — The PR's stated SDK prerequisite is still missing. The repository remains pinned to…
What changed in this PR

Adds validated subagent model-source provenance to completed-turn telemetry.

Changes:

  • Propagates provenance through initial, nested, and resumed turns.
  • Drops unknown SDK values.
  • Adds telemetry coverage for root and subagent turns.
File Description
src/​vs/​platform/​agentHost/​test/​node/​copilotAgentSession.test.ts Tests validation of SDK wire values.
src/​vs/​platform/​agentHost/​test/​node/​agentHostTurnTelemetry.test.ts Tests root, nested, and resumed telemetry.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgentSession.ts Maps SDK event data to validated sources.
src/​vs/​platform/​agentHost/​node/​agentSideEffects.ts Preserves provenance across subagent turns.
src/​vs/​platform/​agentHost/​node/​agentHostTurnTracker.ts Tracks provenance through completion.
src/​vs/​platform/​agentHost/​node/​agentHostTelemetryReporter.ts Adds the telemetry field and classification.
src/​vs/​platform/​agentHost/​common/​agent.ts Defines the model-source signal type.

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

agentName: e.data.agentName,
agentDisplayName: e.data.agentDisplayName,
agentDescription: e.data.agentDescription,
taskModelSource: readSubagentTaskModelSource(e.data),
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: 8d48b77e Current: d128fc00

Errored (8)

Fixtures that failed to render — no screenshot was produced.

sessions/remoteHostUnavailable/remoteHostUnavailableEmptyState/HostNotRunning/Dark — unknown error (no image hash produced)
unknown error (no image hash produced)
sessions/remoteHostUnavailable/remoteHostUnavailableEmptyState/HostNotRunning/Light — unknown error (no image hash produced)
unknown error (no image hash produced)
sessions/remoteHostUnavailable/remoteHostUnavailableEmptyState/HostNotRunningAutoStart/Dark — unknown error (no image hash produced)
unknown error (no image hash produced)
sessions/remoteHostUnavailable/remoteHostUnavailableEmptyState/HostNotRunningAutoStart/Light — unknown error (no image hash produced)
unknown error (no image hash produced)
sessions/remoteHostUnavailable/remoteHostUnavailableEmptyState/HostDisconnected/Dark — unknown error (no image hash produced)
unknown error (no image hash produced)
sessions/remoteHostUnavailable/remoteHostUnavailableEmptyState/HostDisconnected/Light — unknown error (no image hash produced)
unknown error (no image hash produced)
sessions/remoteHostUnavailable/remoteHostUnavailableEmptyState/Connecting/Dark — unknown error (no image hash produced)
unknown error (no image hash produced)
sessions/remoteHostUnavailable/remoteHostUnavailableEmptyState/Connecting/Light — unknown error (no image hash produced)
unknown error (no image hash produced)

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.

2 participants