Skip to content

Commit a456cfd

Browse files
authored
Use WP Codebox v0.12.13 release (#134)
1 parent 94b9385 commit a456cfd

7 files changed

Lines changed: 71 additions & 25 deletions

.github/workflows/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# Docs Agent Workflows
22

3-
`maintain-docs.yml` is the consumer-facing reusable workflow for scheduled upkeep. Consumer repositories pass product-level inputs such as `audience`, `base_ref`, `docs_branch`, `writable_paths`, `verification_commands`, `drift_checks`, `prompt`, `run_agent`, and `dry_run`.
3+
`maintain-docs.yml` is the consumer-facing reusable workflow for scheduled upkeep. Consumer repositories pass product-level inputs such as `audience`, `base_ref`, `docs_branch`, `writable_paths`, `validation_dependencies`, `verification_commands`, `drift_checks`, `prompt`, `run_agent`, and `dry_run`.
44

55
The consumer workflow supports separate lanes for technical docs, user docs, and live skills maintenance. Use `audience: skills` with skills/package writable paths instead of broad docs paths.
66

77
Schedule skills upkeep separately from docs upkeep. The skills lane should use a dedicated branch such as `docs-agent/skills-upkeep`, skill/package writable paths, verification commands, and drift checks through the portable recipe.
88

9-
When verification commands or drift checks are needed, pass them through the reusable workflow inputs above. The reusable workflow includes those executable inputs in the portable recipe and keeps the target repository as the writable Docs Agent workspace.
9+
When validation setup, verification commands, or drift checks are needed, pass them through the reusable workflow inputs above. `validation_dependencies` is an optional caller-owned command that runs before verification during a live execution. The reusable workflow includes those executable inputs in the portable recipe and keeps the target repository as the writable Docs Agent workspace.
1010

1111
The reusable workflow declares the expected typed review artifacts for Docs Agent runs: transcript, change summary, verification report, drift report, and workspace publication links. `maintain-docs.yml` writes those declarations into the portable recipe and exposes the declaration objects through `declared_artifacts_json`.
1212

1313
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.
1414

15-
Docs Agent consumes the released [WP Codebox v0.12.12](https://github.com/Automattic/wp-codebox/releases/tag/v0.12.12) workflow and passes the matching `wp_codebox_release_ref: v0.12.12` input. WP Codebox validates that the paired tags match, resolves the release tag, verifies its package version, materializes the declared native runtime closure, and transports the native task result through controlled `.codebox` result files before publishing the workflow result. Its published OpenAI/provider-model contract is validated against the declared provider metadata, and provider artifacts retain only canonical runtime-source provenance. Before persisting workflow results or artifact uploads, WP Codebox sanitizes private runtime paths from nested values, object keys, diagnostics, and command arguments. Uploads contain only allowlisted review artifacts plus the controlled workflow envelope, and lifecycle failures publish a normalized failed result even when artifact preparation cannot complete. Diagnostic messages that name runtime classes remain reviewable; PHP-shaped runtime source remains blocked even under a reviewer-safe extension. The native task request carries WP Codebox's versioned sandbox tool-policy snapshot, keeping runtime-visible tools explicit. See [WP Codebox #1767](https://github.com/Automattic/wp-codebox/issues/1767) and [WP Codebox #1778](https://github.com/Automattic/wp-codebox/pull/1778). Regression reference: [run `29307978522`](https://github.com/Automattic/wp-codebox/actions/runs/29307978522).
15+
Docs Agent consumes the released [WP Codebox v0.12.13](https://github.com/Automattic/wp-codebox/releases/tag/v0.12.13) workflow and passes the matching `wp_codebox_release_ref: v0.12.13` input. WP Codebox validates that the paired tags match, resolves the release tag, verifies its package version, materializes the declared native runtime closure, and transports the native task result through controlled `.codebox` result files before publishing the workflow result. Its published OpenAI/provider-model contract is validated against the declared provider metadata, and provider artifacts retain only canonical runtime-source provenance. Before persisting workflow results or artifact uploads, WP Codebox sanitizes private runtime paths from nested values, object keys, diagnostics, and command arguments. Uploads contain only allowlisted review artifacts plus the controlled workflow envelope, and lifecycle failures publish a normalized failed result even when artifact preparation cannot complete. Diagnostic messages that name runtime classes remain reviewable; PHP-shaped runtime source remains blocked even under a reviewer-safe extension. The native task request carries WP Codebox's versioned sandbox tool-policy snapshot, keeping runtime-visible tools explicit. v0.12.13 supports optional output projection descriptors and derives required artifacts from typed declarations, so a successful maintenance no-op has no required artifacts or publication output. See [WP Codebox #1767](https://github.com/Automattic/wp-codebox/issues/1767), [WP Codebox #1778](https://github.com/Automattic/wp-codebox/pull/1778), and [WP Codebox #1780](https://github.com/Automattic/wp-codebox/pull/1780). Regression reference: [run `29309360438`](https://github.com/Automattic/build-with-wordpress/actions/runs/29309360438).
1616

1717
## Docs Agent Runner Recipe
1818

.github/workflows/maintain-docs.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ env:
2727
description: Comma-separated paths Docs Agent may edit.
2828
type: string
2929
default: README.md,docs/**
30+
validation_dependencies:
31+
description: Optional caller-owned command that installs dependencies needed before validation.
32+
type: string
33+
default: ""
3034
verification_commands:
3135
description: JSON array of canonical runner verification commands executed in the target workspace.
3236
type: string
@@ -76,6 +80,9 @@ env:
7680
success_requires_pr:
7781
description: Whether the selected lane requires a published pull request for success.
7882
value: ${{ jobs.prepare.outputs.success_requires_pr }}
83+
validation_dependencies:
84+
description: Caller-owned validation dependency command included in the runner recipe.
85+
value: ${{ jobs.prepare.outputs.validation_dependencies }}
7986

8087
jobs:
8188
prepare:
@@ -88,6 +95,7 @@ jobs:
8895
external_package_source: ${{ steps.config.outputs.external_package_source }}
8996
runtime_sources: ${{ steps.config.outputs.runtime_sources }}
9097
prompt: ${{ steps.config.outputs.prompt }}
98+
validation_dependencies: ${{ steps.config.outputs.validation_dependencies }}
9199
verification_commands: ${{ steps.config.outputs.verification_commands }}
92100
drift_checks: ${{ steps.config.outputs.drift_checks }}
93101
runner_workspace: ${{ steps.config.outputs.runner_workspace }}
@@ -102,6 +110,7 @@ jobs:
102110
RUN_KIND: ${{ inputs.run_kind }}
103111
INPUT_VERIFICATION_COMMANDS: ${{ inputs.verification_commands }}
104112
INPUT_DRIFT_CHECKS: ${{ inputs.drift_checks }}
113+
INPUT_VALIDATION_DEPENDENCIES: ${{ inputs.validation_dependencies }}
105114
INPUT_PROMPT: ${{ inputs.prompt }}
106115
INPUT_WRITABLE_PATHS: ${{ inputs.writable_paths }}
107116
RUN_AGENT: ${{ inputs.run_agent }}
@@ -201,11 +210,12 @@ jobs:
201210
--arg writablePaths "$INPUT_WRITABLE_PATHS" \
202211
--arg baseRef "$INPUT_BASE_REF" \
203212
--arg docsBranch "$INPUT_DOCS_BRANCH" \
213+
--arg validationDependencies "$INPUT_VALIDATION_DEPENDENCIES" \
204214
--argjson successRequiresPr "$success_requires_pr" \
205215
--argjson verificationCommands "$verification_commands" \
206216
--argjson driftChecks "$drift_checks" \
207217
--argjson artifactDeclarations "$artifact_declarations" \
208-
'{schema:"docs-agent/runner-recipe/v1",targetRepository:$targetRepository,prompt:$prompt,docsAgent:{externalPackageSource:{repository:$repository,revision:$revision,path:$packagePath,digest:$packageDigest},agentSlug:$agentSlug},runner:{verificationCommands:$verificationCommands,driftChecks:$driftChecks,writablePaths:$writablePaths,baseRef:$baseRef,docsBranch:$docsBranch,successRequiresPr:$successRequiresPr},artifacts:{expected:($artifactDeclarations|map(.name)),declarations:$artifactDeclarations}}')"
218+
'{schema:"docs-agent/runner-recipe/v1",targetRepository:$targetRepository,prompt:$prompt,docsAgent:{externalPackageSource:{repository:$repository,revision:$revision,path:$packagePath,digest:$packageDigest},agentSlug:$agentSlug},runner:{validationDependencies:$validationDependencies,verificationCommands:$verificationCommands,driftChecks:$driftChecks,writablePaths:$writablePaths,baseRef:$baseRef,docsBranch:$docsBranch,successRequiresPr:$successRequiresPr},artifacts:{expected:($artifactDeclarations|map(.name)),declarations:$artifactDeclarations}}')"
209219
external_package_source="$(jq -cn --arg repository "Automattic/docs-agent" --arg revision "$DOCS_AGENT_PACKAGE_REVISION" --arg path "$package_path" --arg digest "$package_digest" '{repository:$repository,revision:$revision,path:$path,digest:$digest}')"
210220
runtime_sources='[{"version":1,"role":"component","repository":"Automattic/agents-api","revision":"59d1e6b473f22498e40e279130bbb4f9bcde3b73","path":".","metadata":{"slug":"agents-api","loadAs":"mu-plugin","pluginFile":"agents-api.php"}},{"version":1,"role":"provider_plugin","source":{"type":"https_zip","url":"https://downloads.wordpress.org/plugin/ai-provider-for-openai.1.0.3.zip","sha256":"48f3c0c714b3164cda79d320829830d5a0ea1116e0b19653da8af898a22d3bb6","archive_root":"ai-provider-for-openai"},"metadata":{"slug":"ai-provider-for-openai","pluginFile":"plugin.php","activate":true,"providers":["openai"]}},{"version":1,"role":"bundled_library","repository":"WordPress/php-ai-client","revision":"631704201d15ffeff7091ad3bc7156db74054956","path":".","metadata":{"library":"php-ai-client","strategy":"wordpress-scoped-bundle"}}]'
211221
@@ -215,14 +225,15 @@ jobs:
215225
--arg baseRef "$INPUT_BASE_REF" \
216226
'{enabled:true,repo:$repo,clone_url:("https://github.com/" + $repo + ".git"),branch:$branch,branch_prefix:$branch,from:("origin/" + $baseRef)}')"
217227
expected_artifacts="$(printf '%s' "$artifact_declarations" | jq -c 'map(.name)')"
218-
output_projections='{"docs_agent_publication":"metadata.runner_workspace_publication.url"}'
228+
output_projections="$(jq -cn --arg path 'metadata.runner_workspace_publication.url' --argjson required "$success_requires_pr" '{docs_agent_publication:{path:$path,required:$required}}')"
219229
220230
{
221231
printf 'recipe_json<<EOF\n%s\nEOF\n' "$recipe_json"
222232
printf 'artifact_declarations<<EOF\n%s\nEOF\n' "$artifact_declarations"
223233
printf 'external_package_source=%s\n' "$external_package_source"
224234
printf 'runtime_sources<<EOF\n%s\nEOF\n' "$runtime_sources"
225235
printf 'prompt<<EOF\n%s\nEOF\n' "$prompt"
236+
printf 'validation_dependencies<<EOF\n%s\nEOF\n' "$INPUT_VALIDATION_DEPENDENCIES"
226237
printf 'verification_commands<<EOF\n%s\nEOF\n' "$verification_commands"
227238
printf 'drift_checks<<EOF\n%s\nEOF\n' "$drift_checks"
228239
printf 'runner_workspace<<EOF\n%s\nEOF\n' "$runner_workspace"
@@ -238,9 +249,9 @@ jobs:
238249
contents: write
239250
pull-requests: write
240251
issues: write
241-
uses: Automattic/wp-codebox/.github/workflows/run-agent-task.yml@v0.12.12
252+
uses: Automattic/wp-codebox/.github/workflows/run-agent-task.yml@v0.12.13
242253
with:
243-
wp_codebox_release_ref: v0.12.12
254+
wp_codebox_release_ref: v0.12.13
244255
external_package_source: ${{ needs.prepare.outputs.external_package_source }}
245256
runtime_sources: ${{ needs.prepare.outputs.runtime_sources }}
246257
workload_id: docs-agent-${{ inputs.audience }}-${{ inputs.run_kind }}
@@ -250,6 +261,7 @@ jobs:
250261
prompt: ${{ needs.prepare.outputs.prompt }}
251262
writable_paths: ${{ inputs.writable_paths }}
252263
runner_workspace: ${{ needs.prepare.outputs.runner_workspace }}
264+
validation_dependencies: ${{ needs.prepare.outputs.validation_dependencies }}
253265
verification_commands: ${{ needs.prepare.outputs.verification_commands }}
254266
drift_checks: ${{ needs.prepare.outputs.drift_checks }}
255267
success_requires_pr: ${{ needs.prepare.outputs.success_requires_pr == 'true' }}

.github/workflows/validate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
uses: actions/checkout@v4
1818
with:
1919
repository: Automattic/wp-codebox
20-
ref: v0.12.12
20+
ref: v0.12.13
2121
path: .wp-codebox
2222
- name: Validate Docs Agent
2323
env:

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Docs Agent declares the review artifacts it expects the runner to materialize as
113113

114114
Docs Agent owns native package selection, lane, artifact, prompt, and workspace mapping. Execution, credentials, AI provider selection, sandboxing, and publication are runner-owned concerns outside this repository.
115115

116-
Portable recipe fields include `docsAgent`, `runner.writablePaths`, artifacts, verification commands, drift checks, and review output mapping suggestions.
116+
Portable recipe fields include `docsAgent`, `runner.writablePaths`, caller-owned `runner.validationDependencies`, artifacts, verification commands, drift checks, and review output mapping suggestions.
117117

118118
## Pull Request Behavior
119119

@@ -122,7 +122,8 @@ Docs Agent opens or updates one canonical PR for the configured branch.
122122
- If the selected surface is current, the run succeeds with no changes.
123123
- If maintenance is needed, changes are written only under `writable_paths`.
124124
- If the canonical PR is already open, later runs reuse the same `docs_branch` and PR instead of creating duplicates.
125-
- `job_status`, `transcript_summary`, `credential_mode`, `success_requires_pr`, and bounded `projected_outputs_json` are exposed as reusable workflow outputs. A `run_agent: false` call returns `job_status: skipped`; a `dry_run: true` call validates without starting a model run. `OPENAI_API_KEY` is only required for a live OpenAI run and is never included in recipes, workflow outputs, or artifacts. Bootstrap lanes require a published pull request for success and expose its URL through `projected_outputs_json`; maintenance lanes allow a no-change result. Typed artifact declarations are exposed as `declared_artifacts_json` for review/debugging. Raw engine data is retained in runner artifacts rather than exposed as a workflow output.
125+
- `validation_dependencies` is an optional caller-owned reusable-workflow input. It is passed through the portable recipe and runs before verification commands when a live runner execution needs setup.
126+
- `job_status`, `transcript_summary`, `credential_mode`, `success_requires_pr`, `validation_dependencies`, and bounded `projected_outputs_json` are exposed as reusable workflow outputs. A `run_agent: false` call returns `job_status: skipped`; a `dry_run: true` call validates without starting a model run. `OPENAI_API_KEY` is only required for a live OpenAI run and is never included in recipes, workflow outputs, or artifacts. Bootstrap lanes require a published pull request and its projected URL for success; maintenance lanes allow a no-change result with no publication projection. Typed artifact declarations remain optional and are exposed as `declared_artifacts_json` for review/debugging. Raw engine data is retained in runner artifacts rather than exposed as a workflow output.
126127

127128
## Quality Bar
128129

0 commit comments

Comments
 (0)