Skip to content

fix(discord): preserve embed title in fallback message text#26946

Merged
shakkernerd merged 3 commits intoopenclaw:mainfrom
stakeswky:fix/26907
Feb 25, 2026
Merged

fix(discord): preserve embed title in fallback message text#26946
shakkernerd merged 3 commits intoopenclaw:mainfrom
stakeswky:fix/26907

Conversation

@stakeswky
Copy link

@stakeswky stakeswky commented Feb 25, 2026

Closes #26907

Problem
Discord embed messages with both a title and description were passed to the agent with only the description, so important context in the title was silently lost.

Root Cause
resolveDiscordMessageText() only read message.embeds?.[0]?.description in the fallback chain and did not include title or combine the two fields.

Fix
Add a small embed-text helper that trims and joins title + description with a newline (when both exist), then reuse it for primary message text and forwarded snapshot embed text while preserving existing content/media/fallback precedence.

Testing

  • pnpm install --frozen-lockfile --ignore-scripts
  • pnpm exec vitest run src/discord/monitor/message-utils.test.ts --config vitest.unit.config.ts (19 tests passed, including new title/description regression cases)

Greptile Summary

Created a new helper function resolveDiscordEmbedText that properly combines embed title and description fields with a newline separator when both exist. Previously, resolveDiscordMessageText only read the description field and completely ignored the title, causing important context to be silently lost. The snapshot message handler had similar issues - it would only return the title if description was empty, never combining them.

The fix consolidates embed text resolution into a single reusable helper that handles all edge cases (null, undefined, empty strings, whitespace) correctly and applies consistent behavior across both message and snapshot handling. The implementation correctly preserves the content precedence chain (content > media placeholders > embed text > fallback).

Four comprehensive regression tests were added to ensure the fix works correctly and prevent this issue from recurring.

Confidence Score: 5/5

  • This PR is safe to merge with no identified risks
  • The change is a focused bug fix with clear problem statement and solution. The new helper function is well-designed with proper edge case handling. Comprehensive test coverage verifies all scenarios including edge cases. The fix addresses the issue in both affected locations (message and snapshot handling) maintaining consistency. No breaking changes or risky modifications to existing behavior beyond the intended fix.
  • No files require special attention

Last reviewed commit: ea06cee

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Discord embed title dropped from message text — only description is passed to agent

2 participants