Skip to content

feat(copaw): add CoPaw instrumentation, LoongSuite CI, and bootstrap mapping#162

Open
Cirilla-zmh wants to merge 8 commits intoalibaba:mainfrom
Cirilla-zmh:feat/copaw
Open

feat(copaw): add CoPaw instrumentation, LoongSuite CI, and bootstrap mapping#162
Cirilla-zmh wants to merge 8 commits intoalibaba:mainfrom
Cirilla-zmh:feat/copaw

Conversation

@Cirilla-zmh
Copy link
Copy Markdown
Collaborator

Description

What changed

CoPaw instrumentation package

New package under instrumentation-loongsuite/loongsuite-instrumentation-copaw/: CoPawInstrumentor wraps CoPaw’s runner conversation path with ExtendedTelemetryHandler entry lifecycle (start_entry / stop_entry / fail_entry), builds EntryInvocation from request/session/channel and stream chunks (_entry_utils + patch.py), and records streaming gen_ai.response.time_to_first_token where applicable. Depends on opentelemetry-util-genai; forwards tracer_provider / meter_provider / logger_provider from instrument().

CI and tox

tox-loongsuite.ini: environments for py3{10,11,12,13}-test-loongsuite-instrumentation-copaw-{oldest,latest} and lint-loongsuite-instrumentation-copaw (lint intentionally does not merge copaw requirements.oldest with dev-requirements—documented resolver conflict). .github/workflows/loongsuite_test_0.yml and loongsuite_lint_0.yml regenerated so CI runs those tox targets.

Distro bootstrap

bootstrap_gen.py: adds copaw >= 0.1.0loongsuite-instrumentation-copaw mapping for loongsuite-bootstrap auto-install, and bumps pinned opentelemetry-instrumentation-* versions broadly to 0.62b0.dev for consistency with the current contrib line.

Cross-package test requirements & mem0 layout

Tightens or realigns requirements.latest.txt / requirements.oldest.txt (and related pins) for Agentscope, Claude Agent SDK, Google ADK, Langgraph, LiteLLM tests. mem0: moves toward tests/requirements.latest.txt / tests/requirements.oldest.txt and removes legacy test-requirements-*.txt roots—keeps tox env wiring in sync with other packages.

Documentation & housekeeping

README for the CoPaw package (Getting Started with Site-bootstrap, what is instrumented). CHANGELOG trimmed for release notes style. instrumentation-loongsuite/README.md lists the new package; dev-requirements.txt minor bump.

Tests

  • instrumentation-loongsuite/loongsuite-instrumentation-copaw/tests/test_entry_span.py — real CoPaw + monkeypatched approval path; asserts Entry span name, operation, kind, session/user, copaw attributes, TTFT.
  • tests/test_entry_utils.py — parsing and EntryInvocation helpers without full app.
  • tests/test_instrument_smoke.py — instrument/uninstrument round-trip and log/smoke path with a single finished span.
  • tests/conftest.py — exporter + CoPawInstrumentor with GenAI stability opt-in.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Add integration tests

Does This PR Require a Core Repo Change?

  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

Change-Id: I8d06200cd5339d346ab52a324936be397faf153d
Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: I8bdf89aaa10e11bc83905ef13a86d742ce129624
Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: Id69b2e64718a2fff833b65f7719392a459245745
Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: Id06932c4f84250a4eb9c7d9ad0737b738ce29fcb
Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: Id97f3af859508e8e49cc70901642b3e566ca1e98
Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: I6a1d48bee3a171ed0301d48b699edd2a04f8c7d5
Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: I4fa0e0a5a5a9d179d59bb8dd536ff8f1f76732dd
Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: I82f811fac4c7a1665efd9f420545e187d4f27eb0
Co-developed-by: Cursor <noreply@cursor.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new LoongSuite instrumentation package for CoPaw and wires it into LoongSuite’s CI/tox and distro bootstrap auto-install mapping, alongside a set of test-requirements reshuffles/standardization across existing instrumentations.

