JENKINS-48574 is a related issue, they may be even duplicates depending on the implementation
I think it is not about whether the agent is “headless”, it is whether it is inbound (JNLPLauncher) or not (SSH and many others). So I think the bug is in SlaveInstallerModule.