This commit is contained in:
Stephen Brian King 2026-01-29 21:53:31 -05:00 committed by GitHub
commit 5b9285f170
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View File

@ -46,4 +46,12 @@ describe("isContextOverflowError", () => {
expect(isContextOverflowError("model not found")).toBe(false);
expect(isContextOverflowError("authentication failed")).toBe(false);
});
it("ignores normal conversation text mentioning context overflow", () => {
// These are legitimate conversation snippets, not error messages
expect(isContextOverflowError("Let's investigate the context overflow bug")).toBe(false);
expect(isContextOverflowError("The mystery context overflow errors are strange")).toBe(false);
expect(isContextOverflowError("We're debugging context overflow issues")).toBe(false);
expect(isContextOverflowError("Something is causing context overflow messages")).toBe(false);
});
});

View File

@ -20,7 +20,7 @@ export function isContextOverflowError(errorMessage?: string): boolean {
lower.includes("prompt is too long") ||
lower.includes("exceeds model context window") ||
(hasRequestSizeExceeds && hasContextWindow) ||
lower.includes("context overflow") ||
lower.includes("context overflow:") ||
(lower.includes("413") && lower.includes("too large"))
);
}