fix: prevent context-window-too-small error from being misclassified
The regex `/context window/i` was matching "Model context window too small" and rewriting it to generic "Context overflow" message, hiding the actual problem from users. Add exclusion for "too small|minimum is" patterns so the original informative error message passes through. 🤖 AI-assisted (Claude) - tested on local instance Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
committed by
Peter Steinberger
parent
c440cc2f84
commit
93f80894a3
@@ -421,7 +421,8 @@ export async function runAgentTurnWithFallback(params: {
|
|||||||
const message = err instanceof Error ? err.message : String(err);
|
const message = err instanceof Error ? err.message : String(err);
|
||||||
const isContextOverflow =
|
const isContextOverflow =
|
||||||
isContextOverflowError(message) ||
|
isContextOverflowError(message) ||
|
||||||
/context.*overflow|too large|context window/i.test(message);
|
(/context.*overflow|too large|context window/i.test(message) &&
|
||||||
|
!/too small|minimum is/i.test(message));
|
||||||
const isCompactionFailure = isCompactionFailureError(message);
|
const isCompactionFailure = isCompactionFailureError(message);
|
||||||
const isSessionCorruption = /function call turn comes immediately after/i.test(message);
|
const isSessionCorruption = /function call turn comes immediately after/i.test(message);
|
||||||
const isRoleOrderingError = /incorrect role information|roles must alternate/i.test(message);
|
const isRoleOrderingError = /incorrect role information|roles must alternate/i.test(message);
|
||||||
|
|||||||
Reference in New Issue
Block a user