George/otel phase1 2 root request span - #2837
Draft
George Ng (GeorgeNgMsft) wants to merge 31 commits into
Draft
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0a6d7dd8-79f4-4035-8efd-5a3d7fdce6da
…vice ID once and reuse
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: be0e0e43-017e-42aa-9ea7-93ae6dfccecf
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: be0e0e43-017e-42aa-9ea7-93ae6dfccecf
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: be0e0e43-017e-42aa-9ea7-93ae6dfccecf
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: be0e0e43-017e-42aa-9ea7-93ae6dfccecf
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: fda85cb9-80d5-4d6f-8b9a-81309857ffe7
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: fda85cb9-80d5-4d6f-8b9a-81309857ffe7
…trace-contract Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8c62684d-dd2b-44bc-a9c0-7e5148dbe0e1 # Conflicts: # ts/packages/telemetry/src/otel/bootstrap.ts # ts/packages/telemetry/src/otel/lifecycle.ts # ts/packages/telemetry/src/otel/redaction.ts # ts/packages/telemetry/src/otel/resources.ts # ts/packages/telemetry/test/otelBootstrap.spec.ts # ts/packages/telemetry/test/otelLifecycle.spec.ts # ts/packages/telemetry/test/otelRedaction.spec.ts # ts/packages/telemetry/test/otelResources.spec.ts
…ase1-1-trace-contract
| readonly captureSensitiveErrorDetails?: boolean | undefined; | ||
| } | ||
|
|
||
| /** |
Contributor
There was a problem hiding this comment.
In general, we should go light with documentation like this. since there are no way to validate it, doc comment drift from code which often take exdtra turns for agents.
We should remove this large comment block
Comment on lines
+378
to
+379
| safeName: "CommandError", | ||
| safeMessage: "command failed", |
Contributor
There was a problem hiding this comment.
fundamentally, sensitive options and handling should be done at source. Each consumer of recordTypeAgentSpanException won't know how to use recordTypeAgentSpanException and stick to to easiest option which is don't pass anything.
I wouldn't expose this to consumer
| // steps in later phases; the root span carries only the values known | ||
| // at the outermost async boundary. Everything the wrapper receives is | ||
| // an identifier, not user text - see setTypeAgentSpanAttributes. | ||
| const sessionId = context.session.sessionDirPath |
Contributor
There was a problem hiding this comment.
how can session ever be undefined? if it’s undefined it's a bug. I feel like we should always have a session.
Dominic Nguyen (datduyng)
approved these changes
Aug 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the dispatcher’s root OpenTelemetry request span, establishing the parent for future translation, reasoning, action, and LLM spans.
• Creates one typeagent.request span per command.
• Adds session, activation, and legacy trace correlation attributes.
• Starts a new trace by default.
• Supports opt-in host trace parenting with telemetry.joinActiveTrace .
• Preserves the submitting host’s context across queued requests.
• Records privacy-safe exception classifications by default.
• Supports explicit redacted diagnostic capture with telemetry.captureSensitiveErrorDetails .
• Marks cancellations distinctly using AbortError and the "cancelled" status message.
• Preserves existing cancellation, cleanup, and command-result behavior.
• Adds coverage for span lifecycle, parenting, queue propagation, cancellation, errors, and privacy defaults.