Skip to content

Composer autoload preparation for recipe extra plugins times out at the generic 60s host-command default #2599

Done

Description

@chubes4

Symptom. On homeboy-lab, a WordPress managed PHPUnit recipe run (Homeboy's WP Codebox adapter, extrachill-events) intermittently fails before any test runs. Homeboy then reports PHPUNIT_ZERO_TESTS cause=recipe_run_no_executions and a Total: 0 gate (Extra-Chill/homeboy#19228). Captured with v0.34.1 (recipe-run/v1, success:false, executions: []):

Recipe extra plugin source requires Composer autoload but could not be prepared: /tmp/hb-1000/.../homeboy-deps/data-machine/plugins/data-machine: prepare Composer autoload for recipe extra plugin timed out after 60015ms: Composer could not detect the root package (chubes/datamachine) version, defaulting to '1.0.0'.
Installing dependencies from lock file
Package operations: 12 installs, 0 updates, 0 removals
  - Downloading league/html-to-markdown (5.1.2)
  ...
  - Syncing automattic/blocks-engine-php-transformer (dev-trunk d884268) into cache

Cause. prepareComposerAutoloadForPlugin (packages/cli/src/recipe-sources.ts, around line 435) and the source-package path (around line 1297) call composerManagedHostCommandConfig() without a timeoutMs. So executeHostCommand applies DEFAULT_TIMEOUT_MS = 60_000 (packages/runtime-core/src/host-command-executor.ts). Each recipe run stages the plugin into a fresh temp dir and runs composer install from scratch, including a git sync of a VCS dev-trunk package. A cold or contended install routinely takes longer than 60 s, and the whole run is lost. The same command finishes fine on a quieter run, which explains the flakiness.

Target state.

  1. Composer preparation gets a realistic default budget: 10 minutes (10 * 60_000), set in composerManagedHostCommandConfig's default, so both call sites and any future ones inherit it. The generic host-command default stays at 60 s.
  2. The budget can be overridden by the operator via env WP_CODEBOX_COMPOSER_TIMEOUT_MS (a positive integer; ignore invalid values), read in one place.
  3. A tests/ regression covering the default (10 min when unset, used by the recipe extra-plugin preparation config) and the env override, in the existing tests/recipe-extra-plugin-composer-preparation.test.ts style.

Activity

  1. chubes4 commented on Nov 27, 2026

    @chubes4
    CollaboratorAuthor

    Root cause found. The timeout is the symptom; this is the actual bug.

    composerManagedHostEnv() (packages/runtime-core/src/recipe-source-packages.ts:314) synthesizes COMPOSER_HOME=$HOME/.composer whenever COMPOSER_HOME is unset. Composer then uses $COMPOSER_HOME/cache as its cache dir. On Linux, though, Composer's own default (and every host's warm cache) is the XDG layout: ~/.config/composer and ~/.cache/composer.

    Homeboy runs WordPress extension jobs with an isolated HOME. It links the host's ~/.cache/composer into that home (Extra-Chill/homeboy#19226). Because WP Codebox points Composer at $HOME/.composer/cache instead, that cache is never used, and every recipe extra-plugin install starts cold.

    Measured on homeboy-lab, data-machine composer install with WP Codebox's exact args and env:

    • WP Codebox env, real HOME (~/.composer/cache happens to be warm): 1.3 s
    • WP Codebox env, fresh HOME (what every isolated run gets): 107 s, past the 60 s limit, so every managed suite runs 0 tests

    Additional target state. composerManagedHostEnv() must not invent COMPOSER_HOME. Pass through COMPOSER_HOME, COMPOSER_CACHE_DIR, XDG_CONFIG_HOME and XDG_CACHE_HOME when set, and otherwise let Composer resolve its own defaults from HOME. Add a regression test asserting that the env carries no synthesized COMPOSER_HOME, and that COMPOSER_CACHE_DIR/XDG_CACHE_HOME pass through. Keep the 10-minute Composer budget as a backstop.

  2. chubes4 commented on Nov 27, 2026

    @chubes4
    CollaboratorAuthor

    Fixed by #2600 (d8a5cd9).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions