openclaw - ✅(Solved) Fix Discord: Components v2 text not extracted from referenced_message in reply context [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#56228Fetched 2026-04-08 01:43:17
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Participants
Timeline (top)
cross-referenced ×1

Root Cause

resolveDiscordMessageText() (line ~301 in route-resolution-*.js) does not extract text from the components tree when flags & 32768 (IS_COMPONENTS_V2) is set.

Discord's API does include the full components array in referenced_message — confirmed via live API testing.

Fix Action

Fix / Workaround

Impact

  • Reply context metadata (ReplyToBody) is empty when replying to v2 component messages
  • Agents cannot see what notification the user is responding to
  • Workaround: use legacy embeds instead of components v2

PR fix notes

PR #56248: fix(discord): recover components v2 text in reply context

Description (problem / solution / changelog)

Summary

  • recover text from Discord Components v2 payloads when message.content is empty
  • apply the same fallback for forwarded snapshot messages used by reply-context/history resolution
  • add regression tests for normal messages and forwarded snapshots

Why

Issue #56228 reports that replies to Components v2-only Discord messages lose the referenced body text. That breaks reply context for approval cards / native UI messages that store their visible text in component TextDisplay blocks instead of content.

Testing

  • Added targeted regression tests in extensions/discord/src/monitor/message-utils.test.ts
  • Tried running pnpm test -- extensions/discord/src/monitor/message-utils.test.ts, but local test execution hit an existing environment/bootstrap failure (bundledChannelPlugins is not iterable) before tests executed

Changed files

  • extensions/discord/src/monitor/message-utils.test.ts (modified, +36/-0)
  • extensions/discord/src/monitor/message-utils.ts (modified, +57/-1)

Code Example

// After embedText extraction, before fallbackText:
if (!baseText && (message.flags & 32768)) {
  baseText = extractComponentsV2Text(message.components);
}
RAW_BUFFERClick to expand / collapse

Problem

When a user replies to a message sent with Discord Components v2 (containers, text display blocks), the reply context body is empty. This is because resolveDiscordMessageText() in route-resolution-*.js only checks content and embeds[0] — both of which are empty by design for v2 messages.

Root Cause

resolveDiscordMessageText() (line ~301 in route-resolution-*.js) does not extract text from the components tree when flags & 32768 (IS_COMPONENTS_V2) is set.

Discord's API does include the full components array in referenced_message — confirmed via live API testing.

Suggested Fix

Add a fallback in resolveDiscordMessageText():

// After embedText extraction, before fallbackText:
if (!baseText && (message.flags & 32768)) {
  baseText = extractComponentsV2Text(message.components);
}

Where extractComponentsV2Text() walks the components tree and concatenates text from type 10 (TextDisplay) nodes.

Impact

  • Reply context metadata (ReplyToBody) is empty when replying to v2 component messages
  • Agents cannot see what notification the user is responding to
  • Workaround: use legacy embeds instead of components v2

Environment

  • OpenClaw 2026.3.23-2
  • Discord channel plugin

extent analysis

Fix Plan

To resolve the issue, we need to modify the resolveDiscordMessageText() function to extract text from the components tree when flags & 32768 (IS_COMPONENTS_V2) is set.

Step-by-Step Solution:

  1. Add a new function extractComponentsV2Text() to walk the components tree and concatenate text from type 10 (TextDisplay) nodes.
  2. Modify resolveDiscordMessageText() to include a fallback for v2 messages:
if (!baseText && (message.flags & 32768)) {
  baseText = extractComponentsV2Text(message.components);
}
  1. Implement extractComponentsV2Text():
function extractComponentsV2Text(components) {
  let text = '';
  components.forEach(component => {
    if (component.type === 10) { // TextDisplay
      text += component.text;
    } else if (component.components) {
      text += extractComponentsV2Text(component.components);
    }
  });
  return text;
}

Verification

To verify the fix, test the following scenarios:

  • Reply to a message sent with Discord Components v2 and check if the reply context body is populated correctly.
  • Verify that agents can see the notification the user is responding to.

Extra Tips

  • Make sure to update the route-resolution-*.js file with the modified resolveDiscordMessageText() function.
  • Consider adding logging or debugging statements to ensure the extractComponentsV2Text() function is working correctly.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix Discord: Components v2 text not extracted from referenced_message in reply context [1 pull requests, 1 participants]