Skip to content

Bug: Discord message chunks delivered in reverse order #32743

@otcombo

Description

@otcombo

Bug Report

Describe the bug
When a long reply is automatically split into multiple chunks (via textChunkLimit / maxLinesPerMessage), the chunks sometimes arrive in Discord in reverse order. For example, a two-part reply where part 1 is "好,测一下:" and part 2 is "测试结果..." shows up in Discord with part 2 first, then part 1.

Expected behavior
Chunks should always arrive in the correct sequential order — part 1 first, part 2 second.

Root cause hypothesis
The chunks may be sent concurrently (e.g. Promise.all or parallel dispatch) rather than sequentially (await each send before the next). Discord API does not guarantee delivery order for concurrent requests, so even a small timing difference can cause reordering.

Reproduction

  1. Have an agent reply with a message that exceeds textChunkLimit (2000 chars) or maxLinesPerMessage (17 lines)
  2. Observe the order of chunks in Discord — they may be reversed

Environment

  • Channel: Discord
  • Config: default chunk settings (textChunkLimit: 2000, maxLinesPerMessage: 17)

Suggested fix
Send chunks sequentially: await the Discord API response for chunk N before sending chunk N+1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions