Skip to content

Concurrent wordpress.wp-cli commands collide on shared temporary script #2003

Description

@chubes4

Problem

Concurrent wordpress.wp-cli commands in one WP Codebox runtime reuse /tmp/wp-codebox-wp-cli-2.php. Workers race while creating/writing/executing the file, producing File exists, partial scripts, and PHP parse errors. This prevents valid parallel/concurrency testing and can corrupt ordinary concurrent command execution.

Observed failures

With a bounded runtime plan at concurrency 6:

Could not write to "/tmp/wp-codebox-wp-cli-2.php": File exists.
PHP Parse error: Unclosed '{' on line 10 in /tmp/wp-codebox-wp-cli-2.php on line 11

The same shared path appeared across independent process identities/artifact namespaces. Some commands succeeded while others executed a partially written script and crashed with exit 255.

Reproduction shape

Run multiple wordpress.wp-cli operations concurrently inside the same runtime, for example a bounded plan containing six independent enable/disable/generate commands. The exact command payload is not material; collision occurs in the transport-generated wrapper script before WP-CLI produces a structured response.

Observed plan result:

  • Concurrency: 6
  • Entries: 13
  • Succeeded: 6
  • Failed: 7
  • Failure classification: runtime-worker-failure
  • Runtime: WP Codebox CLI 0.12.29, Playground PHP 8.4.23

Evidence

Local isolated artifacts:

  • /mnt/extrachill-workspace/tmp/opencode/two-factor-pr905-aggressive/parallel-artifacts-v2/runtime-mry1be1n-4uo5kf/logs/commands.log
  • commands.jsonl in the same runtime artifact
  • /mnt/extrachill-workspace/tmp/opencode/two-factor-pr905-aggressive/parallel-artifacts-v2/bounded-plan/result.json

Expected

Each command invocation must own a collision-proof temporary script path, ideally derived from runtime/request identity plus cryptographically random or atomic temp creation. Creation, write, execution, and cleanup must be isolated so concurrent invocations cannot observe or modify each other’s scripts.

Acceptance criteria

  • Parallel wordpress.wp-cli commands in one runtime use unique files.
  • No File exists, partial-script parse errors, or cross-command payload execution.
  • Temporary scripts are cleaned up on success, command failure, timeout, and cancellation without deleting another invocation’s file.
  • Stress coverage runs repeated bounded plans at concurrency greater than one and verifies payload/output isolation.
  • Existing sequential command behavior remains unchanged.

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