Skip to content

[Bug]: Discord live replies can ignore effective maxLinesPerMessage and fall back to 17 #40128

@rbutera

Description

@rbutera

Bug type

Behavior bug (incorrect output/state without crash)

Summary

Discord live auto-reply surfaces can ignore the effective maxLinesPerMessage setting and fall back to the default of 17 lines when the runtime discordConfig object is partial and omits that field.

Steps to reproduce

  1. Configure Discord with a root setting such as channels.discord.maxLinesPerMessage: 120.
  2. Leave the runtime/live reply path using a discordConfig object that does not include maxLinesPerMessage explicitly.
  3. Trigger a Discord auto-reply that produces more than 17 short lines but fewer than 120 lines.
  4. Observe the live reply path (auto-reply preview/final delivery, slash/native reply, or component reply).

Expected behavior

The reply should use the effective Discord config for the active account: root channels.discord.maxLinesPerMessage unless channels.discord.accounts.<account>.maxLinesPerMessage overrides it.

Actual behavior

The live reply path can treat maxLinesPerMessage as missing and fall back to the built-in default of 17, causing unnecessary Discord message splitting even though the effective config is higher.

OpenClaw version

2026.3.8

Operating system

Debian GNU/Linux 12

Install method

Source checkout / pnpm dev

Logs, screenshots, and evidence

Confirmed in code paths that previously read `discordConfig?.maxLinesPerMessage` directly:
- src/discord/monitor/message-handler.process.ts
- src/discord/monitor/native-command.ts
- src/discord/monitor/agent-components.ts

Confirmed effective config precedence in:
- src/discord/accounts.ts (`mergeDiscordAccountConfig` / `resolveDiscordAccount`)

Regression coverage added locally for:
- root Discord config fallback when runtime config omits the field
- per-account Discord override over root
- higher-level slash/native command reply behavior with partial runtime config

Impact and severity

Affected: Discord users on live auto-reply surfaces, especially installs using root-level Discord config or relying on merged account config
Severity: Medium to High (replies still send, but formatting/splitting is incorrect and noisy)
Frequency: Deterministic when the runtime discordConfig omits maxLinesPerMessage
Consequence: Replies split into extra Discord messages, degrading readability and changing channel behavior unexpectedly

Additional information

This is not a true per-agent config issue. The real precedence is root Discord config plus per-account Discord config. Agent routing only matters indirectly if a route selects a different Discord account.

Fixed locally on a branch with commit 6acb57223af61f3e0dde6bb4f39ec8be3fb6ce17.

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