Skip to content

feat: runner-workspace executor on the live dispatch contract + CLI mount flip (Closes #1602)#1604

Merged
chubes4 merged 2 commits into
mainfrom
feat/runner-workspace-git-tools
Jun 28, 2026
Merged

feat: runner-workspace executor on the live dispatch contract + CLI mount flip (Closes #1602)#1604
chubes4 merged 2 commits into
mainfrom
feat/runner-workspace-git-tools

Conversation

@chubes4

@chubes4 chubes4 commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

Gives the WP Codebox runner a codebox-owned git + GitHub + file agent-tool surface and wires it onto the now-live Agents API tool-executor dispatch contract, so the runner no longer depends on an external coding-agent plugin (Data Machine Code) for its agent-facing tools.

Closes #1602

Phase 1 — Runner-native tool engine + executor (foundation)

  • WP_Codebox_Runner_Workspace_Tools: WordPress-independent engine for the agent-facing file tools (read/ls/grep/write/edit/apply-patch), git tools (status/diff/add/commit, push construction) and GitHub request construction (create PR/issue, comment PR) with env-token auth, bound to one workspace root with path-escape confinement.
  • WP_Codebox_Runner_Workspace_Executor (target wp-codebox/runner-workspace): implements the Agents API WP_Agent_Tool_Executor contract, mapping tool names to the engine and resolving the workspace root from call input / client context / a runner constant / a filter.
  • Deterministic engine smoke on a real temp git repo (no DMC, no network).

Phase 2 — Wire onto the live contract + flip the CLI mount (the dependency shed)

Mirrors the merged git-less sandbox executor (#1605):

  • WP_Codebox_Runner_Workspace_Executor::register() registers onto the canonical Agents API filters:
    • agents_api_tool_sources declares the 14 file/git/GitHub tools under the wp-codebox-runner source, each carrying runtime.executor_target = wp-codebox/runner-workspace (host executor kind) + per-tool capability/side-effect metadata.
    • agents_api_executor_targets / agents_api_execution_targets register the target descriptor.
    • agents_api_tool_executors registers the executor instance under the target id, so WP_Agent_Tool_Execution_Core's registry-based dispatch (executePreparedToolresolveExecutorForTool) routes matching calls here.
    • register() gates on substrate_exists() (both the WP_Agent_Tool_Executor interface and WP_Agent_Tool_Source_Registry must be loaded — the gotcha the merged sandbox harness surfaced) and is invoked next to the sandbox executor in WP_Codebox_Abilities.
  • The runner agent already runs through the Agents API conversation loop, which instantiates WP_Agent_Tool_Execution_Core and calls executePreparedTool. That path builds the executor registry from agents_api_tool_executors, so registering the executor is sufficient — no conversation-loop change is needed.

CLI mount flip

defaultRuntimeComponentSources() in both packages/cli/src/agent-sandbox.ts and packages/runtime-core/src/agent-task-recipe.ts stops mounting the external coding-agent plugin (and the data-machine plugin it sat beside) for the runner. Only the Agents API runtime is mounted by default, alongside the bundled wp-codebox plugin (wordpress-plugin) that registers the runner executor. A host/deploy that still needs extra substrate opts back in through CONTAINED_RUNTIME_COMPONENT_PATHS / WP_CODEBOX_AGENT_RUNTIME_COMPONENT_PATHS. clone / worktree-add stay on the host-side runner-workspace backend filter (orchestration, not an in-runner agent tool), so the flip strips no agent-called surface.

Decoupling from data-machine names

wp-codebox no longer names the data-machine plugins on the runner path. Agents API resolves from explicit WP_CODEBOX_AGENTS_API_PATH, then a generic vendoring root via WP_CODEBOX_AGENTS_API_VENDOR_ROOT (<root>/vendor/wordpress/agents-api), then a sibling agents-api checkout.

Verification

  • Real-dispatch proofscripts/php-runner-workspace-executor-dispatch-smoke.php drives the real Agents API WP_Agent_Tool_Execution_Core + WP_Agent_Tool_Executor_Registry (no shims for the registry/core) against a real temp git repo: a tool with runtime.executor_target = wp-codebox/runner-workspace routes to the runner executor (NOT the default), returns real workspace content/git state, and an untargeted control tool falls back to the default executor (backward compat). 64 assertions pass against the merged agents-api contract. Wired into npm + the policy smoke group; skips cleanly (no fake pass) when no real agents-api checkout is resolvable.
  • No-DMC-needed — the runner agent-facing surface is exactly the 14 file/git/GitHub tools the executor covers (the scoping doc's mirrored subset). The host-side WP_Codebox_Runner_Workspace_Adapter handles clone / worktree-add / prepare / publish through the wp_codebox_runner_workspace_backend filter — host orchestration, not an in-runner agent tool — so dropping the default mount strips no agent-called surface.
  • Mount-flip testtests/agent-runtime-components.test.ts updated to encode the flipped contract: default runtime mounts only agents-api (+ bundled wp-codebox), no data-machine plugins; opt-in components still mount; agents-api resolves via the vendoring root with no product-specific name.
  • npm ci + npm run build clean. Smoke groups policy (incl. the dispatch proof + runner-workspace tools) and agent (incl. the agents-api adapter contract, sandbox executor, execution targets) pass. production-boundary-enforcement passes.
  • Pre-existing failures on clean origin/main (not introduced here): command-registry-smoke fails on wordpress.editor-validate-blocks outputShape (feat: add wordpress.editor-validate-blocks command (real wp.blocks.validateBlock on imported content) #1597), and docs-boundary-language fails on a README agents-api/ reference. Both reproduce with this PR's changes stashed.

Follow-ups (deferred)

  1. Network-level GitHub verification (cassette/live-token gated) for create-PR / issue / comment + git push against a throwaway remote.
  2. Legacy removal (held): prune any remaining data-machine-code-specific wiring once the runner has run end-to-end on the codebox-native surface in the Playground. This PR stops mounting it by default; the held step is pruning dead references, not behavior.

AI assistance

  • AI assistance: Yes
  • Tool(s): Claude Opus 4.8 via Claude Code
  • Used for: Wiring the runner executor onto the Agents API dispatch contract, the CLI mount flip, the real-dispatch integration test, and the data-machine name decoupling. Every line reviewed by the submitter.

@chubes4 chubes4 force-pushed the feat/runner-workspace-git-tools branch from 8b0521f to 7075cc4 Compare June 28, 2026 17:04
@chubes4 chubes4 changed the title feat: native runner-workspace git/GitHub agent tools (Refs #1602) feat: runner-workspace executor on the live dispatch contract + CLI mount flip (Closes #1602) Jun 28, 2026
@chubes4 chubes4 marked this pull request as ready for review June 28, 2026 17:05
chubes4 added 2 commits June 28, 2026 13:08
Give the WP Codebox runner a codebox-owned git + GitHub + file agent-tool
surface so it no longer depends on Data Machine Code for those tools.

- WP_Codebox_Runner_Workspace_Tools: WordPress-independent engine for the
  agent-facing file tools (read/ls/grep/write/edit/apply-patch), git tools
  (status/diff/add/commit, push construction) and GitHub request construction
  (create PR/issue, comment PR) with env-token auth, bound to one workspace
  root with path-escape confinement.
- WP_Codebox_Runner_Workspace_Executor (target wp-codebox/runner-workspace):
  implements the Agents API WP_Agent_Tool_Executor contract, mapping tool
  names to the engine and resolving the workspace root from call input,
  client context, a runner constant, or a filter.
- Deterministic smoke test on a real temp git repo (no DMC, no network):
  write->read->edit->grep, status->add->commit->diff, apply-patch, push argv
  construction, GitHub request construction, and executor target_id +
  workspace-root resolution. Wired into npm + the policy smoke group.
- docs/runner-workspace-git-tools.md: scope findings, the tool-resolution
  seam, the GitHub env-token auth finding, the mirrored-vs-dropped subset map,
  and the phased plan (CLI mount swap + conversation-loop wiring deferred).
…+ flip CLI mount (Refs #1602)

Phase 2: shed the external coding-agent plugin dependency on the runner path by
serving the runner agent's file/git/GitHub tool surface from the codebox-native
runner-workspace executor through the now-live Agents API tool-executor contract.

- Register WP_Codebox_Runner_Workspace_Executor onto the canonical Agents API
  filters, mirroring the merged git-less sandbox executor:
  - agents_api_tool_sources declares the 14 file/git/GitHub tools under the
    `wp-codebox-runner` source, each carrying
    runtime.executor_target = wp-codebox/runner-workspace and a host executor kind,
    with per-tool capability + side-effect metadata.
  - agents_api_executor_targets / agents_api_execution_targets register the
    wp-codebox/runner-workspace target descriptor.
  - agents_api_tool_executors registers the executor instance under the target id
    so WP_Agent_Tool_Execution_Core's registry-based dispatch routes matching
    calls here. The runner conversation loop already runs through that core, so no
    loop change is needed.
  register() gates on substrate_exists() (both the executor interface AND the
  source registry must be loaded) and is invoked next to the sandbox executor in
  WP_Codebox_Abilities.

- Flip the CLI default runner mount: defaultRuntimeComponentSources() in both
  packages/cli/src/agent-sandbox.ts and packages/runtime-core/src/agent-task-recipe.ts
  stops mounting the external coding-agent plugin (and the data-machine plugin it
  sat beside). Only the Agents API runtime is mounted by default, alongside the
  bundled wp-codebox plugin that registers the runner executor. Hosts opt extra
  substrate back in via CONTAINED_RUNTIME_COMPONENT_PATHS /
  WP_CODEBOX_AGENT_RUNTIME_COMPONENT_PATHS. clone/worktree-add stay on the host
  runner-workspace backend filter (orchestration, not an in-runner agent tool).

- Decouple wp-codebox from naming the data-machine plugins on the runner path:
  Agents API resolves from explicit WP_CODEBOX_AGENTS_API_PATH, then a generic
  vendoring root via WP_CODEBOX_AGENTS_API_VENDOR_ROOT
  (<root>/vendor/wordpress/agents-api), then a sibling agents-api checkout.

- Add scripts/php-runner-workspace-executor-dispatch-smoke.php: drives the REAL
  Agents API WP_Agent_Tool_Execution_Core + WP_Agent_Tool_Executor_Registry
  against a real temp git repo and proves a runner-targeted tool routes to the
  runner executor (not the default) while an untargeted tool falls back. Wired
  into npm + the policy smoke group; skips cleanly when no real agents-api
  checkout is resolvable rather than faking a pass.

- Update tests/agent-runtime-components.test.ts to encode the flipped contract:
  default runtime mounts only agents-api (+ bundled wp-codebox), no data-machine
  plugins; opt-in components still mount; agents-api resolves via the vendoring
  root with no product-specific name.
@chubes4 chubes4 force-pushed the feat/runner-workspace-git-tools branch from 7075cc4 to e70aa44 Compare June 28, 2026 17:10
@chubes4 chubes4 merged commit bbb478a into main Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Runner-workspace executor with native git + GitHub agent tools (shed the DMC dependency)

1 participant