@@ -374,6 +374,17 @@ public EventKind onMessageSend(MessageSendParams params, ServerCallContext conte
374374
375375 boolean blocking = params .configuration () != null && Boolean .TRUE .equals (params .configuration ().blocking ());
376376
377+ // Log blocking behavior from client request
378+ if (params .configuration () != null && params .configuration ().blocking () != null ) {
379+ LOGGER .info ("DefaultRequestHandler: Client requested blocking={} for task {}" ,
380+ params .configuration ().blocking (), taskId );
381+ } else if (params .configuration () != null ) {
382+ LOGGER .info ("DefaultRequestHandler: Client sent configuration but blocking=null, using default blocking=true for task {}" , taskId );
383+ } else {
384+ LOGGER .info ("DefaultRequestHandler: Client sent no configuration, using default blocking=true for task {}" , taskId );
385+ }
386+ LOGGER .info ("DefaultRequestHandler: Final blocking decision: {} for task {}" , blocking , taskId );
387+
377388 boolean interruptedOrNonBlocking = false ;
378389
379390 EnhancedRunnable producerRunnable = registerAndExecuteAgentAsync (taskId , mss .requestContext , queue );
@@ -395,7 +406,8 @@ public EventKind onMessageSend(MessageSendParams params, ServerCallContext conte
395406 throw new InternalError ("No result" );
396407 }
397408 interruptedOrNonBlocking = etai .interrupted ();
398- LOGGER .debug ("Was interrupted or non-blocking: {}" , interruptedOrNonBlocking );
409+ LOGGER .info ("DefaultRequestHandler: interruptedOrNonBlocking={} (blocking={}, eventType={})" ,
410+ interruptedOrNonBlocking , blocking , kind != null ? kind .getClass ().getSimpleName () : null );
399411
400412 // For blocking calls that were interrupted (returned on first event),
401413 // wait for agent execution and event processing BEFORE returning to client.
@@ -419,29 +431,31 @@ public EventKind onMessageSend(MessageSendParams params, ServerCallContext conte
419431 // 2. Close the queue to signal consumption can complete
420432 // 3. Wait for consumption to finish processing events
421433 // 4. Fetch final task state from TaskStore
434+ LOGGER .debug ("DefaultRequestHandler: Entering blocking fire-and-forget handling for task {}" , taskId );
422435
423436 try {
424437 // Step 1: Wait for agent to finish (with configurable timeout)
425438 if (agentFuture != null ) {
426439 try {
427440 agentFuture .get (agentCompletionTimeoutSeconds , SECONDS );
428- LOGGER .debug ("Agent completed for task {}" , taskId );
441+ LOGGER .debug ("DefaultRequestHandler: Step 1 - Agent completed for task {}" , taskId );
429442 } catch (java .util .concurrent .TimeoutException e ) {
430443 // Agent still running after timeout - that's fine, events already being processed
431- LOGGER .debug ("Agent still running for task {} after {}s" , taskId , agentCompletionTimeoutSeconds );
444+ LOGGER .debug ("DefaultRequestHandler: Step 1 - Agent still running for task {} after {}s timeout" ,
445+ taskId , agentCompletionTimeoutSeconds );
432446 }
433447 }
434448
435449 // Step 2: Close the queue to signal consumption can complete
436450 // For fire-and-forget tasks, there's no final event, so we need to close the queue
437451 // This allows EventConsumer.consumeAll() to exit
438452 queue .close (false , false ); // graceful close, don't notify parent yet
439- LOGGER .debug ("Closed queue for task {} to allow consumption completion" , taskId );
453+ LOGGER .debug ("DefaultRequestHandler: Step 2 - Closed queue for task {} to allow consumption completion" , taskId );
440454
441455 // Step 3: Wait for consumption to complete (now that queue is closed)
442456 if (etai .consumptionFuture () != null ) {
443457 etai .consumptionFuture ().get (consumptionCompletionTimeoutSeconds , SECONDS );
444- LOGGER .debug ("Consumption completed for task {}" , taskId );
458+ LOGGER .debug ("DefaultRequestHandler: Step 3 - Consumption completed for task {}" , taskId );
445459 }
446460 } catch (InterruptedException e ) {
447461 Thread .currentThread ().interrupt ();
@@ -464,11 +478,11 @@ public EventKind onMessageSend(MessageSendParams params, ServerCallContext conte
464478 Task updatedTask = taskStore .get (nonNullTaskId );
465479 if (updatedTask != null ) {
466480 kind = updatedTask ;
467- if ( LOGGER .isDebugEnabled ()) {
468- LOGGER . debug ( "Fetched final task for {} with state {} and {} artifacts" ,
469- nonNullTaskId , updatedTask .status ().state (),
470- updatedTask . artifacts (). size ());
471- }
481+ LOGGER .debug ( "DefaultRequestHandler: Step 4 - Fetched final task for {} with state {} and {} artifacts" ,
482+ taskId , updatedTask . status (). state () ,
483+ updatedTask .artifacts ().size ());
484+ } else {
485+ LOGGER . warn ( "DefaultRequestHandler: Step 4 - Task {} not found in TaskStore!" , taskId );
472486 }
473487 }
474488 if (kind instanceof Task taskResult && !taskId .equals (taskResult .id ())) {
0 commit comments