fix(qwenpaw): align session propagation and quiet bootstrap#215
Merged
Conversation
Contributor
There was a problem hiding this comment.
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.namefrominvoke_agentspans 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 AgentScoperun_idpreserved 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.
123liuziming
approved these changes
Jun 11, 2026
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
gen_ai.session.idandgen_ai.user.id, while preserving the AgentScoperun_idfallback when no entry baggage exists.Validation Evidence
81 passed.9 passed.8 passed.8 passed.2 passed.compileallpassed for the changed packages.ruff checkpassed for changed Python files.qwen-turbosmoke 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.Release Note
This is intended for a fast LoongSuite
0.6.1patch release. Existing customer install commands that use unpinnedloongsuite-site-bootstrap,loongsuite-distro,loongsuite-instrumentation-qwenpaw, andloongsuite-instrumentation-agentscopeshould pick up the new PyPI versions after release. QwenPaw interactive startup should add:export LOONGSUITE_PYTHON_SITE_BOOTSTRAP_LOG_SUCCESS=FalseOptionally, customers can also set
LOONGSUITE_PYTHON_SITE_BOOTSTRAP_STATUS_FILEto 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.