Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ The reusable workflow declares the expected typed review artifacts for Docs Agen

The target repository grants `contents: write`, `pull-requests: write`, and `issues: write`. Docs Agent forwards the caller-scoped `${{ github.token }}` to WP Codebox for same-repository publication, so consumers do not configure `ACCESS_TOKEN`. `OPENAI_API_KEY` is an optional workflow secret and is required only for a live OpenAI run; skipped and dry-run calls do not require it. `EXTERNAL_PACKAGE_SOURCE_POLICY` remains a separate required v1 JSON secret. Migrate its value to the exact one-line JSON in the root README: it authorizes the selected Docs Agent package, the pinned Agents API component, the pinned PHP AI Client overlay, and the checksum-pinned OpenAI provider artifact. Both secrets are forwarded to WP Codebox without serialization into the task descriptor.

Docs Agent consumes the reusable WP Codebox workflow and helper implementation at immutable revision `126f85b2a8b887ae8e2457d1cb71b15ebdb712cd` and passes `wp_codebox_release_ref: v0.33.4` and `wp_codebox_workflow_ref: 126f85b2a8b887ae8e2457d1cb71b15ebdb712cd`. That revision is the commit the annotated `v0.33.4` tag resolves to, so the reusable workflow, its helper scripts, and the release tag all name the same producer code; the fixed Docs Agent package revision stays separate. WP Codebox checks that the helper checkout matches `wp_codebox_workflow_ref` and that its `package.json` version equals the release tag, then installs its runtime from that checkout. WP Codebox materializes the declared native runtime closure, executes the selected package, applies bounded workspace changes, runs verification, and publishes approved host changes. The v0.33.4 release assets are `wp-codebox-cli-linux-x64.tar.gz`, `wp-codebox-workspace-0.33.4.tgz`, and `wp-codebox.zip`; `tests/wp-codebox-release.fixture.json` records their published SHA-256 digests.
Docs Agent consumes the reusable WP Codebox workflow and helper implementation at immutable revision `823e68cbb180579cd9dfd7d861be7bdc4074ff91` and passes `wp_codebox_release_ref: v0.33.5` and `wp_codebox_workflow_ref: 823e68cbb180579cd9dfd7d861be7bdc4074ff91`. That revision is the commit the annotated `v0.33.5` tag resolves to, so the reusable workflow, its helper scripts, and the release tag all name the same producer code; the fixed Docs Agent package revision stays separate. WP Codebox checks that the helper checkout matches `wp_codebox_workflow_ref` and that its `package.json` version equals the release tag, then installs its runtime from that checkout. WP Codebox materializes the declared native runtime closure, executes the selected package, applies bounded workspace changes, runs verification, and publishes approved host changes. The v0.33.5 release assets are `wp-codebox-cli-linux-x64.tar.gz`, `wp-codebox-workspace-0.33.5.tgz`, and `wp-codebox.zip`; `tests/wp-codebox-release.fixture.json` records their published SHA-256 digests.

