fix: terminate session on prompt-too-long instead of retrying indefinitely

This commit is contained in:
jayvenn21
2026-02-04 11:12:17 -05:00
committed by Alex Newman
parent 9c68a3ba3d
commit 93bad99d79
+5
View File
@@ -210,6 +210,11 @@ export class SDKAgent {
}, truncatedResponse);
}
// Detect fatal context overflow and terminate gracefully (issue #870)
if (typeof textContent === 'string' && textContent.includes('Prompt is too long')) {
throw new Error('Claude session context overflow: prompt is too long');
}
// Parse and process response using shared ResponseProcessor
await processAgentResponse(
textContent,