diff --git a/src/services/worker/SDKAgent.ts b/src/services/worker/SDKAgent.ts index b4fcb3c4..92219769 100644 --- a/src/services/worker/SDKAgent.ts +++ b/src/services/worker/SDKAgent.ts @@ -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,