File tree Expand file tree Collapse file tree
apps/sim/lib/copilot/client-sse Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -333,10 +333,11 @@ async function reportCompletion(
333333 } )
334334 // Next.js silently truncates request bodies beyond its body size limit (default 10MB),
335335 // corrupting the JSON and causing a server-side parse error (500). When the request fails
336- // and the payload is large, retry without the data to unblock the server-side waiter .
336+ // and the payload is large, retry without logs ( the largest field) to fit under the limit .
337337 const LARGE_PAYLOAD_THRESHOLD = 1024 * 1024
338338 if ( ! res . ok && data && new Blob ( [ body ] ) . size > LARGE_PAYLOAD_THRESHOLD ) {
339- logger . warn ( '[RunTool] reportCompletion failed with large payload, retrying without data' , {
339+ const { logs : _logs , ...dataWithoutLogs } = data
340+ logger . warn ( '[RunTool] reportCompletion failed with large payload, retrying without logs' , {
340341 toolCallId,
341342 status : res . status ,
342343 bodySize : new Blob ( [ body ] ) . size ,
@@ -346,8 +347,9 @@ async function reportCompletion(
346347 headers : { 'Content-Type' : 'application/json' } ,
347348 body : JSON . stringify ( {
348349 toolCallId,
349- status : 'error' ,
350- message : 'Workflow execution failed: result payload too large' ,
350+ status,
351+ message : message || ( status === 'success' ? 'Tool completed' : 'Tool failed' ) ,
352+ data : dataWithoutLogs ,
351353 } ) ,
352354 } )
353355 if ( ! retryRes . ok ) {
You can’t perform that action at this time.
0 commit comments