Repository navigation
fix(auto-reply): match throttling transient errors in fallback-state regex - #112702
Merged
Merged
Conversation
…regex `TRANSIENT_ERROR_DETAIL_HINT_RE` used `throttl\b` which never matches real throttling error messages (throttle, throttled, throttling) because `\b` requires a non-word character after `l`, but `l` is always followed by a word character in all English inflections. Fix: `throttl\b` → `throttl\w*` to match all throttling variants. Add regression tests using real AWS Bedrock ThrottlingException fixtures.
Contributor
Author
|
@clawsweeper re-review |
Contributor
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Member
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Jul 26, 2026
…regex (openclaw#112702) `TRANSIENT_ERROR_DETAIL_HINT_RE` used `throttl\b` which never matches real throttling error messages (throttle, throttled, throttling) because `\b` requires a non-word character after `l`, but `l` is always followed by a word character in all English inflections. Fix: `throttl\b` → `throttl\w*` to match all throttling variants. Add regression tests using real AWS Bedrock ThrottlingException fixtures.
chovizzz
added a commit
to chovizzz/openclaw
that referenced
this pull request
Sep 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Fixes an issue where error messages containing "throttle", "throttled", "throttling", or "ThrottlingException" are silently collapsed to the generic label "rate limit" in model fallback notices, losing diagnostic detail.
When a provider returns a throttling error (e.g., AWS Bedrock
ThrottlingException: Too many concurrent requests), the upstream classifier correctly classifies it asreason = "rate_limit", but the fallback-state safety gate regex fails to detect the throttling signal. The error detail is hidden and the user sees only the generic "rate limit" reason.Why This Change Was Made
TRANSIENT_ERROR_DETAIL_HINT_REinsrc/auto-reply/fallback-state.tsuses a\b(?:...)\bpattern to whitelist transient-looking error texts for detail exposure. One alternative,throttl\b, was intended to match all throttling variants (throttle, throttled, throttling, ThrottlingException) as a prefix, but the trailing\bword boundary breaks the match: in every real English inflection,lis followed by a word character (e,i,e), so\bnever holds. The branch is dead code.The fix changes
throttl\btothrottl\w*, matching all word continuations of the "throttl" prefix. This follows the same prefix + optional suffix pattern already established in the same regex (seconds?,minutes?,hours?) and in a parallel safety gate elsewhere in the codebase (rate[-\s]?limit(?:ed|ing)?inmanager.backend-failover.ts).No changes to upstream classification, failover routing, or persisted session schema. The fix only affects the display path: matching errors now show their text instead of being collapsed to the generic reason label.
User Impact
Users of providers that return throttling errors without additional transient keywords (e.g., "ThrottlingException: Too many concurrent requests" from AWS Bedrock) now see the specific error text in fallback notices instead of the generic "rate limit" label.
Evidence
Before fix (bug reproduction)
Unit tests — 2 newly added tests fail as expected:
Real-behavior proof (MJS harness invoking real production code) — full chain via
classifyProviderSpecificError→resolveFallbackTransition→TRANSIENT_ERROR_DETAIL_HINT_RE+formatRawAssistantErrorForUi:The MJS harness (
proof-fallback-throttle.mjs, 5 files mirroring the established proof architecture inscripts/proof-retry-session.mjs) runs real production code paths:classifyProviderSpecificErrorfromsrc/agents/embedded-agent-helpers/provider-error-patterns.tsresolveFallbackTransitionfromsrc/auto-reply/fallback-state.tsformatRawAssistantErrorForUifromsrc/shared/assistant-error-format.tsareRuntimeModelRefsEquivalent(used only forfallbackActive, notreasonSummary).After fix (verification)
Unit tests — 19/19 pass, including 3 new tests (2 positive, 1 negative):
Real-behavior proof (exact terminal output):
Checks:
oxfmtformat check: ✅ All matched files use the correct formatoxlint(212 rules): ✅ 0 warnings, 0 errorstsgo:coretypecheck: ✅ EXIT 0tsgo:core:testtypecheck: ✅ EXIT 0tsgo:extensions:testtypecheck: ✅ EXIT 0tsgo:test:roottypecheck: ✅ EXIT 0Fixture provenance
The test error messages are real AWS Bedrock
ThrottlingExceptionfixtures from the codebase's own test suite:src/agents/failover-error.test.ts:54— "ThrottlingException: Your request was denied due to exceeding the account quotas for Amazon Bedrock." (from AWS troubleshooting docs)src/agents/failover-error.test.ts:688— "ThrottlingException: Too many concurrent requests"Messages of this form are produced by the Bedrock runtime at
extensions/amazon-bedrock/stream.runtime.ts:322-323and flow throughmodel-fallback.ts→RuntimeFallbackAttempt→formatFallbackAttemptErrorPreviewin production.This PR is AI-assisted. Analysis, implementation, and testing were performed using AI tools (opencode) with review by the author.