Skip to content

Propagate request sessions to Agent365 tool and inference scopes - #310

Merged
Nikhil Navakiran (nikhilNava) merged 6 commits into
mainfrom
copilot/a365-session-parity
Oct 30, 2026
Merged

Nikhil Navakiran (nikhilNava) merged 6 commits into
mainfrom
copilot/a365-session-parity

Conversation

@nikhilNava

Copy link
Copy Markdown
Collaborator

Summary

Complete Python's scope-level session propagation from microsoft/opentelemetry-distro-dotnet#116.

  • Record Request.session_id as microsoft.session.id directly on execute-tool and inference scopes, matching the existing invoke-agent scope.
  • Preserve conversation_id independently and omit the session attribute when no session is supplied.
  • Add present/absent regression cases without a baggage processor and document session correlation.

JavaScript already covers this source feature; this addresses a Python-specific partial implementation. No baggage precedence, exporter/storage policy, public signature, or dependency changes.

Validation

Python 3.11, with this branch's src on PYTHONPATH:

  • Both missing-session regression cases failed before implementation, then passed.
  • python -m pytest tests/a365 --ignore=tests/a365/integration -q --tb=short: 644 passed, 8 skipped, 41 subtests passed.
  • Changed-file python -m pylint --output-format=parseable: passed (10/10).
  • Changed-file python -m mypy --python-version 3.10 --show-error-codes --ignore-missing-imports --check-untyped-defs --follow-imports=silent: passed.
  • Black formatting/check and git diff --check: passed.
  • python -m build --no-isolation: wheel and source distribution built; both changed source files verified byte-for-byte in both artifacts.
  • Independent read-only review: no actionable introduced defects.

The unit run emits one exporter worker warning (enriching_span_processor.py:449, cannot release un-acquired lock). The exact warning reproduces on unchanged main (640 passed, 8 skipped, 41 subtests passed); this PR does not change exporters.

Full tox environments, Python 3.10/3.12-3.14 execution, live integration tests, Sphinx docs, and .NET/JavaScript execution were not run. No live telemetry was used.

This is an independent main-based PR. Existing Python storage work remains in #300.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: dfa03945-cb0e-4471-ba78-5980a3098d0b

Copilot AI left a comment

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.

🟢 Approval recommended

The session-propagation change has no active review issues, although no additional validation was run during this review.

No open issues 🎉

What changed in this PR

Completes Agent365 request-session propagation by recording Request.session_id on execute-tool and inference spans, matching invoke-agent behavior.

Changes:

  • Sets microsoft.session.id directly from the request while preserving independent conversation correlation.
  • Adds regression cases for present and absent session IDs without a baggage processor.
  • Documents session correlation and records the fix in the changelog.

No actionable findings. No additional validation was run during this review.

File Description
tests/​a365/​test_inference_scope.py Tests inference session presence, absence, and independent conversation IDs.
tests/​a365/​test_execute_tool_scope.py Tests tool session propagation without a baggage processor.
src/​microsoft/​opentelemetry/​a365/​core/​inference_scope.py Records the request session ID on inference spans.
src/​microsoft/​opentelemetry/​a365/​core/​execute_tool_scope.py Records the request session ID on execute-tool spans.
CHANGELOG.md Notes the Agent365 session-propagation fix.
A365_DOCUMENTATION.md Explains direct session correlation and omitted-session behavior.

Review effort: Balanced

…parity

# Conflicts:
#	CHANGELOG.md

Co-authored-by: nikhilNava <211831449+nikhilNava@users.noreply.github.com>

Copilot AI left a comment

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.

🟢 Approval recommended

No active review issues are recorded for the request-session propagation change.

No open issues 🎉

Review effort: Balanced

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: dfa03945-cb0e-4471-ba78-5980a3098d0b
Copilot AI balanced review requested due to automatic review settings October 28, 2026 22:03
@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Performance comparison

Threshold: regressions >15.0% on gating scenarios fail the build. Higher ops/s is better; positive Δ means the PR is slower.

Scenario Gating Baseline (ops/s) Candidate (ops/s) Δ % Status
azure_monitor_log yes 18,469.9 18,709.4 -1.28% ✅
azure_monitor_span yes 156,936.6 148,301.9 +5.82% ✅
otel_log no 21,802.6 21,817.4 -0.07% ✅
otel_span no 39,421.3 38,273.1 +3.00% ✅

Copilot AI left a comment

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.

🟢 Approval recommended

No active review issues were identified for the request-session propagation change.

No open issues 🎉

Review effort: Balanced

Select the released OpenAIChatCompletionClient instead of the Responses client and pass the configured Azure API version explicitly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 14661e89-86a3-4afe-a454-263eaeeba021
Copilot AI balanced review requested due to automatic review settings October 30, 2026 16:41

Copilot AI left a comment

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.

🔵 Needs a closer look

Human assessment is needed because session baggage can still tag spans when session_id is omitted, contrary to the documented unset guarantee.

No open issues 🎉

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 30, 2026 17:36

Copilot AI left a comment

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.

🟢 Approval recommended

No active review issues remain for the request-session correlation changes.

No open issues 🎉

Review effort: Balanced

…parity

# Conflicts:
#	CHANGELOG.md
#	src/microsoft/opentelemetry/a365/core/execute_tool_scope.py
#	tests/a365/test_execute_tool_scope.py

Co-authored-by: nikhilNava <211831449+nikhilNava@users.noreply.github.com>

Copilot AI left a comment

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.

🟢 Approval recommended

No active review issues block the session-correlation change, although tests and builds were not independently run.

No open issues 🎉

Review effort: Balanced

@nikhilNava
Nikhil Navakiran (nikhilNava) merged commit 675e13e into main Oct 30, 2026
30 checks passed
@nikhilNava
Nikhil Navakiran (nikhilNava) deleted the copilot/a365-session-parity branch October 30, 2026 20:39
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.

5 participants