#11170: fix: classify subscription quota limit errors as rate_limit for failover
agents
stale
Cluster:
Quota Management Improvements
## Summary
- ZenMux returns `403 You have reached your subscription quota limit` on quota exhaustion
- This was incorrectly classified as `auth` (matching the `\b403\b` pattern) instead of `rate_limit`, preventing model fallback
- Add `"quota limit"` to `ERROR_PATTERNS.rateLimit` so it matches before the auth patterns
## Test plan
- [x] Added test case for subscription quota limit error classification
- [x] All 3 existing classifyFailoverReason tests pass
- [x] Verified the pattern matches before the `\b403\b` auth pattern due to check order in `classifyFailoverReason`
Closes #11164
Generated with [Claude Code](https://claude.com/claude-code)
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates the Pi embedded helper error classification so provider messages like `403 You have reached your subscription quota limit...` are treated as `rate_limit` (enabling failover) rather than `auth`. It does this by adding the substring `"quota limit"` to the `ERROR_PATTERNS.rateLimit` list in `src/agents/pi-embedded-helpers/errors.ts`, and adds a Vitest case in `src/agents/pi-embedded-helpers.classifyfailoverreason.test.ts` to lock in the new behavior.
The change plugs into existing logic in `classifyFailoverReason()` which checks `rate_limit` patterns before `auth` patterns, so the new text match overrides the generic `\b403\b` auth classification for this specific quota exhaustion message.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk.
- The change is a small, targeted extension of existing error-pattern matching and is covered by a new unit test that exercises the intended precedence over the generic 403 auth pattern. No other behavior changes were introduced in the diff.
- No files require special attention
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#6014: Agents: improve quota exhaustion fallback detection
by erain · 2026-02-01
82.1%
#22359: fix(agents): classify overloaded service errors as timeout
by AIflow-Labs · 2026-02-21
81.5%
#23520: fix: trigger failover on Anthropic insufficient_quota (HTTP 400) (#...
by dissaozw · 2026-02-22
79.6%
#12314: fix: treat HTTP 5xx server errors as failover-worthy
by hsssgdtc · 2026-02-09
79.2%
#21033: fix(failover): classify connection errors as timeout for model fail...
by zerone0x · 2026-02-19
77.7%
#22792: fix(failover): add word boundary to 429 pattern in ERROR_PATTERNS
by miloudbelarebia · 2026-02-21
76.7%
#23502: fix: Anthropic insufficient_quota HTTP 400 does not trigger failove...
by stakeswky · 2026-02-22
76.5%
#15109: fix: distinguish transient API errors from billing errors
by jwchmodx · 2026-02-13
76.2%
#8661: fix: display rate limit errors correctly instead of as context over...
by dbottme · 2026-02-04
75.4%
#21017: fix: treat HTTP 502/503/504 as failover-eligible (timeout reason)
by taw0002 · 2026-02-19
75.3%