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
2 changes: 1 addition & 1 deletion .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Docs Agent Workflows

`maintain-docs.yml` is the consumer-facing reusable workflow for scheduled upkeep. Consumer repositories pass product-level inputs such as `audience`, `require_pr`, `base_ref`, `docs_branch`, `writable_paths`, `context_repositories`, `bootstrap_contract`, `source_delta`, `validation_dependencies`, `verification_commands`, `drift_checks`, `prompt`, `run_agent`, and `dry_run`.
`maintain-docs.yml` is the consumer-facing reusable workflow for scheduled upkeep. Consumer repositories pass product-level inputs such as `audience`, `require_pr`, `base_ref`, `docs_branch`, `writable_paths`, `context_repositories`, `bootstrap_contract`, `source_delta`, `validation_dependencies`, `verification_commands`, `drift_checks`, `prompt`, `run_agent`, `dry_run`, `max_turns`, and `time_budget_ms`.

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.

Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/maintain-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ env:
description: Validate the prepared Docs Agent task without starting a live agent run.
type: boolean
default: false
max_turns:
description: Maximum agent turns. Reading a large source tree before writing needs more than WP Codebox's default of 12.
type: number
default: 40
time_budget_ms:
description: Agent run time budget in milliseconds.
type: number
default: 1800000
secrets:
OPENAI_API_KEY:
description: Optional OpenAI credential used for live Docs Agent runs.
Expand Down Expand Up @@ -374,6 +382,8 @@ jobs:
callback_data: ${{ needs.prepare.outputs.recipe_json }}
run_agent: ${{ inputs.run_agent }}
dry_run: ${{ inputs.dry_run }}
max_turns: ${{ inputs.max_turns }}
time_budget_ms: ${{ inputs.time_budget_ms }}
secrets:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ACCESS_TOKEN: ${{ secrets.PUBLISH_TOKEN || github.token }}
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ The consumer API is product-level. Consumer repositories configure the documenta
| `model` | `gpt-5.5` | OpenAI model id for the live run. Defaults to the WP Codebox contract default, so omitting it changes nothing. |
| `run_agent` | `true` | Set `false` to skip after deterministic preflight says docs are current. |
| `dry_run` | `false` | Set `true` to validate the prepared task without starting a live agent run. |
| `max_turns` | `40` | Maximum agent turns. WP Codebox defaults to 12, which a large source tree can use up on reading before any write. |
| `time_budget_ms` | `1800000` | Agent run time budget in milliseconds. |

`verification_commands` and `drift_checks` are executable caller inputs. Docs Agent appends its own completion-contract check as a separate drift entry after them. The target repository remains the only writable PR boundary.

Expand Down
4 changes: 3 additions & 1 deletion tests/validate-wp-codebox-run-agent-task-contract.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
$input = $contract['inputs'][ $name ] ?? null;
$assert( is_array( $input ), "Docs Agent passes producer input {$name}, which is absent from the producer schema." );
$type = $input['type'] ?? null;
$actual_type = preg_match( '/^(true|false)$/', $value ) === 1 || in_array( $name, array( 'success_requires_pr', 'run_agent', 'dry_run' ), true ) ? 'boolean' : ( is_numeric( $value ) ? 'number' : 'string' );
$actual_type = preg_match( '/^(true|false)$/', $value ) === 1 || in_array( $name, array( 'success_requires_pr', 'run_agent', 'dry_run' ), true ) ? 'boolean' : ( is_numeric( $value ) || in_array( $name, array( 'max_turns', 'time_budget_ms' ), true ) ? 'number' : 'string' );
$assert( $type === $actual_type, "Docs Agent input {$name} has {$actual_type} shape; producer requires {$type}." );
}

Expand Down Expand Up @@ -217,6 +217,8 @@
$assert( preg_match( '/secrets:\n(?: [A-Z_]+:\n(?: .*\n)* required: (?:true|false)\n)* EXTERNAL_PACKAGE_SOURCE_POLICY:\n(?: .*\n)* required: true/m', $workflow ) === 1, 'Docs Agent must require EXTERNAL_PACKAGE_SOURCE_POLICY from reusable-workflow callers.' );
$assert( '${{ inputs.run_agent }}' === ( $caller_inputs['run_agent'] ?? null ), 'Docs Agent must delegate run_agent so WP Codebox reports deterministic skipped status.' );
$assert( '${{ inputs.dry_run }}' === ( $caller_inputs['dry_run'] ?? null ), 'Docs Agent must delegate dry_run so WP Codebox validates without starting a live run.' );
$assert( '${{ inputs.max_turns }}' === ( $caller_inputs['max_turns'] ?? null ), 'Docs Agent must delegate max_turns; the producer default of 12 turns ends source-heavy runs before any write.' );
$assert( '${{ inputs.time_budget_ms }}' === ( $caller_inputs['time_budget_ms'] ?? null ), 'Docs Agent must delegate time_budget_ms alongside max_turns.' );
$assert( preg_match( '/validation_dependencies:\n description: Optional caller-owned command that installs dependencies needed before validation\.\n type: string\n default: ""/', $workflow ) === 1, 'Docs Agent must expose validation_dependencies as an optional empty-string reusable-workflow input.' );
$assert( preg_match( '/require_pr:\n description: Require a published target-repository pull request for successful maintenance\.\n type: boolean\n default: false/', $workflow ) === 1, 'Docs Agent must expose require_pr as an optional boolean reusable-workflow input.' );
$assert( preg_match( '/\n if: inputs\.run_agent\n/', $workflow ) !== 1, 'Docs Agent must not skip the producer job outside the producer contract.' );
Expand Down
Loading