Skip to content

Allow slow Blueprint downloads on the native PHP runtime - #4937

Merged
wojtekn merged 2 commits into
trunkfrom
stu-2467-fix-blueprint-download-timeout
Oct 1, 2026
Merged

wojtekn merged 2 commits into
trunkfrom
stu-2467-fix-blueprint-download-timeout

Conversation

@wojtekn

@wojtekn wojtekn commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

Claude Code traced the failure to the HTTP client bundled in blueprints.phar, wrote the fix and tests, and ran them. I reviewed the change and the verification steps below.

Proposed Changes

On the native PHP runtime, creating a site from a Blueprint (e.g. the quickstart site) failed on slower connections with cURL error 28: Operation timed out after 30000 milliseconds. The Blueprint runner inside blueprints.phar limits each download to 30 seconds in total, so large plugins fail even while data is still arriving. Gutenberg (~48 MB) needs about 45 s at 1 MB/s, which is the reporter's connection speed. Fast connections never hit the limit, which is why it doesn't reproduce for most of us.

  • Studio now gives the Blueprint runner's HTTP client a 10-minute timeout, so large plugin and theme downloads finish on slow connections instead of failing site creation.
  • The phar has no CLI option for this. The override goes through the runner's existing blueprint.http_client filter, registered by a small PHP file loaded with auto_prepend_file only for the Blueprint run. blueprints.phar itself is unchanged.
  • This is a stopgap. The upstream fix, HttpClient: Add an idle_timeout_ms option and use it for Blueprint downloads WordPress/php-toolkit#322, adds an idle timeout to the HttpClient and switches the Blueprint runner to it, so downloads fail only if no data moves for 30 s. Once a phar with that fix is bundled, this override can be removed.

Testing Instructions

To reproduce the original failure, throttle your network to about 1 MB/s (e.g. macOS Network Link Conditioner):

  1. On trunk, create a quickstart site with the native PHP runtime → it fails with cURL error 28 ... after 30000 milliseconds.
  2. On this branch, repeat → the site is created and Gutenberg is installed.

Without throttling:

  • npm run cli:build && node apps/cli/dist/cli/main.mjs site create --runtime native --name test --path /tmp/stu2467 --blueprint bp.json with a Blueprint that installs https://downloads.wordpress.org/plugin/gutenberg.24.0.0.zip → the site is created with Gutenberg installed, and no studio-blueprint-prepend-* dir is left in the temp directory.
  • To confirm the override takes effect: temporarily change BLUEPRINT_HTTP_TIMEOUT_MS to 1500 and rebuild. The run should fail with timed out after 1501 milliseconds instead of 30000.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

🤖 Generated with Claude Code

…ailing after 30 seconds

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wpmobilebot

wpmobilebot commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 3c97e91 vs trunk

app-size

Metric trunk 3c97e91 Diff Change
App Size (Mac) 1455.49 MB 1454.28 MB 1.21 MB 🟢 -0.1%

site-editor

Metric trunk 3c97e91 Diff Change
load 1166 ms 1182 ms +16 ms ⚪ 0.0%

site-startup

Metric trunk 3c97e91 Diff Change
siteCreation 7527 ms 7518 ms 9 ms ⚪ 0.0%
siteStartup 2865 ms 2870 ms +5 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

…pports idle timeouts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wojtekn
wojtekn merged commit 410c13d into trunk Oct 1, 2026
12 checks passed
@wojtekn
wojtekn deleted the stu-2467-fix-blueprint-download-timeout branch October 1, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't create a quickstart site (timeout when downloading plugins)

2 participants