Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 25, 2026

When running commands against SSH aliases, connection-specific properties (proxyjump, key) were passed to the remote WP-CLI instance via WP_CLI_RUNTIME_ALIAS. This caused the remote instance to skip loading config values from its local wp-cli.yml files due to alias context activation.

Changes

php/WP_CLI/Runner.php

  • Filter connection-specific keys (ssh, http, proxyjump, key) from runtime alias
  • Only pass WordPress-specific properties (path, user, url) to remote instance

features/aliases.feature

  • Add test for connection-only aliases (no WP_CLI_RUNTIME_ALIAS passed)
  • Add test for aliases with WordPress properties (runtime alias still passed)

Behavior

Before:

@prod:
  ssh: user@host:/var/www
  proxyjump: jumphost

Remote command: WP_CLI_RUNTIME_ALIAS='{"@prod":{"proxyjump":"jumphost"}}' wp @prod ...
→ Remote config files skipped

After:

@prod:
  ssh: user@host:/var/www
  proxyjump: jumphost

Remote command: wp ...
→ Remote config files loaded normally

WordPress-specific properties still override remote configs when explicitly set:

@prod:
  ssh: user@host:/var/www
  user: admin  # Still passed to remote via WP_CLI_RUNTIME_ALIAS

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 3c4f3b.example.com
    • Triggering command: /usr/bin/php /usr/bin/php /home/REDACTED/work/wp-cli/wp-cli/bin/../php/boot-fs.php core install-network --title=WP CLI Network --subdomains=1 un-linter-tests k/wp-cli/wp-cli/vendor/bin/sh (dns block)
  • example.com
    • Triggering command: /usr/bin/php /usr/bin/php /home/REDACTED/work/wp-cli/wp-cli/bin/../php/boot-fs.php core install --url=REDACTED --title=WP CLI Site --admin_user=admin --admin_email=admin@example.com --admin_password=password1 --skip-email (dns block)
    • Triggering command: /usr/bin/php /usr/bin/php /home/REDACTED/work/wp-cli/wp-cli/bin/../php/boot-fs.php core install --url=REDACTED --title=WP CLI Site --admin_user=admin --admin_email=admin@example.com --admin_password=password1 --skip-email ev (dns block)
    • Triggering command: /usr/bin/php /usr/bin/php /home/REDACTED/work/wp-cli/wp-cli/bin/../php/boot-fs.php core install --url=REDACTED --title=WP CLI Site --admin_user=admin --admin_email=admin@example.com --admin_password=password1 --skip-email --set-path=/path/to/wordpress sh bin/�� pdate home 'REDACTED' alias k/wp-cli/wp-cli/bin/wp -remote-wp-cli-cmysql (dns block)
  • host
    • Triggering command: /usr/bin/ssh ssh -i identityfile.key -T -vvv user@host cd '/path/to/wordpress'; wp '--debug' '--version' rgo/bin/git (dns block)
    • Triggering command: /usr/bin/ssh ssh -T -vvv user@host cd '/path/to/wordpress'; WP_CLI_RUNTIME_ALIAS='{"@foo":{"user":"admin","path":"\/var\/www\/html"}}' wp @foo '--debug' 'core' 'version' d92a3deef4bd8d0b/wp-config.php d92a3deef4bd8d0b/wp-content n/git hpstan.neon.distsh (dns block)
  • proxyhost
    • Triggering command: /usr/bin/ssh ssh -vvv -W [host]:22 proxyhost abase/index.php d92a3deef4bd8d0b/wp-content/database omposer (dns block)
    • Triggering command: /usr/bin/ssh ssh -vvv -W [host]:22 proxyhost _path=\(.*;\)\?\--user=admin ABLE_WP_CRON', true ); } /home/REDACTED/.config/composer/vendor/bin/bash (dns block)
  • wordpress
    • Triggering command: /usr/bin/ssh ssh -T -vvv wordpress cd '/my/path'; wp '--debug' '--version' ext\FeatureContext --require=foo.php n/bash s-than-wp-6.1&&~tput core cal/bin/which sh /hom�� li-test-run--697655b3a38da6.36564117/subdir/wp-content/uploads'/* '/tmp/wp-cli-test-core-installsh test-cmd n/php ache-6.9/index.pdirname ache-6.9/license-- bin/sh wp (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Running command against an alias doesn't read the remote config files</issue_title>
<issue_description>Given a command that runs against an alias, the remote WP-CLI instance does not appear to read the config files on the remote server.

This means that config options that are set on the remote server are not respected.</issue_description>

Comments on the Issue (you are @copilot in this section)

@danielbachhuber Can you share specifics to your use case? @schlessera I consider this a bug. When I run a command remotely, I expect it to exhibit the exact same behavior as if I would run it locally (minus whatever restrictions are needed for security).

You should be able to configure a site through its local wp-cli.yml file and have this configuration be respected when doing remote operations on the same site.</comment_new>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

When running commands against an SSH alias, connection-specific properties
(ssh, http, proxyjump, key) should not be passed to the remote WP-CLI instance
via WP_CLI_RUNTIME_ALIAS. Only WordPress-specific properties (path, user, url)
should be passed. This allows the remote WP-CLI instance to properly read its
local config files without interference from connection details.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix remote WP-CLI instance not reading config files Fix remote config loading when aliases contain connection properties Jan 25, 2026
Copilot AI requested a review from swissspidy January 25, 2026 17:44
@swissspidy swissspidy requested a review from Copilot January 25, 2026 17:44

This comment was marked as resolved.

@codecov
Copy link

codecov bot commented Jan 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy marked this pull request as ready for review February 4, 2026 02:04
@swissspidy swissspidy requested a review from a team as a code owner February 4, 2026 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug command:cli Related to 'cli' command command:config

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Running command against an alias doesn't read the remote config files

2 participants