fix: recover from 413 Request Entity Too Large via auto-compaction (#14707)

Co-authored-by: Noam Bressler <noamzbr@gmail.com>
This commit is contained in:
bentrd
2026-03-02 08:40:55 +01:00
committed by GitHub
parent 7bfbb1fcf8
commit be20f865ac
5 changed files with 152 additions and 58 deletions

View File

@@ -19,6 +19,7 @@ export namespace ProviderError {
/context window exceeds limit/i, // MiniMax
/exceeded model token limit/i, // Kimi For Coding, Moonshot
/context[_ ]length[_ ]exceeded/i, // Generic fallback
/request entity too large/i, // HTTP 413
]
function isOpenAiErrorRetryable(e: APICallError) {
@@ -177,7 +178,7 @@ export namespace ProviderError {
export function parseAPICallError(input: { providerID: string; error: APICallError }): ParsedAPICallError {
const m = message(input.providerID, input.error)
if (isOverflow(m)) {
if (isOverflow(m) || input.error.statusCode === 413) {
return {
type: "context_overflow",
message: m,