Summary
When the Claude API emits a rate_limit_event with status: \"allowed\" (i.e., an informational event — the request was not blocked), dotbot incorrectly displays a ⚠ RATE LIMIT warning and records a rate limit hit. This is a false positive that causes unnecessary alarm and may affect agent flow decisions.
Observed Behavior
Raw API event received (informational — request was allowed):
{\"type\":\"rate_limit_event\",\"rate_limit_info\":{\"status\":\"allowed\",\"resetsAt\":1779296400,\"rateLimitType\":\"five_hour\",\"overageStatus\":\"allowed\",\"overageResetsAt\":1780272000,\"isUsingOverage\":false}}
Warning incorrectly displayed:
⚠ RATE LIMIT: Rate limit hit (no reset time provided)
Note: status: "allowed" and overageStatus: "allowed" — the API explicitly confirmed the request was permitted.
Root Cause
Two files share the same bug:
1. .bot/core/runtime/ClaudeCLI/ClaudeCLI.psm1 — lines 700–733
if ($line[0] -eq '{' -and $line -match "hit your.*?limit|out of extra usage|error.*?rate_limit") {
The regex error.*?rate_limit matches any JSON line containing rate_limit anywhere in the string — including "type":"rate_limit_event". After matching, the code attempts to extract a message but finds none of the expected fields (result, message.content), then falls through to:
} elseif ($jsonObj.error -eq "rate_limit") {
$rateLimitText = "Rate limit hit (no reset time provided)" # fires incorrectly
}
The rate_limit_info.status field is never checked.
2. .bot/core/runtime/ProviderCLI/parsers/Parse-ClaudeStream.ps1 — lines 31–56
Identical pattern and identical gap — no check for status: "allowed".
Proposed Fix
After parsing $jsonObj, add an early return before any message extraction in both files:
# Skip informational rate_limit_event when status is "allowed" — not an actual block
if ($jsonObj.type -eq "rate_limit_event" -and $jsonObj.rate_limit_info.status -eq "allowed") {
return
}
This should be inserted immediately after the ConvertFrom-Json call, before attempting to extract a $rateLimitText.
Files to Fix
| File |
Lines |
.bot/core/runtime/ClaudeCLI/ClaudeCLI.psm1 |
~703 (after ConvertFrom-Json) |
.bot/core/runtime/ProviderCLI/parsers/Parse-ClaudeStream.ps1 |
~34 (after ConvertFrom-Json) |
Environment
- dotbot workspace:
dotbot-flow/27
- Provider: Claude (
claude-opus-4-7)
- Rate limit type in event:
five_hour
- Platform: Windows 11, PowerShell 7+
Summary
When the Claude API emits a
rate_limit_eventwithstatus: \"allowed\"(i.e., an informational event — the request was not blocked), dotbot incorrectly displays a⚠ RATE LIMITwarning and records a rate limit hit. This is a false positive that causes unnecessary alarm and may affect agent flow decisions.Observed Behavior
Raw API event received (informational — request was allowed):
{\"type\":\"rate_limit_event\",\"rate_limit_info\":{\"status\":\"allowed\",\"resetsAt\":1779296400,\"rateLimitType\":\"five_hour\",\"overageStatus\":\"allowed\",\"overageResetsAt\":1780272000,\"isUsingOverage\":false}}Warning incorrectly displayed:
Note:
status: "allowed"andoverageStatus: "allowed"— the API explicitly confirmed the request was permitted.Root Cause
Two files share the same bug:
1.
.bot/core/runtime/ClaudeCLI/ClaudeCLI.psm1— lines 700–733The regex
error.*?rate_limitmatches any JSON line containingrate_limitanywhere in the string — including"type":"rate_limit_event". After matching, the code attempts to extract a message but finds none of the expected fields (result,message.content), then falls through to:The
rate_limit_info.statusfield is never checked.2.
.bot/core/runtime/ProviderCLI/parsers/Parse-ClaudeStream.ps1— lines 31–56Identical pattern and identical gap — no check for
status: "allowed".Proposed Fix
After parsing
$jsonObj, add an early return before any message extraction in both files:This should be inserted immediately after the
ConvertFrom-Jsoncall, before attempting to extract a$rateLimitText.Files to Fix
.bot/core/runtime/ClaudeCLI/ClaudeCLI.psm1ConvertFrom-Json).bot/core/runtime/ProviderCLI/parsers/Parse-ClaudeStream.ps1ConvertFrom-Json)Environment
dotbot-flow/27claude-opus-4-7)five_hour