From 954c2ad2b5a2c9cedae72b3e0aa6e4efacd2a106 Mon Sep 17 00:00:00 2001 From: Tianyi Cui <53024+tianyicui@users.noreply.github.com> Date: Sun, 19 Jul 2026 13:03:15 +0800 Subject: [PATCH] docs(llm-pi-ai): track overflow classification gap --- packages/llm/llm-pi-ai/src/stream.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/llm/llm-pi-ai/src/stream.ts b/packages/llm/llm-pi-ai/src/stream.ts index c3aae46c44..f7a0d6ee7f 100644 --- a/packages/llm/llm-pi-ai/src/stream.ts +++ b/packages/llm/llm-pi-ai/src/stream.ts @@ -30,6 +30,9 @@ export function mapUsage(usage: PiUsage): TokenUsage { function classifyPiAiError(message: string): string { if (/\b(?:401|403)\b/.test(message)) return 'AUTH' if (/\b429\b|rate.?limit/i.test(message)) return 'RATE_LIMIT' + // TODO: Classify the full message with pi-ai's isContextOverflow() and the + // resolved model's contextWindow so provider-specific and usage-based overflows + // reach automatic compaction. if (isContextWindowExceededError(message)) return CONTEXT_WINDOW_EXCEEDED_CODE if (/\b400\b|invalid.?request/i.test(message)) return 'INVALID_REQUEST' if (/\b5\d\d\b/.test(message)) return 'SERVER'