fix(agents): exclude rate limit errors from context overflow classification (#13747)

Co-authored-by: 0xRaini <rain@0xRaini.dev>
This commit is contained in:
0xRain
2026-02-12 07:40:09 +08:00
committed by GitHub
parent 2f1f82674a
commit 729181bd06
2 changed files with 19 additions and 9 deletions

View File

@@ -40,6 +40,12 @@ export function isLikelyContextOverflowError(errorMessage?: string): boolean {
if (CONTEXT_WINDOW_TOO_SMALL_RE.test(errorMessage)) {
return false;
}
// Rate limit errors can match the broad CONTEXT_OVERFLOW_HINT_RE pattern
// (e.g., "request reached organization TPD rate limit" matches request.*limit).
// Exclude them before checking context overflow heuristics.
if (isRateLimitErrorMessage(errorMessage)) {
return false;
}
if (isContextOverflowError(errorMessage)) {
return true;
}