Skip to content

Scale Playground materialization for large host directory mounts #2090

Description

@chubes4

Problem

materializePlaygroundStagedInputs() does not scale to large host directory mounts. A WPCOM readonly tree with roughly 257,000 entries completes host-side readonly staging in 31.7 seconds, then times out after 1,500 seconds in input.materialize before any recipe command runs.

The materializer calls playground.writeFile() serially for every UTF-8 file and adds a verification call every 100 files. This makes runtime startup proportional to hundreds of thousands of cross-boundary calls rather than bounded batches.

Evidence

Runtime facts from an isolated parity run:

  • runtime.workers: 1
  • readonly host staging: completed in 31,681ms
  • active operation at timeout: input.materialize
  • timeout: 1,500,000ms
  • commands executed: 0
  • managed MariaDB reached ready state and was released cleanly

The relevant loop is in packages/runtime-playground/src/mount-materialization.ts: each text file awaits server.playground.writeFile(target, text) independently. Binary files already use the PHP batch path.

Reproduction

  1. Generate a directory tree containing at least 250,000 small UTF-8 files.
  2. Add it as a readonly directory mount to a minimal Playground recipe.
  3. Run wp-codebox recipe-run --recipe recipe.json --artifacts artifacts --timeout 1500000ms --json.
  4. Observe readonly staging complete, followed by timeout in input.materialize with no workflow commands executed.

Expected

Large host trees should be transferred through a bounded bulk/streaming primitive with deterministic progress and verification, avoiding one Playground call per file. Existing binary fidelity, readonly isolation, symlink policy, nested mounts, diagnostics, and timeout behavior must remain intact.

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