@@ -393,6 +393,17 @@ public EventKind onMessageSend(MessageSendParams params, ServerCallContext conte
393393
394394 boolean blocking = params .configuration () != null && Boolean .TRUE .equals (params .configuration ().blocking ());
395395
396+ // Log blocking behavior from client request
397+ if (params .configuration () != null && params .configuration ().blocking () != null ) {
398+ LOGGER .info ("DefaultRequestHandler: Client requested blocking={} for task {}" ,
399+ params .configuration ().blocking (), taskId );
400+ } else if (params .configuration () != null ) {
401+ LOGGER .info ("DefaultRequestHandler: Client sent configuration but blocking=null, using default blocking=true for task {}" , taskId );
402+ } else {
403+ LOGGER .info ("DefaultRequestHandler: Client sent no configuration, using default blocking=true for task {}" , taskId );
404+ }
405+ LOGGER .info ("DefaultRequestHandler: Final blocking decision: {} for task {}" , blocking , taskId );
406+
396407 boolean interruptedOrNonBlocking = false ;
397408
398409 EnhancedRunnable producerRunnable = registerAndExecuteAgentAsync (taskId , mss .requestContext , queue );
@@ -414,7 +425,8 @@ public EventKind onMessageSend(MessageSendParams params, ServerCallContext conte
414425 throw new InternalError ("No result" );
415426 }
416427 interruptedOrNonBlocking = etai .interrupted ();
417- LOGGER .debug ("Was interrupted or non-blocking: {}" , interruptedOrNonBlocking );
428+ LOGGER .info ("DefaultRequestHandler: interruptedOrNonBlocking={} (blocking={}, eventType={})" ,
429+ interruptedOrNonBlocking , blocking , kind != null ? kind .getClass ().getSimpleName () : null );
418430
419431 // For blocking calls that were interrupted (returned on first event),
420432 // wait for agent execution and event processing BEFORE returning to client.
@@ -438,29 +450,31 @@ public EventKind onMessageSend(MessageSendParams params, ServerCallContext conte
438450 // 2. Close the queue to signal consumption can complete
439451 // 3. Wait for consumption to finish processing events
440452 // 4. Fetch final task state from TaskStore
453+ LOGGER .debug ("DefaultRequestHandler: Entering blocking fire-and-forget handling for task {}" , taskId );
441454
442455 try {
443456 // Step 1: Wait for agent to finish (with configurable timeout)
444457 if (agentFuture != null ) {
445458 try {
446459 agentFuture .get (agentCompletionTimeoutSeconds , SECONDS );
447- LOGGER .debug ("Agent completed for task {}" , taskId );
460+ LOGGER .debug ("DefaultRequestHandler: Step 1 - Agent completed for task {}" , taskId );
448461 } catch (java .util .concurrent .TimeoutException e ) {
449462 // Agent still running after timeout - that's fine, events already being processed
450- LOGGER .debug ("Agent still running for task {} after {}s" , taskId , agentCompletionTimeoutSeconds );
463+ LOGGER .debug ("DefaultRequestHandler: Step 1 - Agent still running for task {} after {}s timeout" ,
464+ taskId , agentCompletionTimeoutSeconds );
451465 }
452466 }
453467
454468 // Step 2: Close the queue to signal consumption can complete
455469 // For fire-and-forget tasks, there's no final event, so we need to close the queue
456470 // This allows EventConsumer.consumeAll() to exit
457471 queue .close (false , false ); // graceful close, don't notify parent yet
458- LOGGER .debug ("Closed queue for task {} to allow consumption completion" , taskId );
472+ LOGGER .debug ("DefaultRequestHandler: Step 2 - Closed queue for task {} to allow consumption completion" , taskId );
459473
460474 // Step 3: Wait for consumption to complete (now that queue is closed)
461475 if (etai .consumptionFuture () != null ) {
462476 etai .consumptionFuture ().get (consumptionCompletionTimeoutSeconds , SECONDS );
463- LOGGER .debug ("Consumption completed for task {}" , taskId );
477+ LOGGER .debug ("DefaultRequestHandler: Step 3 - Consumption completed for task {}" , taskId );
464478 }
465479 } catch (InterruptedException e ) {
466480 Thread .currentThread ().interrupt ();
@@ -483,11 +497,11 @@ public EventKind onMessageSend(MessageSendParams params, ServerCallContext conte
483497 Task updatedTask = taskStore .get (nonNullTaskId );
484498 if (updatedTask != null ) {
485499 kind = updatedTask ;
486- if ( LOGGER .isDebugEnabled ()) {
487- LOGGER . debug ( "Fetched final task for {} with state {} and {} artifacts" ,
488- nonNullTaskId , updatedTask .status ().state (),
489- updatedTask . artifacts (). size ());
490- }
500+ LOGGER .debug ( "DefaultRequestHandler: Step 4 - Fetched final task for {} with state {} and {} artifacts" ,
501+ taskId , updatedTask . status (). state () ,
502+ updatedTask .artifacts ().size ());
503+ } else {
504+ LOGGER . warn ( "DefaultRequestHandler: Step 4 - Task {} not found in TaskStore!" , taskId );
491505 }
492506 }
493507 if (kind instanceof Task taskResult && !taskId .equals (taskResult .id ())) {
0 commit comments