https://issues.jenkins-ci.org/browse/JENKINS-36420 and https://issues.jenkins-ci.org/browse/JENKINS-55978 were implemented and they are honoured if you use the OS provided ssh client (Mac OS X at least).
However if you execute the same command through the Jenkins CLI command with the -ssh option, the timeout is ignored.
- Run Jenkins with the property -Dorg.jenkinsci.main.modules.sshd.SSHD.idle-timeout=0
- Create a pipeline with a sleep higher than 10 minutes:
- Build the job remotely through CLI