Changes:

  • Introduce loongsuite-instrumentation-copaw implementing Entry-span telemetry for AgentRunner.query_handler, plus tests and package metadata.
  • Extend tox-loongsuite.ini + GitHub Actions workflows to run CoPaw tests/lint in CI and realign some existing test-requirements paths (e.g., mem0).
  • Update distro bootstrap mapping (bootstrap_gen.py) to include CoPaw and bump pinned instrumentation versions; update docs/README listings accordingly.

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
tox-loongsuite.ini Adds CoPaw test/lint envs and updates some dependency file paths (notably mem0).
README.md Lists CoPaw instrumentation; adds extra blank lines near the bottom.
README-zh.md Lists CoPaw instrumentation in the Chinese README.
loongsuite-distro/src/loongsuite/distro/bootstrap_gen.py Adds CoPaw mapping and bumps pinned instrumentation versions across bootstrap mappings.
instrumentation-loongsuite/README.md Adds CoPaw (and other newer packages) to instrumentation package index.
instrumentation-loongsuite/loongsuite-instrumentation-mem0/tests/requirements.oldest.txt New “oldest” test requirements file under tests/.
instrumentation-loongsuite/loongsuite-instrumentation-mem0/tests/requirements.latest.txt New “latest” test requirements file under tests/ with non-hermetic warning.
instrumentation-loongsuite/loongsuite-instrumentation-mem0/test-requirements-oldest.txt Removes legacy root-level oldest requirements file.
instrumentation-loongsuite/loongsuite-instrumentation-mem0/test-requirements-latest.txt Removes legacy root-level latest requirements file.
instrumentation-loongsuite/loongsuite-instrumentation-litellm/tests/test-requirements.txt Minor documentation/comment tweak.
instrumentation-loongsuite/loongsuite-instrumentation-langgraph/tests/requirements.oldest.txt Adds license header + clarifies “oldest” requirements intent.
instrumentation-loongsuite/loongsuite-instrumentation-langgraph/tests/requirements.latest.txt Adds license header + non-hermetic warning text.
instrumentation-loongsuite/loongsuite-instrumentation-google-adk/tests/requirements.oldest.txt Adds license header + clarifies “oldest” requirements intent.
instrumentation-loongsuite/loongsuite-instrumentation-google-adk/tests/requirements.latest.txt Adds license header + non-hermetic warning text.
instrumentation-loongsuite/loongsuite-instrumentation-copaw/tests/test_instrument_smoke.py Smoke tests for instrument/uninstrument and a minimal query path.
instrumentation-loongsuite/loongsuite-instrumentation-copaw/tests/test_entry_utils.py Unit tests for argument parsing and EntryInvocation helpers.
instrumentation-loongsuite/loongsuite-instrumentation-copaw/tests/test_entry_span.py Integration-style test asserting Entry span attributes and TTFT.
instrumentation-loongsuite/loongsuite-instrumentation-copaw/tests/requirements.txt Test environment requirements for CoPaw instrumentation tests.
instrumentation-loongsuite/loongsuite-instrumentation-copaw/tests/conftest.py Pytest fixtures for tracer/span exporter and instrumentation setup.
instrumentation-loongsuite/loongsuite-instrumentation-copaw/src/opentelemetry/instrumentation/copaw/version.py Defines package version.
instrumentation-loongsuite/loongsuite-instrumentation-copaw/src/opentelemetry/instrumentation/copaw/patch.py Implements the query_handler wrapper that drives Entry telemetry.
instrumentation-loongsuite/loongsuite-instrumentation-copaw/src/opentelemetry/instrumentation/copaw/package.py Declares instrumentation dependency metadata.
instrumentation-loongsuite/loongsuite-instrumentation-copaw/src/opentelemetry/instrumentation/copaw/_entry_utils.py Utilities to build EntryInvocation and map messages/chunks.
instrumentation-loongsuite/loongsuite-instrumentation-copaw/src/opentelemetry/instrumentation/copaw/init.py Adds CoPawInstrumentor wiring wrapt patches to the handler.
instrumentation-loongsuite/loongsuite-instrumentation-copaw/README.md Usage documentation (site-bootstrap recommended approach) and scope/attributes.
instrumentation-loongsuite/loongsuite-instrumentation-copaw/pyproject.toml New package metadata, deps, and entry point registration.
instrumentation-loongsuite/loongsuite-instrumentation-copaw/CHANGELOG.md Initial changelog for the new package.
instrumentation-loongsuite/loongsuite-instrumentation-claude-agent-sdk/tests/requirements.latest.txt Adds non-hermetic warning/commentary section.
instrumentation-loongsuite/loongsuite-instrumentation-agentscope/tests/requirements.oldest.txt Adds license header + clarifies “oldest” requirements intent.
instrumentation-loongsuite/loongsuite-instrumentation-agentscope/tests/requirements.latest.txt Adds license header + non-hermetic warning text.
dev-requirements.txt Loosens requests pin to >= with a comment about CoPaw.
.github/workflows/loongsuite_test_0.yml Adds CI jobs to run CoPaw tests across Python 3.10–3.13.
.github/workflows/loongsuite_lint_0.yml Adds CI job to run CoPaw lint target.

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

