Skip to content

fix(feishu): avoid voice-bubble auto routing and local-path fallback leaks#39997

Closed
lyfuci wants to merge 4 commits into
openclaw:mainfrom
lyfuci:fix/feishu-tts-path-fallback
Closed

fix(feishu): avoid voice-bubble auto routing and local-path fallback leaks#39997
lyfuci wants to merge 4 commits into
openclaw:mainfrom
lyfuci:fix/feishu-tts-path-fallback

Conversation

@lyfuci

@lyfuci lyfuci commented Mar 8, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR fixes Feishu audio/TTS delivery edge cases:

  • remove Feishu from TTS voice-bubble auto channels (Telegram/WhatsApp unchanged)
  • prevent local file-path leakage in Feishu media fallback (no /tmp/... text to users)
  • keep remote URL fallback behavior unchanged

Why

In Feishu, failed media uploads could degrade into sending local temp paths to end users. This is confusing and leaks internal path info.

Changes

  • src/tts/tts.ts
  • src/tts/tts.test.ts
  • extensions/feishu/src/outbound.ts
  • extensions/feishu/src/outbound.test.ts

Validation

  • corepack pnpm oxfmt --check extensions/feishu/src/outbound.ts extensions/feishu/src/outbound.test.ts src/tts/tts.ts src/tts/tts.test.ts
  • corepack pnpm vitest run extensions/feishu/src/outbound.test.ts src/tts/tts.test.ts

AI-assisted

Prepared with AI assistance; logic and outputs were manually validated.

@openclaw-barnacle openclaw-barnacle Bot added channel: feishu Channel integration: feishu size: S labels Mar 8, 2026
@greptile-apps

greptile-apps Bot commented Mar 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes two Feishu-specific edge cases to prevent internal path leakage: it removes Feishu from the VOICE_BUBBLE_CHANNELS set (so TTS audio is delivered as MP3 rather than triggering voice-bubble auto-routing), and it prevents local file paths from being surfaced to end users when media upload fails (replacing the leaked path with a user-friendly Chinese error message for local paths, while keeping the remote URL fallback intact).

Key changes:

  • src/tts/tts.ts: feishu removed from VOICE_BUBBLE_CHANNELS, so resolveOutputFormat returns MP3 defaults instead of opus for Feishu TTS output; audioAsVoice will no longer be set for Feishu replies.
  • extensions/feishu/src/outbound.ts: Added isLocalMediaPath helper (checks path.isAbsolute or file:// prefix); sendText catch block now returns early with "图片发送失败,请重试" instead of falling through to send the raw local image path; sendMedia fallback suppresses local paths with "音频发送失败,请重试" while still forwarding remote URLs as a 📎 link.
  • Tests comprehensively cover absolute path, file:// URL, and remote URL cases for sendMedia, and the sendText image path leakage scenario.

One observation worth noting: The error messages ("图片发送失败,请重试", "音频发送失败,请重试") are hardcoded in Simplified Chinese with no i18n/l10n hook. This is consistent with Feishu's primary user base, but may be worth revisiting if multi-locale Feishu deployments are expected.

Confidence Score: 4/5

  • This PR is safe to merge — changes are small, focused, and well-tested with no regressions introduced.
  • All four changed files have clear, targeted logic with corresponding tests that pass. The isLocalMediaPath helper correctly covers both absolute path and file:// URL cases. The only minor concern is hardcoded Chinese-language error strings with no i18n hook, which could be a problem in multi-locale deployments but is not a blocking issue for the stated goal of this PR.
  • No files require special attention.

Last reviewed commit: 10c2e7f

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Apr 25, 2026
@steipete

Copy link
Copy Markdown
Contributor

Closing this PR rather than keeping it stale.

Why not land:

What may still be worth splitting:

  • A tiny Feishu-only PR to avoid leaking a plain local image path if sendText auto-converts a local image path and the upload fails. Current code still falls through to text after sendMediaFeishu throws at extensions/feishu/src/outbound.ts:184. That should be handled without changing Feishu voice-note/TTS routing.

Local proof on current main: pnpm test extensions/feishu/src/media.test.ts extensions/speech-core/src/tts.test.ts passed (2 files, 33 tests).

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

Labels

channel: feishu Channel integration: feishu size: S stale Marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants