Skip to content

Split WP_Codebox_Agent_Sandbox_Runner into focused host adapter services #769

@chubes4

Description

@chubes4

Problem

WP_Codebox_Agent_Sandbox_Runner mixes host adapter responsibilities into one large class.

Evidence on current origin/main:

  • packages/wordpress-plugin/src/class-wp-codebox-agent-sandbox-runner.php is about 2996 lines.
  • It prepares command/recipe inputs, executes shell commands, parses run results, resolves component paths, normalizes parent requests, resolves inheritance/credentials, validates sandbox tool policy, writes recipes, exports parent-site seed fixtures, and handles batch/fanout behavior.

Why It Matters

The boundary between host policy, product request adaptation, sandbox recipe construction, process execution, and result normalization is hard to audit. This makes permission, secret, retry, and failure semantics harder to reason about.

Suggested Refactor

Split the class into focused services:

  • WP_Codebox_Host_Task_Request_Normalizer
  • WP_Codebox_Sandbox_Recipe_Builder
  • WP_Codebox_Inheritance_Resolver
  • WP_Codebox_Sandbox_Tool_Policy_Validator
  • WP_Codebox_Parent_Site_Seed_Exporter
  • WP_Codebox_Agent_Run_Result_Normalizer

Keep the public runner as orchestration glue.

Acceptance Criteria

  • Public ability behavior remains unchanged.
  • Host-side secrets and redacted audit metadata are handled by clearly separate helpers.
  • Existing WordPress plugin smoke coverage passes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions