|
| 1 | +# Docs Agent Workflow |
| 2 | + |
| 3 | +Agents API publishes its canonical documentation updates through the repository-local Docs Agent consumer workflow in `.github/workflows/docs-agent.yml`. This page documents the consumer contract and the pinned native producer chain that `tests/docs-agent-native-workflow-contract.php` verifies. |
| 4 | + |
| 5 | +## Consumer Workflow Contract |
| 6 | + |
| 7 | +The consumer workflow is named **Docs Agent** and dispatches the reusable Docs Agent workflow from Automattic/docs-agent at the exact pinned revision: |
| 8 | + |
| 9 | +```text |
| 10 | +Automattic/docs-agent/.github/workflows/maintain-docs.yml@4c1043510ae71be4750cfde69777efc95ae0001e |
| 11 | +``` |
| 12 | + |
| 13 | +The workflow contract is intentionally narrow: |
| 14 | + |
| 15 | +- `audience: technical` |
| 16 | +- `run_kind: maintenance` |
| 17 | +- `base_ref: main` |
| 18 | +- `docs_branch: docs-agent/agents-api-docs-upkeep` |
| 19 | +- `writable_paths: README.md,docs/**` |
| 20 | +- `verification_commands`: `composer test`, then `php tests/no-product-imports-smoke.php` |
| 21 | +- `drift_checks`: `git diff --check` |
| 22 | + |
| 23 | +The workflow prompt tells the technical lane to maintain source-grounded developer documentation for the public, product-neutral Agents API substrate. Documentation updates are expected to stay inside `README.md` and `docs/**`. |
| 24 | + |
| 25 | +## Producer Chain |
| 26 | + |
| 27 | +`tests/docs-agent-native-workflow-contract.php` validates the consumer against the native producer chain instead of only checking copied strings in this repository. Run it with: |
| 28 | + |
| 29 | +```sh |
| 30 | +DOCS_AGENT_DIR=/path/to/docs-agent WP_CODEBOX_DIR=/path/to/wp-codebox php tests/docs-agent-native-workflow-contract.php |
| 31 | +``` |
| 32 | + |
| 33 | +The required producer checkouts are: |
| 34 | + |
| 35 | +- Docs Agent revision `4c1043510ae71be4750cfde69777efc95ae0001e`. |
| 36 | +- WP Codebox ref `v0.12.21`, revision `b5b1fc7eef4367d5e403de3e373df91d3722965b`. |
| 37 | + |
| 38 | +At that Docs Agent revision, the `technical:maintenance` lane maps to the native package: |
| 39 | + |
| 40 | +```text |
| 41 | +bundles/technical-docs-agent/native/technical-docs-maintenance-agent.agent.json |
| 42 | +``` |
| 43 | + |
| 44 | +with agent slug `technical-docs-maintenance-agent`, package digest `sha256-bytes-v1:6057aad4eb7c5f0320ccfbce9da93a5fa1d3fc521478b5571ed81c28129325aa`, and `success_requires_pr=false`. |
| 45 | + |
| 46 | +Docs Agent then calls WP Codebox's reusable workflow: |
| 47 | + |
| 48 | +```text |
| 49 | +Automattic/wp-codebox/.github/workflows/run-agent-task.yml@v0.12.21 |
| 50 | +``` |
| 51 | + |
| 52 | +The contract test verifies that this WP Codebox producer exposes the `wp-codebox/reusable-workflow-interface/v1` schema and preserves the release, external-package, runtime-source, target repository, writable path, verification, drift-check, publication, access-repository, and allowed-repository chain. In that producer path, WP Codebox v0.12.21 is the component that runs the agent task and returns the reviewer-safe result projection used by the reusable workflow publication path. |
| 53 | + |
| 54 | +## Secrets And Publication Credentials |
| 55 | + |
| 56 | +The consumer workflow forwards exactly these repository secrets to Docs Agent: |
| 57 | + |
| 58 | +- `OPENAI_API_KEY` |
| 59 | +- `EXTERNAL_PACKAGE_SOURCE_POLICY` |
| 60 | + |
| 61 | +`ACCESS_TOKEN` is **not** configured by the Agents API consumer workflow and must not be added there. The native contract test asserts that the consumer does not reference `secrets.ACCESS_TOKEN` or define an `ACCESS_TOKEN:` secret mapping. |
| 62 | + |
| 63 | +The producer chain still uses a publication token: at the pinned Docs Agent revision, Docs Agent forwards `ACCESS_TOKEN: ${{ github.token }}` to WP Codebox along with `OPENAI_API_KEY` and `EXTERNAL_PACKAGE_SOURCE_POLICY`. The consumer supports that built-in-token publication path by granting workflow permissions for `contents: write`, `pull-requests: write`, and `issues: write`. |
| 64 | + |
| 65 | +## Verification |
| 66 | + |
| 67 | +For normal documentation maintenance runs, the configured consumer verification is the same command chain in `.github/workflows/docs-agent.yml`: |
| 68 | + |
| 69 | +```sh |
| 70 | +composer test |
| 71 | +php tests/no-product-imports-smoke.php |
| 72 | +git diff --check |
| 73 | +``` |
| 74 | + |
| 75 | +The native producer-chain contract is separate because it needs local checkouts of Automattic/docs-agent and Automattic/wp-codebox at the pinned revisions. Use `tests/docs-agent-native-workflow-contract.php` when changing the Docs Agent pin, WP Codebox pin, reusable workflow inputs, secret forwarding, writable paths, or publication branch. |
0 commit comments