WP-CLI alias: connect with ssh proxy

I created simillar configuration to yours and proxy is working for me. My config looks like:

Host production
  HostName xxx.xxx.xxx.xxx
  ProxyCommand ssh -q -W %h:22 vagrant
  ForwardAgent yes

Host vagrant
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /path/to/.vagrant/machines/default/virtualbox/private_key
  IdentitiesOnly yes
  ForwardAgent yes
  LogLevel FATAL

I’m treating my vagrant local machine as proxy and I want to execute command on production server.

My wp-cli.yml file looks like:

@local:
  ssh: vagrant/var/www/test

@prod:
  ssh: production/var/www/test

I’m executing wp command and in return I get data from my production server.

wp @prod config get

I know that proxy is working because if I remove Host vagrant section from ~/.ssh/config file I can’t execute any command and in return I get an error.

You can try install wp-cli localy using composer

composer require wp-cli/wp-cli

echo escaped command variable and execute command like that:

./vendor/bin/wp @prod config get

This variable should contain your full ssh command. Maybe this will give you a hint what is going on.