Skip to content

fix(discord): fetch and inject reply context for incoming messages#31571

Closed
alaamohanad169-ship-it wants to merge 1 commit into
NousResearch:mainfrom
alaamohanad169-ship-it:fix/discord-reply-clean
Closed

fix(discord): fetch and inject reply context for incoming messages#31571
alaamohanad169-ship-it wants to merge 1 commit into
NousResearch:mainfrom
alaamohanad169-ship-it:fix/discord-reply-clean

Conversation

@alaamohanad169-ship-it

@alaamohanad169-ship-it alaamohanad169-ship-it commented May 24, 2026

Copy link
Copy Markdown
Contributor

Summary

When a Discord message references another message as a reply, Discord sometimes omits the resolved message content (common in high-traffic servers or for older messages). This causes the agent to receive a reply without knowing what it is replying to.

This fix:

  1. Detects when reply_to_text is None but reply_to_id exists
  2. Fetches the referenced message from the Discord API via channel.fetch_message()
  3. Injects the reply context as [Replying to: "<text>"][:200] before the message text

The text is capped at 200 characters to avoid bloating the context.

Changes

  • plugins/platforms/discord/adapter.py: fetch reply-to message when Discord does not provide resolved content inline

Replaces #31447 — rebased cleanly onto current main to remove unintended diff pollution.

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins platform/discord Discord bot adapter duplicate This issue or pull request already exists labels May 24, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #31447 — same author (alaamohanad169-ship-it), same fix (Discord reply context fetch+inject), same file (plugins/platforms/discord/adapter.py). This is the 5th submission. Competing with open #5348 (TTL cache approach). Fixes #30049.

@alaamohanad169-ship-it

Copy link
Copy Markdown
Contributor Author

🔄 Rebased onto latest main (0219b04). All conflicts resolved. CI green. Ready for review.

@alaamohanad169-ship-it

Copy link
Copy Markdown
Contributor Author

Closing this PR — the alt-glitch flag is correct. There are competing PRs from other contributors for this issue (see comments). Rather than compete, I'm stepping back. I'll focus on the two PRs that have no competition (#31579 skills spec compliance, #31612 gateway busy feedback).

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

Labels

comp/plugins Plugin system and bundled plugins duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have platform/discord Discord bot adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants