github / github/copilot-cli

OTEL `chat` spans do not have the proper parent span for subagents

Open
#4,858 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
Shell
Stars
11.2k
Forks
1.9k
Avg merge
14h 16m
Merged PRs (30d)
6

Description

Describe the bug

When OTEL is enabled and copilot uses the task tool to start a subagent, an invoke_agent span is created which contains all the execute_tool spans, but a single chat span at the very beginning. All other chat spans do not have the appropriate parent set to the invoke_agent span.

This is especially confusing when copilot starts multiple subagents, because then the chat spans are all mixed together, and the github.copilot.turn_id do not make sense.

Affected version

No response

Steps to reproduce the behavior
  1. Enable OTEL
  2. Ask copilot to use the task tool multiple times, e.g. "Using the task tool, ask three sub-agents to summarize the last five commits of this project, then compare their summaries."
  3. Inspect the OTEL trace
Expected behavior

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the trace with OTEL enabled using multiple task-tool subagents, then inspect the resulting invoke_agent, execute_tool, and chat spans. Trace the span-parenting path and verify that each chat span is grouped under the appropriate invoke_agent span and that github.copilot.turn_id values are no longer mixed between subagents.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.