Screen fails to release pty

Solution 1:

Suggestion: In this situation I'd go with a Reverse SSH connection:

Instead of your machine doing an ssh, the server machine does an ssh and through port forwarding makes sure that you can ssh back to server machine.

But it's certainly not as fun as building it yourself with socat. I'd still recommend getting to the bottom of this pty issue, it's a good way to learn.