Skip to content

fix(weixin): preserve voice transcript origin - #65022

Closed
zgzczzw wants to merge 1 commit into
NousResearch:mainfrom
zgzczzw:fix/weixin-preserve-voice-transcript-origin
Closed

fix(weixin): preserve voice transcript origin#65022
zgzczzw wants to merge 1 commit into
NousResearch:mainfrom
zgzczzw:fix/weixin-preserve-voice-transcript-origin

Conversation

@zgzczzw

@zgzczzw zgzczzw commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Preserves the voice origin when Weixin supplies a server-side transcript in voice_item.text.

Previously, _extract_text() returned the transcript as plain text. Because _download_voice() intentionally skips downloading audio when Weixin already supplied text, the resulting event had no media and was classified as ordinary text. Downstream agents therefore could not distinguish a voice transcript from text typed by the user.

This change adds a compact platform-origin marker while leaving ordinary text messages unchanged. It is a deliberately narrower alternative to #27235: it preserves the missing semantic information without adding outbound echo state or a new behavior/configuration knob.

Related Issue

Related to #11686 and #27235.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • Update gateway/platforms/weixin.py to retain an explicit voice-transcript marker for voice_item.text.
  • Add a regression test in tests/gateway/test_weixin.py covering the exact inbound payload shape.

How to Test

  1. Send a Weixin voice message for which Weixin provides voice_item.text.
  2. Confirm the agent receives [Voice transcription provided by Weixin] followed by the transcript.
  3. Confirm typed text continues to pass through unchanged.

Automated verification:

scripts/run_tests.sh tests/gateway/test_weixin.py -v
72 passed, 0 failed

venv/bin/ruff check gateway/platforms/weixin.py tests/gateway/test_weixin.py
All checks passed!

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • I searched existing PRs and issues
  • My PR contains only related changes
  • I've run the entire pytest tests/ -q suite locally (targeted Weixin suite passes)
  • I've added tests for my changes
  • I've tested on Linux through a live Weixin gateway

Documentation & Housekeeping

  • Documentation update — N/A
  • cli-config.yaml.example update — N/A; no config keys changed
  • CONTRIBUTING.md / AGENTS.md update — N/A; no architecture or workflow change
  • Cross-platform impact considered; change is platform payload text handling only
  • Tool descriptions/schemas update — N/A

@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery platform/wecom WeCom / WeChat Work adapter tool/tts Text-to-speech and transcription P2 Medium — degraded but workaround exists sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Jul 15, 2026

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review Summary

Verdict: Approved

Looks Good

  • Fix(weixin): preserve voice transcript origin
  • 39 additions, 1 deletion — targeted fix
  • No issues detected

Reviewed by Hermes Agent

@teknium1

Copy link
Copy Markdown
Contributor

Merged into main via consolidated salvage PR #73515 (merge c911a5f10f). Your Weixin transcript-origin tagging ([Voice transcription provided by Weixin] when no raw audio exists) was cherry-picked with your authorship, merged with #47125.

Your contribution is credited to you in git history. Thank you! Closing this PR as merged-via-salvage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/wecom WeCom / WeChat Work adapter sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages tool/tts Text-to-speech and transcription type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants