openclaw - 💡(How to fix) Fix Discord voice message media reference stale after first voice message [1 comments, 2 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#77866Fetched 2026-05-06 06:20:07
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
2
Author
Timeline (top)
closed ×1commented ×1

Root Cause

OpenClaw's session history pruning logic in selection-DL4MPaGt.js replaces media references with the pruned marker (PRUNED_HISTORY_MEDIA_REFERENCE_MARKER) once they've appeared in a previous turn. However, each inbound Discord voice message is a distinct message with its own attachment UUID, not a repeated reference to the same media.

The files are correctly saved to disk:

~/.openclaw/media/inbound/voice-message---<uuid1>.ogg  (first voice message)
~/.openclaw/media/inbound/voice-message---<uuid2>.ogg  (second voice message)
~/.openclaw/media/inbound/voice-message---<uuid3>.ogg  (third voice message)

But the agent only receives the first UUID. Subsequent messages in the session context show:

[media reference removed - already processed by model]

Fix Action

Workaround

The agent can bypass this by directly scanning the media directory for the newest .ogg file:

ls -1t ~/.openclaw/media/inbound/voice-message---*.ogg | head -1

This is fragile and should not be necessary.

Code Example

~/.openclaw/media/inbound/voice-message---<uuid1>.ogg  (first voice message)
~/.openclaw/media/inbound/voice-message---<uuid2>.ogg  (second voice message)
~/.openclaw/media/inbound/voice-message---<uuid3>.ogg  (third voice message)

---

ls -1t ~/.openclaw/media/inbound/voice-message---*.ogg | head -1
RAW_BUFFERClick to expand / collapse

Bug Description

When a user sends multiple voice messages in a Discord channel, only the first voice message's media file is correctly referenced. Subsequent voice messages create unique .ogg files on disk but OpenClaw's session history pruning replaces their references with [media reference removed - already processed by model].

The agent always attempts to transcribe the first voice message file, regardless of which voice message was actually sent.

Steps to Reproduce

  1. Configure Discord integration with voice message support
  2. User sends voice message #1 — agent receives correct media path, transcribes ✅
  3. User sends voice message #2 (new recording, new content) — agent sees [media reference removed - already processed by model]
  4. Agent transcribes the stale file from step 2 instead of the new one

Root Cause

OpenClaw's session history pruning logic in selection-DL4MPaGt.js replaces media references with the pruned marker (PRUNED_HISTORY_MEDIA_REFERENCE_MARKER) once they've appeared in a previous turn. However, each inbound Discord voice message is a distinct message with its own attachment UUID, not a repeated reference to the same media.

The files are correctly saved to disk:

~/.openclaw/media/inbound/voice-message---<uuid1>.ogg  (first voice message)
~/.openclaw/media/inbound/voice-message---<uuid2>.ogg  (second voice message)
~/.openclaw/media/inbound/voice-message---<uuid3>.ogg  (third voice message)

But the agent only receives the first UUID. Subsequent messages in the session context show:

[media reference removed - already processed by model]

Impact

Users who use Discord voice messages to interact with OpenClaw can only reliably send one voice message per session. Every subsequent voice message returns the transcription of the first one.

Workaround

The agent can bypass this by directly scanning the media directory for the newest .ogg file:

ls -1t ~/.openclaw/media/inbound/voice-message---*.ogg | head -1

This is fragile and should not be necessary.

Environment

  • OpenClaw version: 2026.5.3-1
  • OS: macOS 26.4.1 (arm64)
  • Discord integration: standard guild config
  • Model: deepseek/deepseek-v4-flash

Co-authored-by: Claw (OpenClaw agent, workspace: ~/.openclaw/workspace)

extent analysis

TL;DR

Update the session history pruning logic in selection-DL4MPaGt.js to handle distinct message attachments with unique UUIDs.

Guidance

  • Review the selection-DL4MPaGt.js file to understand the current session history pruning logic and how it replaces media references with the pruned marker.
  • Modify the logic to account for distinct message attachments with unique UUIDs, ensuring that each inbound Discord voice message is treated as a new reference.
  • Verify that the agent correctly receives and transcribes subsequent voice messages by checking the session context for the expected media references.
  • Consider implementing a more robust solution that doesn't rely on scanning the media directory for the newest file, as the current workaround is fragile.

Example

No code snippet is provided as the necessary changes are specific to the selection-DL4MPaGt.js file, which is not fully shown in the issue.

Notes

The provided workaround may not be reliable and should be replaced with a more robust solution. The issue seems to be specific to the OpenClaw version 2026.5.3-1 and the Discord integration.

Recommendation

Apply a workaround by modifying the selection-DL4MPaGt.js file to correctly handle distinct message attachments, as updating to a fixed version is not mentioned in the issue.

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 - 💡(How to fix) Fix Discord voice message media reference stale after first voice message [1 comments, 2 participants]