openclaw - 💡(How to fix) Fix Anthropic Max usage alert text blocks delivered as assistant messages to channels [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#59662Fetched 2026-04-08 02:41:58
View on GitHub
Comments
1
Participants
2
Timeline
1
Reactions
0
Timeline (top)
commented ×1

Code Example

⚠️ **Claude Max Usage Alert**
Session: 0% | Weekly: 84%
Extra: $0.00/$500.00
RAW_BUFFERClick to expand / collapse

Bug

When using Anthropic Claude Max subscription (OAuth token auth), Anthropic injects usage alert text blocks into the API response stream:

⚠️ **Claude Max Usage Alert**
Session: 0% | Weekly: 84%
Extra: $0.00/$500.00

These arrive as standalone assistant content blocks (type: text) in the streamed response. OpenClaw stores them in the session JSONL as real assistant messages and delivers them to channels (Discord, etc.) as actual bot messages.

Expected behavior

OpenClaw should detect and strip these Anthropic Max usage/billing alert blocks before:

  1. Storing them in the session transcript
  2. Delivering them to channel surfaces

These are provider billing metadata, not agent output.

Evidence

  • 34 occurrences in a single session JSONL (13 standalone, 18 embedded in real responses)
  • Confirmed delivered to Discord as bot messages
  • Only affects anthropic:antoauthtoken (Max subscription OAuth) profiles
  • Pattern is consistent: starts with ⚠️ **Claude Max Usage Alert** followed by Session/Weekly/Extra lines

Suggested fix

Strip text content blocks matching /⚠️ \*\*Claude Max Usage Alert\*\*[\s\S]*?Extra: \$[\d.]+\/\$[\d.]+/ from the response pipeline before delivery, or add a configurable messages.outputStripPatterns array.

Environment

  • OpenClaw 2026.4.1 (da64a97)
  • Auth profile: anthropic:antoauthtoken (Claude Max subscription)
  • Channel: Discord
  • Model: anthropic/claude-opus-4-6

extent analysis

TL;DR

Strip text content blocks matching the Anthropic Max usage alert pattern from the response pipeline before delivery to prevent unwanted billing metadata from being stored and sent as bot messages.

Guidance

  • Identify the response pipeline where the usage alert blocks are being injected and modify it to filter out messages matching the pattern /⚠️ \*\*Claude Max Usage Alert\*\*[\s\S]*?Extra: \$[\d.]+\/\$[\d.]+/.
  • Consider adding a configurable messages.outputStripPatterns array to allow for easy modification of the filter patterns in the future.
  • Verify that the filtering is working correctly by checking the session JSONL and channel outputs for the absence of usage alert blocks.
  • Test the fix with different types of responses and edge cases to ensure it does not inadvertently filter out legitimate messages.

Example

const filterPattern = /⚠️ \*\*Claude Max Usage Alert\*\*[\s\S]*?Extra: \$[\d.]+\/\$[\d.]+/;
const filteredMessages = messages.filter(message => !filterPattern.test(message.content));

Notes

This fix assumes that the usage alert blocks always follow the specified pattern and that filtering them out will not affect the functionality of the bot. If the pattern changes or if there are other types of messages that need to be filtered, the messages.outputStripPatterns array can be modified accordingly.

Recommendation

Apply workaround by filtering out the usage alert blocks using the specified pattern, as this is a targeted solution that addresses the specific issue without requiring an upgrade or modification of the underlying system.

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…

FAQ

Expected behavior

OpenClaw should detect and strip these Anthropic Max usage/billing alert blocks before:

  1. Storing them in the session transcript
  2. Delivering them to channel surfaces

These are provider billing metadata, not agent output.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING