Skip to content

fix(qwenpaw): align session propagation and quiet bootstrap#215

Merged
sipercai merged 4 commits into
mainfrom
liuyu/qwenpaw-genai-customer-bundle
Jun 11, 2026
Merged

fix(qwenpaw): align session propagation and quiet bootstrap#215
sipercai merged 4 commits into
mainfrom
liuyu/qwenpaw-genai-customer-bundle

Conversation

@sipercai

Copy link
Copy Markdown
Collaborator

Summary

  • Propagate GenAI agent names from agent spans to nested child spans through baggage.
  • Align AgentScope spans created under QwenPaw entry spans with the QwenPaw entry gen_ai.session.id and gen_ai.user.id, while preserving the AgentScope run_id fallback when no entry baggage exists.
  • Add a site-bootstrap success-log opt-out and optional JSON status file so interactive QwenPaw stdout is not polluted.
  • Document the QwenPaw bootstrap environment variables and the session propagation behavior.

Validation Evidence

  • Focused util-genai tests: 81 passed.
  • Focused LangChain agent-name tests: 9 passed.
  • Focused AgentScope tests: 8 passed.
  • Focused QwenPaw instrumentation tests: 8 passed.
  • Focused site-bootstrap tests: 2 passed.
  • compileall passed for the changed packages.
  • ruff check passed for changed Python files.
  • Built local wheels for the affected LoongSuite packages and installed them into an official QwenPaw 1.1.10 environment.
  • Real DashScope qwen-turbo smoke passed through QwenPaw entry + AgentScope ReActAgent. The entry, agent, LLM, ReAct step, and formatter spans shared the same session/user attributes; LLM/ReAct child spans carried the expected agent name.
  • Site-bootstrap silent mode was verified: no success line on stdout and status JSON reported the patched version.

Release Note

This is intended for a fast LoongSuite 0.6.1 patch release. Existing customer install commands that use unpinned loongsuite-site-bootstrap, loongsuite-distro, loongsuite-instrumentation-qwenpaw, and loongsuite-instrumentation-agentscope should pick up the new PyPI versions after release. QwenPaw interactive startup should add:

export LOONGSUITE_PYTHON_SITE_BOOTSTRAP_LOG_SUCCESS=False

Optionally, customers can also set LOONGSUITE_PYTHON_SITE_BOOTSTRAP_STATUS_FILE to get a local success marker without stdout output.

Notes

Weaver live-check was not run for this expedited customer patch; span attributes and tree shape were validated from in-memory exported spans during the real DashScope smoke.

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.

Pull request overview

This PR improves GenAI trace correlation across QwenPaw + AgentScope + LangChain by propagating request identity (session/user) and agent identity (agent name) through OpenTelemetry baggage, and it makes site-bootstrap quieter for interactive CLIs by allowing stdout success-log opt-out plus an optional status JSON file.

Changes:

  • Propagate gen_ai.agent.name from invoke_agent spans to nested GenAI child spans via internal baggage (traffic.llm_sdk.gen_ai.agent.name).
  • Prefer QwenPaw Entry baggage identity (gen_ai.session.id / gen_ai.user.id) when creating AgentScope invocations/spans, with AgentScope run_id preserved as a fallback.
  • Add site-bootstrap controls to suppress the default success line on stdout and optionally write an atomic status JSON file; document the behavior.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.

Show a summary per file
File Description
util/opentelemetry-util-genai/tests/test_extended_handler.py Adds tests for agent-name baggage propagation, nesting override/restore, and attribute coloring of child spans.
util/opentelemetry-util-genai/src/opentelemetry/util/genai/handler.py Injects agent name from baggage into LLM invocation attributes and preserves caller-provided context when attaching spans.
util/opentelemetry-util-genai/src/opentelemetry/util/genai/extended_handler.py Applies baggage-based agent-name injection across additional GenAI operations and sets agent-name baggage during start_invoke_agent.
util/opentelemetry-util-genai/README-loongsuite.rst Documents internal agent-name baggage propagation behavior.
util/opentelemetry-util-genai/CHANGELOG-loongsuite.md Adds an Unreleased entry describing agent-name propagation to child spans.
README.md Documents site-bootstrap success-log suppression and status-file option (English).
README-zh.md Documents site-bootstrap success-log suppression and status-file option (Chinese).
loongsuite-site-bootstrap/tests/test_bootstrap_status.py Adds tests for atomic status JSON writes and success-log default/falsey parsing.
loongsuite-site-bootstrap/src/loongsuite_site_bootstrap/init.py Implements success-log opt-out, status JSON writer, and an is_initialized() indicator.
loongsuite-site-bootstrap/README.md Documents quiet mode, status file format, and initialization signaling.
instrumentation-loongsuite/loongsuite-instrumentation-qwenpaw/README.md Documents recommended site-bootstrap env vars for interactive QwenPaw and baggage-based identity propagation.
instrumentation-loongsuite/loongsuite-instrumentation-langchain/tests/test_agent_spans.py Adds a regression test ensuring agent context colors child LLM/tool spans with gen_ai.agent.name.
instrumentation-loongsuite/loongsuite-instrumentation-langchain/src/opentelemetry/instrumentation/langchain/internal/_tracer.py Preserves full current context (including baggage) for run tracking and correct parenting/propagation.
instrumentation-loongsuite/loongsuite-instrumentation-agentscope/tests/test_utils.py Adds tests for preferring entry baggage identity and fallback to AgentScope run_id.
instrumentation-loongsuite/loongsuite-instrumentation-agentscope/src/opentelemetry/instrumentation/agentscope/utils.py Adds helpers to read/copy entry identity from baggage onto invocations and to set conversation/session/user attributes.
instrumentation-loongsuite/loongsuite-instrumentation-agentscope/src/opentelemetry/instrumentation/agentscope/patch.py Applies entry baggage identity to tool and formatter spans/attributes.
instrumentation-loongsuite/loongsuite-instrumentation-agentscope/src/opentelemetry/instrumentation/agentscope/_wrapper.py Ensures ReAct step invocations copy entry baggage identity.
instrumentation-genai/opentelemetry-instrumentation-langchain/src/opentelemetry/instrumentation/langchain/callback_handler.py Removes an unnecessary inline type-ignore on message content assignment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sipercai sipercai merged commit bced622 into main Jun 11, 2026
198 checks passed
@sipercai sipercai deleted the liuyu/qwenpaw-genai-customer-bundle branch June 11, 2026 06:30
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