Skip to content

Feishu outbound audio upload omits duration, causing incorrect/0s duration display #8300

@FreeSuperSun

Description

@FreeSuperSun

Bug description

When Hermes sends an outbound audio message to Feishu/Lark, the message can play normally but may show an incorrect duration (for example 0s).

In local testing, the problem appears specifically on the upload step for outbound audio files: the Feishu SDK upload body supports a duration field, but Hermes does not currently pass it when uploading audio before sending the audio message.

Steps to reproduce

  1. Configure Hermes with a working Feishu/Lark gateway.
  2. Generate or provide an outbound audio file (for example .ogg / .opus).
  3. Send it through the Feishu adapter as an outbound audio message.
  4. Observe the message in Feishu.

Expected behavior

The outbound audio message should display the correct duration metadata in Feishu/Lark.

Actual behavior

The audio can be playable, but the duration metadata may be missing or displayed incorrectly (for example 0s).

Root cause

In gateway/platforms/feishu.py, outbound audio upload currently builds CreateFileRequestBody with fields like:

  • file_type
  • file_name
  • file

But the Feishu SDK also supports duration on CreateFileRequestBody for audio uploads.

In local verification:

  • manually uploading the same audio with duration=<milliseconds> made Feishu return/send the audio message with the correct duration
  • patching Hermes locally to probe audio duration and pass it into the upload body also worked

Suggested fix

When the resolved outbound message type is audio:

  1. probe the local audio duration in milliseconds
  2. pass duration into CreateFileRequestBody
  3. upload the file as usual, then send the audio message with the returned file_key

A minimal local patch in gateway/platforms/feishu.py was enough to fix this in testing.

Environment

  • Hermes repo: NousResearch/hermes-agent
  • Platform: Feishu/Lark
  • OS tested: Ubuntu 24.04 under WSL

If helpful, I can open a follow-up PR with the small Feishu adapter fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions