Skip to content

George/otel phase1 2 root request span - #2837

Draft
George Ng (GeorgeNgMsft) wants to merge 31 commits into
mainfrom
george/otel-phase1-2-root-request-span
Draft

George/otel phase1 2 root request span#2837
George Ng (GeorgeNgMsft) wants to merge 31 commits into
mainfrom
george/otel-phase1-2-root-request-span

Conversation

@GeorgeNgMsft

@GeorgeNgMsft George Ng (GeorgeNgMsft) commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

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.

George Ng (GeorgeNgMsft) and others added 30 commits August 3, 2026 21:25
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0a6d7dd8-79f4-4035-8efd-5a3d7fdce6da
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
readonly captureSensitiveErrorDetails?: boolean | undefined;
}

/**

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.

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",

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.

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

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.

how can session ever be undefined? if it’s undefined it's a bug. I feel like we should always have a session.

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