Except you can always install sensors that can look as far as you want
There are hard limitations on sensing onboard the train. Tracks that bend around hills, etc. I have some exposure to wireless communication for trains, and one of the limitations is that you can often not get a line of site even from one end of the train to another.
Since railroad tracks rarely get up and go walkabout, you can instrument them (conduction, video, lidar/radar) to the limits of your preferences and/or budget. Information can be relayed to both central control and individual trainsets.