Skip to content

Fix Studio Assistant download plugins wp-cli commands by mounting Studio mu-plugins - #2243

Merged
sejas merged 1 commit into
trunkfrom
stu-1126-studio-ai-assistant-fails-executing-wp-cli-commands
Dec 12, 2025
Merged

Fix Studio Assistant download plugins wp-cli commands by mounting Studio mu-plugins#2243
sejas merged 1 commit into
trunkfrom
stu-1126-studio-ai-assistant-fails-executing-wp-cli-commands

Conversation

@sejas

@sejas sejas commented Dec 12, 2025

Copy link
Copy Markdown
Member

Related issues

Proposed Changes

  • Mount Studio mu-plugins before executing a wp-cli command

Testing Instructions

Confirm the issue is fixed

  • Run npm start
  • Go to the Assistant tab
  • Ask to install woocommerce
  • Execute the wp-cli command
  • Confirm that it works as expected and the plugin is installed
  • Go to the mu-plugins folder of your site and confirm there is no new files. Only the sqlite-database-integration.

Try other wp-cli commands like sqlite export

  • Go to the Import/Export tab
  • Export your site
  • Confirm that the site is correctly exported
Before After
image (10) Screenshot 2025-12-12 at 10 52 08

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@sejas sejas self-assigned this Dec 12, 2025
@sejas
sejas requested a review from a team December 12, 2025 11:04
@github-actions

Copy link
Copy Markdown
Contributor

📊 Performance Test Results

Comparing cf99292 vs trunk

site-editor

Metric trunk cf99292 Diff Change
load 10194.00 ms 9383.00 ms -811.00 ms 🟢 -8.0%

site-startup

Metric trunk cf99292 Diff Change
siteCreation 16323.00 ms 16337.00 ms +14.00 ms 🔴 0.1%
siteStartup 6992.00 ms 6955.00 ms -37.00 ms 🟢 -0.5%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change

@epeicher epeicher left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this @sejas! I have tested it, and it works as expected, I can install WooCommerce using the Assistant now. Code changes also LGTM! :shipit:

Before After WooCommerce installed
Image Image Image

@ivan-ottinger ivan-ottinger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great! I can confirm the proposed changes fix the issue. WP CLI plugin installation runs as expected:

Image

and there are no extra files added:

Image

Site export works as well. 👍🏼


The changes themselves look good to me too. It may be worth having a second pair of eyes look at them since I haven't reviewed many Playground CLI related changes yet and could be missing something there.

@sejas
sejas merged commit 6c0a1e1 into trunk Dec 12, 2025
10 checks passed
@sejas
sejas deleted the stu-1126-studio-ai-assistant-fails-executing-wp-cli-commands branch December 12, 2025 11:43
@wojtekn

wojtekn commented Dec 12, 2025

Copy link
Copy Markdown
Contributor

@sejas, would you mind sharing more details on what caused the issue and why mounting mu-plugins resolved it?

@sejas

sejas commented Dec 15, 2025

Copy link
Copy Markdown
Member Author

@sejas, would you mind sharing more details on what caused the issue and why mounting mu-plugins resolved it?

@wojtekn, the issue was that some WP-CLI commands didn't work, specifically those that had to download a file from wp.org, such as installing a plugin or theme. We have a mu-plugin, 0-allowed-redirect-hosts.php, that helps resolving those domains.

When we switched from wp-now to playground-cli, we also changed how Studio mu-plugins are mounted, mounting them only when Studio starts and not when executing wp-cli commands. In this PR, I'm mounting the Studio mu-plugins for wp-cli executions as well. Now, wp-cli executions and Studio start sites will behave more similarly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants