Skip to content

fix: suppress agent error posts on public broadcast channels (Mastodon)#536

Open
Fail-Safe wants to merge 1 commit intoRightNow-AI:mainfrom
Fail-Safe:fix/mastodon-error-posts
Open

fix: suppress agent error posts on public broadcast channels (Mastodon)#536
Fail-Safe wants to merge 1 commit intoRightNow-AI:mainfrom
Fail-Safe:fix/mastodon-error-posts

Conversation

@Fail-Safe
Copy link

Summary

  • Adds suppress_error_responses() -> bool to the ChannelAdapter trait (default false)
  • MastodonAdapter overrides to true — agent errors are logged internally but not posted as statuses
  • Both dispatch_text_message and dispatch_multimodal_message error branches respect this flag

Problem

When an agent hit a resource quota (e.g. token limit exceeded), the error was passed to send_response() which on Mastodon means calling api_post_status(). This caused hundreds of "Agent error: Resource quota exceeded: Token limit exceeded" posts to be published to a user's Mastodon account in a burst, all within the same second.

Errors are still logged via warn!() and recorded in delivery history — they're just no longer broadcast as public/unlisted statuses.

Why this approach

Adding a trait method keeps the fix localized to adapters that opt in. All existing adapters (Telegram, Slack, Discord, etc.) are unaffected. Any future public broadcast adapters (e.g. Bluesky) can override suppress_error_responses() to true the same way.

Test plan

  • Verify cargo build -p openfang-channels passes cleanly
  • Trigger an agent token-limit error with Mastodon channel enabled — confirm no status is posted
  • Confirm the error is still present in delivery history / logs
  • Verify Telegram/Slack/Discord still receive error responses as before

🤖 Generated with Claude Code

When an agent hit a resource limit (e.g. token quota), the error was
formatted and sent back via send_response() — which on Mastodon means
posting a public/unlisted status. This caused hundreds of "Agent error:
Resource quota exceeded" posts to be published in a burst.

Add a suppress_error_responses() method to ChannelAdapter (default false).
Mastodon overrides it to true. Both error branches in dispatch_text_message
and dispatch_multimodal_message now gate the send_response() call on this
flag. Errors are still logged and recorded in delivery history.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Fail-Safe Fail-Safe force-pushed the fix/mastodon-error-posts branch from a59e099 to eeb5c7b Compare March 11, 2026 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant