Skip to content

fix(discord): bound standalone response reads - #55209

Closed
ooiuuii wants to merge 1 commit into
NousResearch:mainfrom
ooiuuii:fix/discord-standalone-body-cap
Closed

fix(discord): bound standalone response reads#55209
ooiuuii wants to merge 1 commit into
NousResearch:mainfrom
ooiuuii:fix/discord-standalone-body-cap

Conversation

@ooiuuii

@ooiuuii ooiuuii commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add bounded readers for the Discord standalone REST sender
  • cap Discord success JSON reads at 1 MiB and error-body snippets at 8 KiB
  • route channel probe, forum/thread creation, message send, and media upload response parsing through the bounded helpers
  • add streaming-response regression coverage that fails if the code falls back to unbounded resp.json() / resp.text() on real streamed responses

Fixes #55208

Validation

  • python -m pytest tests\tools\test_send_message_tool.py::TestSendDiscordThreadId -q --basetemp .tmp-pytest-discord-thread — 6 passed
  • python -m pytest tests\tools\test_send_message_tool.py::TestSendDiscordThreadId tests\tools\test_send_message_tool.py::TestSendDiscordMedia -q --basetemp .tmp-pytest-discord-send — 12 passed
  • python -m pytest tests\tools\test_send_message_tool.py -q --basetemp .tmp-pytest-send-message-tool — 151 passed
  • python -m ruff check plugins\platforms\discord\adapter.py tests\tools\test_send_message_tool.py — passed
  • git diff --check — passed

Notes

This was found while checking recent OpenClaw response-body cap fixes for analogous Hermes surfaces. Hermes does not have the exact OpenClaw PluralKit / Discord voice upload URL code path; the matching Hermes boundary is the standalone Discord REST sender used when no live gateway adapter is available.

AI-assisted: implementation, tests, and validation summary were prepared with Codex.

@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 labels Jun 29, 2026

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Clean 2-file fix bounding Discord standalone response reads to prevent OOM. Consistent with the 8KB limit pattern applied across Slack, WhatsApp, Google Chat, LINE, and Teams adapters.

@teknium1

teknium1 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Merged via #60122 - your commit was cherry-picked onto current main with your authorship preserved (e0bca1c), plus a small follow-up that replaces the unittest.mock module-name check with a structural coroutine probe. Thanks!

@teknium1 teknium1 closed this Jul 7, 2026
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 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.

Discord standalone send reads unbounded API response bodies

4 participants