Conversation
- Widen ToolCallDetails.arguments to accept Record<string, unknown> | string - Widen ExecuteToolScope.recordResponse to accept Record<string, unknown> | string - Change OutputScope from accumulate to overwrite semantics - Add ResponseMessagesParam type (OutputMessagesParam | Record<string, unknown>) for tool call results - Delete ExecutionType enum and TenantDetails interface (align with Python SDK) - Remove getExecutionTypePair, setExecutionTypeBaggage, deriveTenantDetails from hosting - Remove GEN_AI_EXECUTION_TYPE_KEY usage from OpenAI extensions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…leanup - Add null guards for typeof === 'object' checks in ExecuteToolScope - Handle raw dict JSON in truncation: one-shot OVERLIMIT_SENTINEL (not string trim) - Tighten version check in collectShrinkActions to distinguish versioned wrappers from raw dicts - Simplify _isRawDict to check for absence of version key - Add test coverage for raw dict in OutputScope and truncation (4 new truncation tests, 2 OutputScope tests) - Remove stale ExecutionType/TenantDetails references from design docs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Aligns Node.js observability tool/message telemetry behavior with the Python SDK changes (PR #221), including broader tool arg/response typing, updated output message semantics, and safer span truncation behavior for raw JSON dict payloads.
Changes:
- Widen tool call arguments and tool responses to support
Record<string, unknown> | stringwith automatic JSON serialization. - Change
OutputScopeoutput recording from append/accumulate to overwrite semantics, and allow raw dict output payloads. - Remove legacy execution-type and tenant-details helpers/usages; update span truncation to handle raw dict JSON via one-shot
[overlimit]replacement.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/observability/extension/hosting/TurnContextUtils.test.ts | Removes execution-type baggage tests. |
| tests/observability/extension/hosting/scope-utils.test.ts | Removes tenant-details derivation tests. |
| tests/observability/core/scopes.test.ts | Adds coverage for object/string tool args + tool responses serialization in ExecuteToolScope. |
| tests/observability/core/output-scope.test.ts | Updates tests for overwrite semantics and adds raw-dict output coverage. |
| tests/observability/core/agent365-exporter.test.ts | Adds truncation tests for raw dict JSON in message attributes. |
| packages/agents-a365-observability/src/tracing/scopes/OutputScope.ts | Implements overwrite semantics + raw-dict output support. |
| packages/agents-a365-observability/src/tracing/scopes/ExecuteToolScope.ts | Serializes object tool args/response payloads to JSON. |
| packages/agents-a365-observability/src/tracing/exporter/utils.ts | Distinguishes versioned wrappers vs raw JSON and applies [overlimit] sentinel appropriately. |
| packages/agents-a365-observability/src/tracing/contracts.ts | Updates public contract types: tool args widening and new ResponseMessagesParam. |
| packages/agents-a365-observability/src/tracing/constants.ts | Removes GEN_AI_EXECUTION_TYPE_KEY. |
| packages/agents-a365-observability/src/index.ts | Removes ExecutionType/TenantDetails exports and exports ResponseMessagesParam. |
| packages/agents-a365-observability/docs/design.md | Removes ExecutionType from documented enums. |
| packages/agents-a365-observability-hosting/src/utils/TurnContextUtils.ts | Removes execution-type baggage extraction helper. |
| packages/agents-a365-observability-hosting/src/utils/ScopeUtils.ts | Removes tenant-details derivation helper. |
| packages/agents-a365-observability-hosting/src/utils/BaggageBuilderUtils.ts | Stops adding execution-type baggage. |
| packages/agents-a365-observability-hosting/src/middleware/BaggageMiddleware.ts | Stops attaching execution-type baggage. |
| packages/agents-a365-observability-hosting/docs/design.md | Updates docs to remove execution-type APIs/mentions. |
| packages/agents-a365-observability-extensions-openai/src/Utils.ts | Removes setting execution-type attribute from OpenAI span attribute extraction. |
| packages/agents-a365-observability-extensions-openai/src/OpenAIAgentsTraceProcessor.ts | Removes execution-type key exclusion logic (since key is removed). |
- Remove unused OutputMessagesParam import from OutputScope (lint fix) - Add null guard to _isRawDict (typeof null === 'object' safety) - Wrap JSON.stringify in try/catch in ExecuteToolScope and OutputScope raw dict path - Add safeJsonStringify helper for non-throwing telemetry serialization Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
nikhilNava
requested changes
Apr 7, 2026
nikhilNava
requested changes
Apr 8, 2026
…string (not just string[] or wrapper). Request.content changed from string to InputMessagesParam. InvokeAgentScope.start() automatically records request.content as input messages. Tool record response and argument changed to provide proper serialized format for single string input.
4 tasks
…rd, remove .codereviews
- Change serialization failure fallback from plain string to JSON.stringify({ error: 'serialization failed' }) so downstream processors don't need special-casing for non-JSON attributes.
- Apply global tracer provider guard pattern in scopes.test.ts to match other test files and avoid flaky test ordering.
- Remove .codereviews file from tracked files.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
juliomenendez
approved these changes
Apr 9, 2026
nikhilNava
approved these changes
Apr 9, 2026
fpfp100
pushed a commit
that referenced
this pull request
Apr 9, 2026
…tensions, align tool serialization - Remove isContentRecordingEnabled toggle: content recording is now ON by default (aligned with Python/.NET SDKs). suppressInvokeAgentInput remains. - Remove truncateValue from both extensions: truncation now happens at the span/exporter level in core, not pre-truncated in extensions. - Use safeSerializeToJson for tool arguments/results in both extensions, matching the core ExecuteToolScope pattern from PR #228. - Export safeSerializeToJson from core index.ts. - Add tool argument validation tests for both OpenAI and LangChain extensions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fpfp100
pushed a commit
that referenced
this pull request
Apr 9, 2026
…tensions, align tool serialization - Remove isContentRecordingEnabled toggle: content recording is now ON by default (aligned with Python/.NET SDKs). suppressInvokeAgentInput remains. - Remove truncateValue from both extensions: truncation now happens at the span/exporter level in core, not pre-truncated in extensions. - Use safeSerializeToJson for tool arguments/results in both extensions, matching the core ExecuteToolScope pattern from PR #228. - Export safeSerializeToJson from core index.ts. - Add tool argument validation tests for both OpenAI and LangChain extensions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fpfp100
pushed a commit
that referenced
this pull request
Apr 9, 2026
…tensions, align tool serialization - Remove isContentRecordingEnabled toggle: content recording is now ON by default (aligned with Python/.NET SDKs). suppressInvokeAgentInput remains. - Remove truncateValue from both extensions: truncation now happens at the span/exporter level in core, not pre-truncated in extensions. - Use safeSerializeToJson for tool arguments/results in both extensions, matching the core ExecuteToolScope pattern from PR #228. - Export safeSerializeToJson from core index.ts. - Add tool argument validation tests for both OpenAI and LangChain extensions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fpfp100
added a commit
that referenced
this pull request
Apr 13, 2026
…231) * Add OTEL gen-ai message format support for auto-instrumented input/output message tracing - OpenAI extension: Auto-record structured InputMessages/OutputMessages on response, generation, and function spans via OpenAIAgentsTraceProcessor with isContentRecordingEnabled option - LangChain extension: Auto-record structured InputMessages/OutputMessages on chat, invoke_agent, and execute_tool spans via LangChainTracer with isContentRecordingEnabled option - LangChain v1 support: Fix setToolAttributes to handle plain string tool results (v1 format), fix tool_call_id extraction from inputs, fix setSystemInstructionsAttribute to use getMessageType() for all message formats, fix setTokenAttributes to check last message for usage_metadata, fix getModel to check v1 direct response_metadata path - Add message-schema-validator test helper for validating OTEL gen-ai message contract - Add LangChainMessageContract and OpenAIMessageContract test suites Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Address code review findings (CRM-001 through CRM-013) - CRM-001: Move GEN_AI_TOOL_TYPE_KEY setAttribute outside forEach loop - CRM-002: Wrap string output/input fallbacks in versioned OTEL message envelope - CRM-003: Support tokenUsage shape (promptTokens/completionTokens) in setTokenAttributes - CRM-009: Remove unused getAttributesFromInput export - CRM-010: Replace dead extractMessageContent with extractStringContent delegating to extractRawContent - CRM-011: Fix self-referential comment - CRM-006: Add direct v1 constructor format tests for input/output messages - CRM-007: Add response span content-gating suppression test - CRM-008: Add empty array and null entry edge case tests - CRM-013: Add function_call, input_file, malformed JSON, and unknown block type tests - Fix getMessageType to skip v1 'constructor' type and check id array for message class Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Remove isContentRecordingEnabled gating, remove truncateValue from extensions, align tool serialization - Remove isContentRecordingEnabled toggle: content recording is now ON by default (aligned with Python/.NET SDKs). suppressInvokeAgentInput remains. - Remove truncateValue from both extensions: truncation now happens at the span/exporter level in core, not pre-truncated in extensions. - Use safeSerializeToJson for tool arguments/results in both extensions, matching the core ExecuteToolScope pattern from PR #228. - Export safeSerializeToJson from core index.ts. - Add tool argument validation tests for both OpenAI and LangChain extensions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Address PR review: fix output fallback, input_image part type, stale JSDoc - processResponseSpanData: add else fallback for non-array output via wrapRawContentAsOutputMessages (handles object output) - mapInputContentBlock: map input_image to type 'blob' (matches BlobPart contract) instead of non-standard 'image' - Remove stale @param options JSDoc from LangChainTraceInstrumentor.instrument Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Use MAX_SPAN_SIZE_BYTES constant for truncation, export from observability, add missing expect import - Replace hardcoded 1024 with MAX_SPAN_SIZE_BYTES in OpenAI extensions Utils - Export MAX_SPAN_SIZE_BYTES from observability package - Add missing `import { expect } from '@jest/globals'` to test helper Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Peng Fan <pefan@microsoft.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
ResponseMessagesParamfor raw dict tool results inOutputScope, align with Python implementation.ExecutionTypeenum andTenantDetailsinterface (align with Python SDK)getExecutionTypePair,setExecutionTypeBaggage,deriveTenantDetailsfrom hostingGEN_AI_EXECUTION_TYPE_KEYusage from OpenAI extensionsOVERLIMIT_SENTINELreplacement (preserves JSON integrity)Sample Console Output (from basic-agent-sdk-sample)
1. Inference span ("Chat gpt-4o")
2. ExecuteTool span — object arguments + object response (auto-serialized)
3. OutputScope — string[] input (auto-wrapped, overwrite semantics)
4. OutputScope — structured OutputMessages (overwrite semantics)
5. InvokeAgent span (root)
Test plan
🤖 Generated with Claude Code