Skip to content

fix(line): classify LINE M4A voice payloads as audio#29785

Closed
Sid-Qin wants to merge 1 commit intoopenclaw:mainfrom
Sid-Qin:fix/29751-line-m4a-audio-detection
Closed

fix(line): classify LINE M4A voice payloads as audio#29785
Sid-Qin wants to merge 1 commit intoopenclaw:mainfrom
Sid-Qin:fix/29751-line-m4a-audio-detection

Conversation

@Sid-Qin
Copy link
Contributor

@Sid-Qin Sid-Qin commented Feb 28, 2026

Summary

  • Problem: LINE voice clips in M4A containers were detected as video/mp4, so audio transcription did not run.
  • Why it matters: users sending LINE voice messages got no transcript-driven response.
  • What changed: MIME sniffing now checks ftyp major brand and classifies known audio brands (for example M4A ) as audio/mp4; regression test added.
  • What did NOT change (scope boundary): no change to non-LINE channels or downstream transcription model behavior.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

User-visible / Behavior Changes

  • LINE M4A voice messages are now treated as audio and continue through audio transcription paths.

Security Impact (required)

  • New permissions/capabilities? (Yes/No) No
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) No
  • Data access scope changed? (Yes/No) No
  • If any Yes, explain risk + mitigation: N/A

Repro + Verification

Environment

  • OS: Linux/macOS dev env
  • Runtime/container: Node + Vitest
  • Model/provider: N/A
  • Integration/channel (if any): LINE
  • Relevant config (redacted): channels.line.* enabled, inbound voice message payload

Steps

  1. Configure LINE channel with media/audio understanding enabled.
  2. Send a LINE voice message encoded as M4A (ftypM4A ).
  3. Observe detected MIME and extension handling in LINE media download path.

Expected

  • Voice payload is detected as audio (audio/mp4) and treated as transcript-eligible media.

Actual

  • Before fix it was detected as video/mp4, bypassing audio transcription selection.

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: pnpm test -- --run src/line/download.test.ts (includes new M4A regression case).
  • Edge cases checked: non-audio ftyp still maps to video/mp4; existing image detections unaffected.
  • What you did not verify: live LINE webhook run against production bot.

Compatibility / Migration

  • Backward compatible? (Yes/No) Yes
  • Config/env changes? (Yes/No) No
  • Migration needed? (Yes/No) No
  • If yes, exact upgrade steps: N/A

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: revert this PR commit.
  • Files/config to restore: src/line/download.ts, src/line/download.test.ts.
  • Known bad symptoms reviewers should watch for: LINE voice messages classified as video again.

Risks and Mitigations

  • Risk: some uncommon ISO BMFF audio brand not in whitelist may still fall back to video/mp4.
    • Mitigation: current whitelist covers common M4A families; easy follow-up to extend brand list with real samples.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 28, 2026

Greptile Summary

Fixed LINE media classification to properly detect M4A audio files by checking the ISO BMFF ftyp major brand field (bytes 8-12) instead of relying on a flawed byte pattern check. The implementation now correctly distinguishes audio brands (m4a, m4b, m4p, m4r, f4a, f4b) from video MP4 containers.

Key changes:

  • Consolidated duplicate ftyp detection logic into a single, more robust check
  • Added audioBrands set to identify audio-specific ISO BMFF brands
  • Ensures M4A voice payloads resolve to audio/mp4 MIME type with .m4a extension
  • Added regression test to verify M4A detection and file extension assignment

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is well-scoped to LINE media type detection, uses the correct ISO BMFF standard for distinguishing audio from video MP4 files, includes proper test coverage, and simplifies the logic by removing duplicate checks. The implementation is more maintainable and correct than the previous approach.
  • No files require special attention

Last reviewed commit: 45120bf

LINE voice messages use ISO BMFF ftyp containers and were misclassified as video/mp4, which skipped audio transcription. Detect major audio brands (e.g. M4A) so voice attachments are treated as audio/mp4 and saved as .m4a.
@Takhoffman
Copy link
Contributor

Superseded by #32546, which consolidates this LINE workstream into the merged canonical fix set.

@Takhoffman Takhoffman closed this Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: LINE voice messages (M4A) not transcribed — detectContentType() classifies M4A as video/mp4

2 participants