Comment on lines +142 to +144
copaw: -r {toxinidir}/instrumentation-loongsuite/loongsuite-instrumentation-copaw/tests/requirements.txt
lint-loongsuite-instrumentation-copaw: -r {toxinidir}/instrumentation-loongsuite/loongsuite-instrumentation-copaw/tests/requirements.oldest.txt

Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lint-loongsuite-instrumentation-copaw installs tests/requirements.oldest.txt, but that file does not exist in loongsuite-instrumentation-copaw/tests/ (only requirements.txt is present). This will make the lint tox env (and CI lint job) fail during dependency resolution. Add the missing requirements.oldest.txt (and update tox to use it), or change the tox deps to reference an existing requirements file.

Copilot uses AI. Check for mistakes.
Comment on lines 140 to +143
loongsuite-crewai: -r {toxinidir}/instrumentation-loongsuite/loongsuite-instrumentation-crewai/tests/test-requirements.txt

copaw: -r {toxinidir}/instrumentation-loongsuite/loongsuite-instrumentation-copaw/tests/requirements.txt
lint-loongsuite-instrumentation-copaw: -r {toxinidir}/instrumentation-loongsuite/loongsuite-instrumentation-copaw/tests/requirements.oldest.txt
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dependency selector copaw: matches both py3*-test-loongsuite-instrumentation-copaw and lint-loongsuite-instrumentation-copaw env names (they both include the copaw factor), so the lint env will also install the full CoPaw test requirements (including copaw==1.0.0). If the intent is to keep lint lightweight / conflict-free (as is done for other packages), scope this to the test env factors (e.g., test-loongsuite-instrumentation-copaw:) or introduce explicit copaw-oldest/copaw-latest factors similar to other instrumentations.

Copilot uses AI. Check for mistakes.
Comment on lines +74 to +76
; loongsuite-instrumentation-copaw
py3{10,11,12,13}-test-loongsuite-instrumentation-copaw
lint-loongsuite-instrumentation-copaw
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description mentions py3{10,11,12,13}-test-loongsuite-instrumentation-copaw-{oldest,latest} environments, but the envlist adds only py3{10,11,12,13}-test-loongsuite-instrumentation-copaw (no oldest/latest split). Either update the tox env naming to match the documented oldest/latest pattern, or adjust the PR description so CI expectations match what tox actually defines.

Copilot uses AI. Check for mistakes.
Comment on lines +27 to +32
dependencies = [
"opentelemetry-api >= 1.37",
"opentelemetry-instrumentation >= 0.58b0",
"opentelemetry-semantic-conventions >= 0.58b0",
"opentelemetry-util-genai",
"wrapt >= 1.17.3",
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This package uses opentelemetry-api >= 1.37 while other LoongSuite instrumentation packages in this repo constrain it with ~= 1.37 (e.g., agentscope/mem0). Using >= risks pulling in a future incompatible major/minor API. Consider aligning with the repo’s pattern (opentelemetry-api ~= 1.37) unless there is a tested compatibility guarantee across future versions.

Copilot uses AI. Check for mistakes.
markupsafe>=2.0.1
codespell==2.1.0
requests==2.32.3
requests>=2.32.3 # LoongSuite Extension: Copaw requires requests>=2.32.3
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dev-requirements.txt is otherwise fully pinned for reproducible dev environments, but requests was changed from an exact pin to >=. If CoPaw needs a newer minimum, consider keeping an exact pin here (and updating the pinned version) while expressing the minimum in the CoPaw package/test requirements instead, to avoid non-deterministic tooling installs.

Suggested change
requests>=2.32.3 # LoongSuite Extension: Copaw requires requests>=2.32.3
requests==2.32.3 # LoongSuite Extension: Copaw requires requests>=2.32.3

Copilot uses AI. Check for mistakes.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Wrap ``AgentRunner.query_handler`` with LongSuite Entry telemetry."""
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docstring says "LongSuite" but the project/package name elsewhere is "LoongSuite". Please fix the spelling for consistency in user-facing docs.

Suggested change
"""Wrap ``AgentRunner.query_handler`` with LongSuite Entry telemetry."""
"""Wrap ``AgentRunner.query_handler`` with LoongSuite Entry telemetry."""

Copilot uses AI. Check for mistakes.
Comment on lines +15 to +20
"""
LongSuite CoPaw instrumentation (``copaw >= 0.1.0``).

Instruments ``AgentRunner.query_handler`` with ``ExtendedTelemetryHandler.entry``
(``enter_ai_application_system``). Agent / tool / LLM spans come from AgentScope
and other instrumentations.
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docstring uses "LongSuite" in multiple places, but the project name is "LoongSuite". Please correct the spelling to avoid confusion in generated docs and help text.

Copilot uses AI. Check for mistakes.
Comment on lines +539 to +540


Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two extra blank lines added just before the "## Resources" heading. This creates trailing whitespace/formatting noise and can cause unnecessary diffs later; please remove the extra empty lines.

Suggested change

Copilot uses AI. Check for mistakes.
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.

4 participants