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.
Problem
WP_Codebox_Agent_Sandbox_Runnermixes host adapter responsibilities into one large class.Evidence on current
origin/main:packages/wordpress-plugin/src/class-wp-codebox-agent-sandbox-runner.phpis about 2996 lines.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_NormalizerWP_Codebox_Sandbox_Recipe_BuilderWP_Codebox_Inheritance_ResolverWP_Codebox_Sandbox_Tool_Policy_ValidatorWP_Codebox_Parent_Site_Seed_ExporterWP_Codebox_Agent_Run_Result_NormalizerKeep the public runner as orchestration glue.
Acceptance Criteria