From 93f80894a33a2ee87a6121f03d5fb6ee4bece707 Mon Sep 17 00:00:00 2001 From: humanwritten Date: Mon, 19 Jan 2026 22:48:16 +0000 Subject: [PATCH] fix: prevent context-window-too-small error from being misclassified MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/auto-reply/reply/agent-runner-execution.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/auto-reply/reply/agent-runner-execution.ts b/src/auto-reply/reply/agent-runner-execution.ts index 277199de8..9bfbd4aa1 100644 --- a/src/auto-reply/reply/agent-runner-execution.ts +++ b/src/auto-reply/reply/agent-runner-execution.ts @@ -421,7 +421,8 @@ export async function runAgentTurnWithFallback(params: { const message = err instanceof Error ? err.message : String(err); const isContextOverflow = 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 isSessionCorruption = /function call turn comes immediately after/i.test(message); const isRoleOrderingError = /incorrect role information|roles must alternate/i.test(message);