Skip to content

fix: silence GenAI audio optional dependency import warning#223

Merged
sipercai merged 1 commit into
mainfrom
liuyu/fix/genai-stdout-pollution
Jun 18, 2026
Merged

fix: silence GenAI audio optional dependency import warning#223
sipercai merged 1 commit into
mainfrom
liuyu/fix/genai-stdout-pollution

Conversation

@sipercai

Copy link
Copy Markdown
Collaborator

Description

Fixes #217.

This removes the import-time warning from opentelemetry.util.genai._multimodal_upload.pre_uploader when optional audio conversion dependencies (numpy or soundfile) are not installed. The PCM16-to-WAV conversion path still logs a single warning when conversion is actually attempted and cannot be performed.

The change is intentionally scoped to loongsuite-otel-util-genai. loongsuite-site-bootstrap is out of scope because its stdout success line already has the LOONGSUITE_PYTHON_SITE_BOOTSTRAP_LOG_SUCCESS=False mitigation in the released package.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • python -m ruff check util/opentelemetry-util-genai/src/opentelemetry/util/genai/_multimodal_upload/pre_uploader.py util/opentelemetry-util-genai/tests/_multimodal_upload/test_pre_uploader_audio.py util/opentelemetry-util-genai/CHANGELOG.md
  • PYTHONPATH=util/opentelemetry-util-genai/src:opentelemetry-instrumentation/src python -m pytest util/opentelemetry-util-genai/tests/_multimodal_upload/test_pre_uploader_audio.py -q
  • PYTHONPATH=util/opentelemetry-util-genai/src:opentelemetry-instrumentation/src python -m pytest util/opentelemetry-util-genai/tests -q
  • Temporary QwenPaw 1.1.12 + DashScope qwen3-max real API smoke comparing release util against this PR util overlay; release emitted the reported warning, PR overlay did not.
  • Temporary QwenPaw instrumentation pytest run with QwenPaw 1.1.12 and this PR util overlay.
  • tox -e precommit

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

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

Validation Evidence

Spec and Scope

  • Linked issue/spec: numpy or soundfile not available, PCM16 to WAV conversion will be skipped #217
  • Approved spec/comment: direct bug fix request; loongsuite-site-bootstrap explicitly excluded from this PR because the released 0.6.1 package already supports LOONGSUITE_PYTHON_SITE_BOOTSTRAP_LOG_SUCCESS=False.
  • Changed surface: loongsuite-otel-util-genai multimodal pre-uploader optional audio dependency handling.

Local Checks

Check Command Result Notes
Static readiness python "$PIPELINE_SKILL_DIR/scripts/check_loongsuite_pr_readiness.py" --repo . pass Warned that no instrumentation plugin directory changed; expected for shared util-only change.
Precommit tox -e precommit pass First run reformatted one test file; rerun passed.
Focused tests PYTHONPATH=util/opentelemetry-util-genai/src:opentelemetry-instrumentation/src python -m pytest util/opentelemetry-util-genai/tests/_multimodal_upload/test_pre_uploader_audio.py -q pass 16 passed.
Full util tests PYTHONPATH=util/opentelemetry-util-genai/src:opentelemetry-instrumentation/src python -m pytest util/opentelemetry-util-genai/tests -q pass 270 passed, 1 skipped (OSS credentials not set).
QwenPaw focused tests LOONGSUITE_PYTHON_SITE_BOOTSTRAP=False PYTHONPATH=instrumentation-loongsuite/loongsuite-instrumentation-qwenpaw/src:util/opentelemetry-util-genai/src:opentelemetry-instrumentation/src python -m pytest instrumentation-loongsuite/loongsuite-instrumentation-qwenpaw/tests util/opentelemetry-util-genai/tests/_multimodal_upload/test_pre_uploader_audio.py -q pass 29 passed in a temporary QwenPaw environment.
Claude review claude_team_review.py review . --backend review ... pass One non-blocking suggestion about exact test assertion disputed; exact assertion is intentional to prevent duplicate warning regression.
Privacy scan git diff | rg -n "sk-[A-Za-z0-9]|DASHSCOPE_API_KEY|OPENAI_API_KEY|ANTHROPIC_API_KEY|Bearer [A-Za-z0-9]|/Users/sipercai|/tmp/codex-claude-review|private trace|trace_id|traceId" || true pass No matches.

Real E2E Matrix

Scenario Status Command or Demo Evidence
non-streaming pass Temporary QwenPaw 1.1.12 + DashScope qwen3-max AgentRunner.query_handler smoke with release util and PR util overlay. Release util stderr started with numpy or soundfile not available...; PR util overlay removed that line. Both runs completed with real_api_chunks=5 last=True.
streaming pass Same QwenPaw async generator smoke. The runner yielded streamed chunks and completed successfully with PR util overlay.
concurrency N/A Import-time warning side effect is process startup behavior; no shared mutable runtime path changed. Covered by subprocess import regression with optional audio libs blocked.
agent/tool/ReAct N/A This PR does not change QwenPaw/AgentScope agent or tool instrumentation. QwenPaw runner smoke was used only to validate the customer startup path.
tool-heavy N/A No tool execution behavior changed. Not applicable to optional audio dependency import logging.
error path pass test_pcm16_conversion_missing_audio_libs_logs_single_warning Missing audio libs during actual PCM16 conversion produce exactly one conversion-skip warning and keep original audio/pcm16 content type.

Telemetry and Weaver

Check Status Command or Artifact Notes
Span tree / span kinds N/A N/A No GenAI span creation, attributes, parent-child relationships, or exporter behavior changed.
Content capture modes N/A N/A No content-capture semantics changed.
Concurrency isolation N/A N/A No trace/context propagation or shared runtime telemetry state changed.
Weaver live-check N/A N/A No telemetry sample shape changed; this PR only removes import-time optional dependency logging.

CI

  • GitHub checks: not available until the branch is pushed and PR is opened.
  • Known unrelated failures: none.
  • Follow-up needed: inspect CI after PR creation.

@sipercai sipercai merged commit 01bba83 into main Jun 18, 2026
22 of 25 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.

numpy or soundfile not available, PCM16 to WAV conversion will be skipped

3 participants