In the old test format we set the test execution environment to the current process environment (see https://github.com/llvm/llvm-project/blob/9e1455dc236252a60066c312c6d2e8a7ed66f609/libcxx/utils/libcxx/test/format.py#L179) for .sh.cpp tests.
In the new test format, where all tests are essentially ShTests, we should do the same. Otherwise executing tests over SSH may not work, at least on Windows hosts. For example, for me all SSH commands ended up exiting with code 255 without any error messages. After this change they succeed.
Yup, so I've been having to add the same workaround locally in some cases for ssh-agent environment variables to be picked up. However, I'm not certain this is the right place to set that, I think it should be in config.py instead.