Skip to content

fix(instrumentation-py): repair AgentScope and AgentSpec OTel 2.x spans - #372

Merged
fran3cc merged 1 commit into
respanai:mainfrom
Nightingalelyy:fix/otel2-py-agentops-agentscope-agentspec
Aug 21, 2026
Merged

fix(instrumentation-py): repair AgentScope and AgentSpec OTel 2.x spans#372
fran3cc merged 1 commit into
respanai:mainfrom
Nightingalelyy:fix/otel2-py-agentops-agentscope-agentspec

Conversation

@Nightingalelyy

@Nightingalelyy Nightingalelyy commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add one AgentScope instrumentor lifecycle that patches every distinct configured custom model class, while retaining the single-model option
  • repair AgentSpec full-width trace IDs, real sync/async usage capture, canonical boundary content, root identifier/custom-metadata propagation, and forbidden alias cleanup
  • add patch release intents for the two release-managed packages

AgentOps was validated in the same three-gap group, but its only change is in respan-example-projects; because this Respan PR has no AgentOps source diff, the source PR title intentionally names only AgentScope and AgentSpec.

Root cause.

AgentScope examples created multiple same-name instrumentors, and Respan activated only the first lifecycle; the scripted model also lacked the formatter required by current AgentScope. AgentSpec patched a callback base class that the current LLM handler overrides, inherited an upstream 64-bit trace-ID conversion, and exported indexed message content without canonical boundary reconstruction. Its workflow root is created before child propagation, so late identifiers and custom metadata also needed explicit root promotion.

Impact.

The locally linked examples now expose the intended direct-model, agent, tool, multi-agent, failure, and propagation paths. AgentSpec traces preserve 128-bit identity, exact provider usage, meaningful workflow/agent content, and root-level propagated fields without duplicate aliases.

Validation

  • AgentOps tests: 4/4

  • AgentScope tests: 13/13

  • AgentSpec tests: 14/14

  • AgentScope and AgentSpec wheels built, installed into a clean Python 3.11 environment, and imported successfully

  • all eight corresponding examples completed with marker otel2-fix-py-group-01-final2-20260815T182131Z

  • Respan MCP: 11 traces and 30 unique full records; one root per tree, exact counts, resolved parents, no duplicates/orphans, complete content/tools/errors/propagation

  • release-intent validation, missing-intent coverage, example compilation, and git diff --check passed

  • Full source and paired-example diffs were audited against every applicable document under contribution/; canonical span fields, OTel attribute shapes, release-intent/version ownership, and package boundaries have no remaining package-owned violation.

External follow-ups

  • None documented.

Companion examples

@Nightingalelyy Nightingalelyy changed the title fix(instrumentations): repair AgentOps, AgentScope, and AgentSpec tracing fix(instrumentation): repair AgentScope and AgentSpec OTel 2.x spans Aug 17, 2026
@Nightingalelyy Nightingalelyy changed the title fix(instrumentation): repair AgentScope and AgentSpec OTel 2.x spans fix(instrumentation-py): repair AgentScope and AgentSpec OTel 2.x spans Aug 18, 2026
@Nightingalelyy
Nightingalelyy marked this pull request as ready for review August 19, 2026 06:28

@greptile-apps greptile-apps Bot 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

@fran3cc
fran3cc merged commit 5eb770e into respanai:main Aug 21, 2026
4 checks passed
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