Provider artifacts retain only allowlisted review artifacts, controlled workflow envelopes, and canonical runtime-source and seed provenance. WP Codebox uploads a reviewer-safe workflow-result projection: public control, verification, workspace-apply, publication, output-projection, access, failure, artifact-declaration, and canonical transcript-provenance fields remain, while raw `runtime_result`, `outputs.engine_data`, model/provider/tool payloads, source content, private paths, and secrets are excluded. Before persistence or upload, it sanitizes private runtime paths from nested values, object keys, diagnostics, and command arguments. WP Codebox captures one trusted canonical `codebox-transcript` through a pre-sanitization reviewer-evidence descriptor, validates its artifact-root containment, schema, digest, and size, then emits the compact reviewer transcript as a `wp-codebox/reviewer-agent-transcript/v1` projection. Before apply-back, it compares the seed identity with the host workspace identity; rejected patches preserve the expected and actual identities plus patch and changed-file evidence for upload. Its pre-redaction trusted apply input preserves machine-applicable patch bytes in a private channel that is removed before durable artifact sanitization, as fixed in [WP Codebox #1842](https://github.com/Automattic/wp-codebox/pull/1842). Lifecycle and downstream failures retain runtime evidence in their internal normalized failed result even when artifact preparation cannot complete. Diagnostic messages that name runtime classes remain reviewable, while PHP-shaped runtime source remains blocked. See [WP Codebox #1767](https://github.com/Automattic/wp-codebox/issues/1767), [WP Codebox #1814](https://github.com/Automattic/wp-codebox/issues/1814), [WP Codebox #1815](https://github.com/Automattic/wp-codebox/pull/1815), and [WP Codebox #1823](https://github.com/Automattic/wp-codebox/pull/1823). Successful canonical reviewer-evidence reference: [run `29350690551`](https://github.com/Automattic/build-with-wordpress/actions/runs/29350690551). The [hosted failure `29468956857`](https://github.com/Automattic/agents-api/actions/runs/29468956857) executed WP Codebox v0.12.20, published [Agents API #430](https://github.com/Automattic/agents-api/pull/430), then failed during upload preparation; it motivated #1814/#1815.

Publication integrity snapshots exclude Git-ignored verification artifacts, such as pnpm's symlinked `node_modules` tree, and mutable `.codebox` runtime control files, while tracked or otherwise publishable symlinks stay rejected. Integrity failures report bounded added, modified, and deleted paths, and non-Git workspaces keep a bounded filesystem snapshot fallback. Canonical GitHub repository identity is compared case-insensitively, while pull-request URL, pull number, target binding, and API resolution checks stay strict. Successful pull-request verification returns `{ valid: true }` without a failure-only `error`. These came from [WP Codebox #1845](https://github.com/Automattic/wp-codebox/pull/1845), [#1848](https://github.com/Automattic/wp-codebox/pull/1848), [#1852](https://github.com/Automattic/wp-codebox/pull/1852), [#1875](https://github.com/Automattic/wp-codebox/pull/1875), and [#1885](https://github.com/Automattic/wp-codebox/pull/1885).

WP Codebox v0.33.4 makes the runner-workspace apply step observable; see [WP Codebox #2588](https://github.com/Automattic/wp-codebox/pull/2588) and [WP Codebox #2567](https://github.com/Automattic/wp-codebox/issues/2567). Earlier revisions could finish a run with agent writes that never reached the host workspace, and the uploaded transcript could be a stub. In v0.33.4:
WP Codebox v0.33.5 honors the caller's `max_turns` over an imported package's `default_max_turns` ([WP Codebox #2589](https://github.com/Automattic/wp-codebox/pull/2589)), so this workflow's `max_turns` input actually reaches the agent loop. A run that exhausts its turn budget while still calling tools now fails at `stage: agent` with `max_turns_exceeded` (`terminal_status: max_turns`, `agent_turn_limit` in the result) instead of finishing as a green no-op; partial work is not applied.

WP Codebox v0.33.4 made the runner-workspace apply step observable; see [WP Codebox #2588](https://github.com/Automattic/wp-codebox/pull/2588) and [WP Codebox #2567](https://github.com/Automattic/wp-codebox/issues/2567). Earlier revisions could finish a run with agent writes that never reached the host workspace, and the uploaded transcript could be a stub. In v0.33.4 and later:

- The workflow result and its reviewer-safe projection carry `workspace_apply` (`wp-codebox/runner-workspace-apply-outcome/v1`). It records `status` (`applied`, `no-op`, `writes-not-applied`, `rejected`, `failed`, or `skipped`), `applied_paths`, every rejected path with its reason, `unapplied_paths`, `declared_changes`, and content-free `write_tool_calls` counts and paths taken from the sandbox write ledger.
- If the sandbox accepted `workspace_write`, `workspace_edit`, or `workspace_apply_patch` calls but the canonical patch declared no changes, the run fails at `stage: apply` with `writes-not-applied` and lists the lost paths. Verification, drift checks, and the Docs Agent completion check do not run in that case. A run with no write calls still reaches them.
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/maintain-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,10 @@ jobs:
contents: write
pull-requests: write
issues: write
uses: Automattic/wp-codebox/.github/workflows/run-agent-task.yml@126f85b2a8b887ae8e2457d1cb71b15ebdb712cd
uses: Automattic/wp-codebox/.github/workflows/run-agent-task.yml@823e68cbb180579cd9dfd7d861be7bdc4074ff91
with:
wp_codebox_release_ref: v0.33.4
wp_codebox_workflow_ref: 126f85b2a8b887ae8e2457d1cb71b15ebdb712cd
wp_codebox_release_ref: v0.33.5
wp_codebox_workflow_ref: 823e68cbb180579cd9dfd7d861be7bdc4074ff91
external_package_source: ${{ needs.prepare.outputs.external_package_source }}
runtime_sources: ${{ needs.prepare.outputs.runtime_sources }}
workload_id: docs-agent-${{ inputs.audience }}-${{ inputs.run_kind }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: Automattic/wp-codebox
ref: 126f85b2a8b887ae8e2457d1cb71b15ebdb712cd
ref: 823e68cbb180579cd9dfd7d861be7bdc4074ff91
path: .wp-codebox
- name: Validate Docs Agent
env:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ Docs Agent declares the review artifacts it expects the runner to materialize as

`maintain-docs.yml` writes `expected_artifacts` and `artifact_declarations` into a portable Docs Agent recipe and exposes the same declaration objects as `declared_artifacts_json`. The runtime declaration for `docs_agent_completion_report` remains `required: false` because WP Codebox may evaluate runtime-level required artifacts before post-command validation. The final completion drift entry is mandatory and declares `{name,type,path}`; after deterministic host validation, the validator atomically writes canonical JSON to `.codebox/agent-task-artifacts/docs-agent-completion-report.json`, and WP Codebox stages that declared command artifact for reviewers.

The reusable workflow and helper implementation are pinned to WP Codebox `v0.33.4`: `wp_codebox_release_ref: v0.33.4` and `wp_codebox_workflow_ref` both resolve to the tag commit `126f85b2a8b887ae8e2457d1cb71b15ebdb712cd`. This producer revision is independent of the fixed Docs Agent package revision.
The reusable workflow and helper implementation are pinned to WP Codebox `v0.33.5`: `wp_codebox_release_ref: v0.33.5` and `wp_codebox_workflow_ref` both resolve to the tag commit `823e68cbb180579cd9dfd7d861be7bdc4074ff91`. This producer revision is independent of the fixed Docs Agent package revision.

WP Codebox v0.33.4 uploads a reviewer-safe workflow-result projection with public control, workspace-apply, and publication fields plus canonical transcript provenance. It excludes raw `runtime_result`, `outputs.engine_data`, model/provider/tool payloads, source content, private paths, secrets, Git-ignored verification artifacts such as pnpm's symlinked `node_modules` tree, and mutable `.codebox` runtime control files. Tracked or otherwise publishable symlinks remain rejected. Integrity failures retain bounded added, modified, and deleted path evidence, and non-Git workspaces retain a bounded filesystem snapshot fallback. Canonical GitHub repository identity is compared case-insensitively while pull-request URL syntax, pull number, target binding, and API resolution remain strict. The canonical `codebox-transcript` remains the bounded tool-observability surface: its pre-sanitization reviewer-evidence descriptor records the trusted artifact-relative path, schema, verified source digest, and size, which the uploader revalidates before producing the `wp-codebox/reviewer-agent-transcript/v1` projection. Since v0.33.4 that projection decodes the runtime output, so it includes tool observability and the content-free sandbox write ledger instead of a stub. Before apply-back, WP Codebox validates that the runner seed and host workspace identities match; rejected patches retain identity, patch, and changed-file evidence for review. The pre-redaction trusted apply input fixed by [WP Codebox #1842](https://github.com/Automattic/wp-codebox/pull/1842) retains machine-applicable patch bytes privately, then removes them before durable artifact sanitization.
WP Codebox v0.33.5 uploads a reviewer-safe workflow-result projection with public control, workspace-apply, and publication fields plus canonical transcript provenance. It excludes raw `runtime_result`, `outputs.engine_data`, model/provider/tool payloads, source content, private paths, secrets, Git-ignored verification artifacts such as pnpm's symlinked `node_modules` tree, and mutable `.codebox` runtime control files. Tracked or otherwise publishable symlinks remain rejected. Integrity failures retain bounded added, modified, and deleted path evidence, and non-Git workspaces retain a bounded filesystem snapshot fallback. Canonical GitHub repository identity is compared case-insensitively while pull-request URL syntax, pull number, target binding, and API resolution remain strict. The canonical `codebox-transcript` remains the bounded tool-observability surface: its pre-sanitization reviewer-evidence descriptor records the trusted artifact-relative path, schema, verified source digest, and size, which the uploader revalidates before producing the `wp-codebox/reviewer-agent-transcript/v1` projection. Since v0.33.5 that projection decodes the runtime output, so it includes tool observability and the content-free sandbox write ledger instead of a stub. Before apply-back, WP Codebox validates that the runner seed and host workspace identities match; rejected patches retain identity, patch, and changed-file evidence for review. The pre-redaction trusted apply input fixed by [WP Codebox #1842](https://github.com/Automattic/wp-codebox/pull/1842) retains machine-applicable patch bytes privately, then removes them before durable artifact sanitization.

The workflow result records the runner-workspace apply outcome as `workspace_apply` (`wp-codebox/runner-workspace-apply-outcome/v1`): applied, rejected, and unapplied paths plus write-tool call counts. Sandbox and host now share one writable-path glob matcher, so `docs/**` and `docs/**/*.md` behave the same on both sides. If the agent made successful write calls but the canonical patch declared no changes, the run fails at `stage: apply` with `writes-not-applied` instead of passing as a no-op. See [WP Codebox #2588](https://github.com/Automattic/wp-codebox/pull/2588) and [WP Codebox #2567](https://github.com/Automattic/wp-codebox/issues/2567).

Expand Down
6 changes: 3 additions & 3 deletions tests/validate-docs-agent-packages.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@
$assert( str_contains( $maintain_docs_workflow, 'The host generates and stages the completion report from caller inputs, Git, and filesystem checks' ), 'maintain-docs.yml must make host-owned completion generation explicit.' );
$assert( ! str_contains( $maintain_docs_workflow, 'DOCS_AGENT_COMPLETION_REPORT' ), 'maintain-docs.yml must not request model-authored completion reports.' );

$wp_codebox_producer_revision = '126f85b2a8b887ae8e2457d1cb71b15ebdb712cd';
$wp_codebox_producer_revision = '823e68cbb180579cd9dfd7d861be7bdc4074ff91';
$generic_codebox_agent_task_workflow = 'uses: Automattic/wp-codebox/.github/workflows/run-agent-task.yml@' . $wp_codebox_producer_revision;
$assert( str_contains( $maintain_docs_workflow, $generic_codebox_agent_task_workflow ), 'maintain-docs.yml must call the immutable generic Codebox agent-task workflow candidate.' );
$assert( str_contains( $maintain_docs_workflow, 'wp_codebox_release_ref: v0.33.4' ), 'maintain-docs.yml must pass the matching WP Codebox release tag.' );
$assert( str_contains( $maintain_docs_workflow, 'wp_codebox_release_ref: v0.33.5' ), 'maintain-docs.yml must pass the matching WP Codebox release tag.' );
$assert( str_contains( $maintain_docs_workflow, 'wp_codebox_workflow_ref: ' . $wp_codebox_producer_revision ), 'maintain-docs.yml must execute helpers from the accepted producer revision.' );

$assert( str_contains( $maintain_docs_workflow, '--arg writablePaths "$INPUT_WRITABLE_PATHS"' ), 'maintain-docs.yml must include writable paths in the portable recipe.' );
Expand All @@ -103,7 +103,7 @@
foreach ( array( 'Docs Agent Runner Recipe', 'portable recipe', 'Docs Agent owns the native package' ) as $migration_note_text ) {
$assert( str_contains( $workflow_readme, $migration_note_text ), "Workflow README missing agent runtime note: {$migration_note_text}" );
}
$assert( str_contains( $workflow_readme, 'v0.33.4' ), 'Workflow README must record the WP Codebox release tag.' );
$assert( str_contains( $workflow_readme, 'v0.33.5' ), 'Workflow README must record the WP Codebox release tag.' );
$assert( str_contains( $workflow_readme, 'Diagnostic messages that name runtime classes remain reviewable' ), 'Workflow README must document diagnostic-versus-source detection.' );
$assert( str_contains( $workflow_readme, 'allowlisted review artifacts' ), 'Workflow README must document the WP Codebox upload allowlist.' );
$assert( str_contains( $workflow_readme, 'normalized failed result' ), 'Workflow README must document normalized WP Codebox failures.' );
Expand Down
8 changes: 4 additions & 4 deletions tests/validate-wp-codebox-run-agent-task-contract.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@
$published_assets = $release['published_assets'] ?? null;
$assert( is_array( $published_assets ), 'WP Codebox release fixture must record published release assets.' );
$assert( array(
'wp-codebox-cli-linux-x64.tar.gz' => 'sha256:c37f770deb9a9c26e8191b44292da759f150b0641705af45ee6d41640ac695ab',
'wp-codebox-workspace-0.33.4.tgz' => 'sha256:57e8daf900de6504590edb1f1aa9a992c64b7fad8b5526162a3d377c63f95279',
'wp-codebox.zip' => 'sha256:46dc08b55eb4fd3d6fbd67d1ea25978816dea1eeade07c0444ad660ee547c975',
) === $published_assets, 'WP Codebox release fixture must retain the published v0.33.4 asset digests.' );
'wp-codebox-cli-linux-x64.tar.gz' => 'sha256:98ecf24593e9d0e5d01826e6327702e7f30ad8a0e133d630d35a71c61b628260',
'wp-codebox-workspace-0.33.5.tgz' => 'sha256:3a6ecdd5e1a3ba93544fc8e3ffbf8895f3312cddf10e921aab776b50ec1f1f15',
'wp-codebox.zip' => 'sha256:2e35008606ca08de9b0aa86a52da7f167973dae098fe0ce3b6d5c6fd6fc418b6',
) === $published_assets, 'WP Codebox release fixture must retain the published v0.33.5 asset digests.' );
$run = $release['run'] ?? null;
$assert( is_string( $run ) && preg_match( '/^\d+$/', $run ) === 1, 'WP Codebox release fixture must retain the regression run reference.' );
$diagnostic_regression_run = $release['diagnostic_regression_run'] ?? null;
Expand Down
14 changes: 7 additions & 7 deletions tests/wp-codebox-release.fixture.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"tag": "v0.33.4",
"revision": "126f85b2a8b887ae8e2457d1cb71b15ebdb712cd",
"producer_revision": "126f85b2a8b887ae8e2457d1cb71b15ebdb712cd",
"package_version": "0.33.4",
"tag": "v0.33.5",
"revision": "823e68cbb180579cd9dfd7d861be7bdc4074ff91",
"producer_revision": "823e68cbb180579cd9dfd7d861be7bdc4074ff91",
"package_version": "0.33.5",
"published_assets": {
"wp-codebox-cli-linux-x64.tar.gz": "sha256:c37f770deb9a9c26e8191b44292da759f150b0641705af45ee6d41640ac695ab",
"wp-codebox-workspace-0.33.4.tgz": "sha256:57e8daf900de6504590edb1f1aa9a992c64b7fad8b5526162a3d377c63f95279",
"wp-codebox.zip": "sha256:46dc08b55eb4fd3d6fbd67d1ea25978816dea1eeade07c0444ad660ee547c975"
"wp-codebox-cli-linux-x64.tar.gz": "sha256:98ecf24593e9d0e5d01826e6327702e7f30ad8a0e133d630d35a71c61b628260",
"wp-codebox-workspace-0.33.5.tgz": "sha256:3a6ecdd5e1a3ba93544fc8e3ffbf8895f3312cddf10e921aab776b50ec1f1f15",
"wp-codebox.zip": "sha256:2e35008606ca08de9b0aa86a52da7f167973dae098fe0ce3b6d5c6fd6fc418b6"
},
"run": "29350690551",
"diagnostic_regression_run": "29307978522",
Expand Down
Loading