More robustness work for buildShellScriptAcrossDisconnect: bound how long checking can take.
Proper fix is in FileMonitoringTask according to @kohsuke.