Skip to content

WordPress plugin agent tasks fail when bundled CLI wrapper is not executable #2191

Description

@chubes4

Problem

An installed WP Codebox WordPress plugin can contain vendor/wp-codebox-cli/bin/wp-codebox without its executable mode. WP_Codebox_Agent_Sandbox_Runner::default_bin() selects that file whenever it exists, and command_prefix() resolves a Node runtime for the bundled wrapper but then discards it and executes the wrapper path directly.

The public wp codebox run-agent-task path then fails before sandbox creation:

sh: .../vendor/wp-codebox-cli/bin/wp-codebox: Permission denied
exit_code: 126

This is reproducible on a WordPress Studio plugin installation. Zip extraction does not reliably preserve executable mode, so package-time chmod(0755) is not a sufficient runtime contract.

Expected behavior

The WordPress plugin runner should invoke the bundled JavaScript CLI through the Node runtime already resolved by command_prefix(). Execution must not depend on the extracted shell wrapper retaining executable mode.

Acceptance criteria

  • A packaged plugin whose bundled shell wrapper is non-executable can run agent tasks.
  • The bundled JavaScript entrypoint is invoked through a validated bundled or host Node runtime.
  • Explicit standalone CLI commands and configured JavaScript paths retain their current behavior.
  • Deterministic coverage reproduces the non-executable-wrapper installation shape.

Evidence

Observed through wp-codebox/run-agent-task:

  • status: failed
  • failure classification: invalid_json
  • process exit: 126
  • underlying output: Permission denied

The invalid-JSON classification is secondary; the process never starts.

AI assistance

OpenCode using openai/gpt-5.6-sol diagnosed the public Codebox task failure, traced it to the bundled wrapper invocation in WP_Codebox_Agent_Sandbox_Runner::command_prefix(), and drafted this report. Chris Huber reviewed the reported behavior.

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