OTEL `chat` spans do not have the proper parent span for subagents
Nobody has claimed this yet.
- 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
- Enable OTEL
- 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."
- Inspect the OTEL trace
Expected behavior
No response
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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