@@ -472,7 +472,8 @@ public EventKind onMessageSend(MessageSendParams params, ServerCallContext conte
472472
473473 // Store push notification config for newly created tasks (mirrors streaming logic)
474474 // Only for NEW tasks - existing tasks are handled by initMessageSend()
475- if (mss .task () == null && kind instanceof Task createdTask && shouldAddPushInfo (params )) {
475+ if (mss .task () == null && kind instanceof Task createdTask && pushConfigStore != null
476+ && params .configuration () != null && params .configuration ().pushNotificationConfig () != null ) {
476477 LOGGER .debug ("Storing push notification config for new task {} (original taskId from params: {})" ,
477478 createdTask .id (), params .message ().taskId ());
478479 pushConfigStore .setInfo (createdTask .id (), params .configuration ().pushNotificationConfig ());
@@ -550,7 +551,7 @@ public EventKind onMessageSend(MessageSendParams params, ServerCallContext conte
550551 kind = updatedTask ;
551552 LOGGER .debug ("DefaultRequestHandler: Step 5 - Fetched current task for {} with state {} and {} artifacts" ,
552553 taskId .get (), updatedTask .status ().state (),
553- updatedTask .artifacts (). size ());
554+ updatedTask .artifacts () != null ? updatedTask . artifacts (). size () : 0 );
554555 } else {
555556 LOGGER .warn ("DefaultRequestHandler: Step 5 - Task {} not found in TaskStore!" , taskId .get ());
556557 }
@@ -611,7 +612,7 @@ public Flow.Publisher<StreamingEventKind> onMessageSendStream(
611612 // Store push notification config SYNCHRONOUSLY for new tasks before agent starts
612613 // This ensures config is available when MainEventBusProcessor sends push notifications
613614 // For existing tasks, config is stored in initMessageSend()
614- if (mss .task () == null && shouldAddPushInfo ( params ) ) {
615+ if (mss .task () == null && pushConfigStore != null && params . configuration () != null && params . configuration (). pushNotificationConfig () != null ) {
615616 // Satisfy Nullaway
616617 Objects .requireNonNull (taskId .get (), "taskId was null" );
617618 LOGGER .debug ("Storing push notification config for new streaming task {} EARLY (original taskId from params: {})" ,
@@ -849,10 +850,6 @@ public void onDeleteTaskPushNotificationConfig(
849850 pushConfigStore .deleteInfo (params .id (), params .pushNotificationConfigId ());
850851 }
851852
852- private boolean shouldAddPushInfo (MessageSendParams params ) {
853- return pushConfigStore != null && params .configuration () != null && params .configuration ().pushNotificationConfig () != null ;
854- }
855-
856853 /**
857854 * Register and execute the agent asynchronously in the agent-executor thread pool.
858855 *
@@ -973,7 +970,7 @@ private MessageSendSetup initMessageSend(MessageSendParams params, ServerCallCon
973970 LOGGER .debug ("Found task updating with message {}" , params .message ());
974971 task = taskManager .updateWithMessage (params .message (), task );
975972
976- if (shouldAddPushInfo ( params ) ) {
973+ if (pushConfigStore != null && params . configuration () != null && params . configuration (). pushNotificationConfig () != null ) {
977974 LOGGER .debug ("Adding push info" );
978975 pushConfigStore .setInfo (task .id (), params .configuration ().pushNotificationConfig ());
979976 }
0 commit comments