Skip to content

docs-quality-sweep: replace uses: orchestrator with gh workflow run master - #6271

Merged
theletterf merged 1 commit into
mainfrom
add-quality-sweep-master-pattern
May 5, 2026
Merged

theletterf merged 1 commit into
mainfrom
add-quality-sweep-master-pattern

Conversation

@theletterf

Copy link
Copy Markdown
Member

Summary

Refactors the docs-quality-sweep installation to work around github/gh-aw#30338.

The current orchestrator (merged via #6255) uses workflow_call to fan out to seven gh-aw reusable workflows in parallel. gh-aw v0.71.x derives a single artifact prefix per orchestrator run from github.workflow + github.run_id, both of which are identical for every reusable workflow_call invocation in one run. Result: all seven sub-workflows upload and download the same <prefix>-activation.zip and <prefix>-agent.zip. Last activation wins the race; every agent loads the same prompt. Three of the seven fix-issues from the first run came back with frontmatter-audit findings regardless of which sweep was supposed to run (#6266 / #6267 / #6268).

Until upstream lands a fix, this PR dispatches each sweep as its own independent workflow run.

New layout

File Role
docs-quality-sweep.yml (modified) Master dispatcher. Triggers on workflow_dispatch. One job that uses gh workflow run to fire each selected sub-workflow. Exits in seconds.
docs-frontmatter-sweep.yml (new) Calls elastic/docs-actions/.github/workflows/gh-aw-docs-frontmatter-sweep.lock.yml@v1.
docs-applies-to-sweep.yml (new) Calls the applies-to reusable.
docs-openings-sweep.yml (new) Calls the openings reusable.
docs-style-sweep.yml (new) Calls the style reusable.
docs-typos-sweep.yml (new) Calls the typos reusable.
docs-staleness-sweep.yml (new) Calls the staleness reusable.
docs-coherence-sweep.yml (new) Calls the coherence reusable.

Each sub-workflow has its own `github.workflow` and its own `github.run_id`, so the artifact prefix gh-aw computes is now distinct per sweep — no collision.

UX

gh workflow run docs-quality-sweep.yml -f sweeps=all still works as the single dispatch point. The master prints `→ dispatching docs--sweep.yml` for each selected sweep and exits in a few seconds; the sub-runs appear separately in the Actions tab.

Selective dispatch still works via the `sweeps` input:

```bash
gh workflow run docs-quality-sweep.yml -f sweeps=frontmatter,typos
```

Sub-workflows can also be dispatched directly without going through the master, e.g. for retrying just one sweep:

```bash
gh workflow run docs-style-sweep.yml
```

That wasn't possible with the previous `workflow_call` orchestrator.

Why `GITHUB_TOKEN` is enough

`workflow_dispatch` and `repository_dispatch` are explicit exceptions to the "GITHUB_TOKEN can't trigger workflows" rule (per the GitHub Actions docs). The master uses the auto-provided token; no PAT or App token needed. The master itself only needs `actions: write`; the sub-workflows retain `actions: read` + `issues: write` for fix-issue creation.

Trade-offs vs. the old orchestrator

old (`uses:`) new (`gh workflow run`)
Single dispatch point ✓ ✓
Artifact-name isolation ❌ collides (gh-aw#30338) ✓ each sub-run independent
Visible as one workflow run ✓ master + 7 separate sub-runs
Per-sweep retry without re-running everything ❌ ✓
`sweeps=…` filter ✓ ✓
Number of files in this repo 1 8

The 8-file footprint is the only real regression and it's bounded — they're trigger templates, not maintained logic.

Test plan

  • Merge this PR.
  • Dispatch `docs-quality-sweep.yml` with `sweeps=typos` (cheapest, no APM). Confirm the master run finishes in under a minute and a separate `Docs typos sweep` run appears in the Actions tab.
  • Confirm the new typos issue lands here (no longer capped at 20 — should reflect ~all codespell findings once docs-actions PR #132 ships).
  • Dispatch with `sweeps=frontmatter,style`. Confirm two separate sub-runs appear, each with distinct artifact names (`-activation.zip` for frontmatter, `-activation.zip` for style — verify in the agent step logs).
  • Confirm the resulting two fix-issues have distinct content — frontmatter findings in the frontmatter issue, style findings in the style issue. This is the regression we're trying to fix.
  • Once happy, dispatch with `sweeps=all` and confirm seven sub-runs each produce a category-correct fix-issue.

Related

  • gh-aw issue: github/gh-aw#30338
  • docs-actions PR adding the underlying sweep prompts: elastic/docs-actions#132 (open) — improves the per-sweep output once the agent prompts are no longer cross-contaminating.

🤖 Generated with Claude Code

…n` master

Refactors the docs-quality-sweep installation to work around
[github/gh-aw#30338](github/gh-aw#30338) — the
gh-aw compiler derives a single artifact prefix per orchestrator run
from `github.workflow + github.run_id`, both of which are identical
for every reusable workflow_call invocation in a single run. As a
result, all seven sub-workflows uploaded and downloaded the same
`<prefix>-activation.zip` and `<prefix>-agent.zip`. Last activation
won the race; every agent loaded the same prompt; three of the seven
fix-issues from the first end-to-end run came back with
frontmatter-audit findings regardless of which sweep ran them
(#6266 / #6267 / #6268).

Until upstream fixes that, dispatch each sweep as its own GH workflow
run. New layout:

- `docs-quality-sweep.yml` (master) — kept the user-facing name. Now
  triggers on `workflow_dispatch` and uses `gh workflow run` to
  dispatch each selected sub-workflow. Each sub-run is a separate GH
  Actions run, with its own `github.run_id` and `github.workflow`,
  so artifact names no longer collide.
- `docs-{frontmatter,applies-to,openings,style,typos,staleness,coherence}-sweep.yml`
  (seven new files) — each is a thin trigger template that calls
  the corresponding `elastic/docs-actions/.github/workflows/gh-aw-docs-<name>-sweep.lock.yml@v1`
  via `workflow_call`. Identical to what the orchestrator job blocks
  used to do, except now they're independent dispatchable workflows.

UX:

- `gh workflow run docs-quality-sweep.yml -f sweeps=all` still works.
  It prints "→ dispatching docs-<name>-sweep.yml" for each selected
  sweep and exits in seconds. The sub-runs appear separately in the
  Actions tab.
- `gh workflow run docs-quality-sweep.yml -f sweeps=frontmatter,typos`
  still filters.
- Individual sub-workflows can also be dispatched directly without
  going through the master, e.g. for retrying just one sweep
  (`gh workflow run docs-style-sweep.yml`) without re-running
  everything.

Permissions: the master needs `actions: write` to dispatch sibling
workflows; sub-workflows keep `actions: read` and only need
`issues: write` for fix-issue creation. `GITHUB_TOKEN` is sufficient
to fan out via `gh workflow run` because `workflow_dispatch` is an
explicit exception to the "GITHUB_TOKEN can't trigger workflows"
rule (per GitHub Actions docs).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@theletterf
theletterf requested a review from a team as a code owner May 5, 2026 11:18
@theletterf
theletterf requested a review from technige May 5, 2026 11:18
@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

Elastic Docs AI PR menu

Check the box to run an AI review for this pull request.

  • Review docs changes (docs-review). Status: not started.

Powered by GitHub Agentic Workflows and docs-actions. For more information, reach out to the docs team.

@theletterf
theletterf merged commit 851fa35 into main May 5, 2026
11 checks passed
@theletterf
theletterf deleted the add-quality-sweep-master-pattern branch May 5, 2026 11:19
theletterf added a commit that referenced this pull request May 5, 2026
## Summary

The master dispatcher introduced in #6271 fails on the first `gh
workflow run` invocation:

\`\`\`
→ dispatching docs-frontmatter-sweep.yml
failed to run git: fatal: not a git repository (or any of the parent
directories): .git
##[error]Process completed with exit code 1.
\`\`\`

Failing run:
https://github.com/elastic/docs-content/actions/runs/25373495676/job/74402614432

## Cause

`gh workflow run` resolves the target repository from the local git
remote when no `--repo` flag is given. The master skips
`actions/checkout` deliberately — it's a thin dispatcher that doesn't
need the source tree — so there's no `.git` directory and the command
exits 1 before doing anything.

## Fix

Add `--repo "${{ github.repository }}"` to all four `gh workflow run`
invocations (the `fire_with_default_inputs` helper plus the typos /
staleness / coherence blocks). The runtime expression `${{
github.repository }}` resolves to `elastic/docs-content`, so gh CLI
skips the local-remote inference entirely.

Same effect as adding `actions/checkout@v6` to the step but cheaper — no
clone, no filesystem I/O for what's a sub-second dispatch script.

## Test plan

- [ ] Merge.
- [ ] Dispatch `docs-quality-sweep.yml` with `sweeps=typos`. Expect:
- master finishes in seconds with `→ dispatching docs-typos-sweep.yml`
printed (no "fatal: not a git repository");
  - a separate `Docs typos sweep` run appears in the Actions tab.
- [ ] Dispatch with `sweeps=all`. Expect seven sub-runs in the Actions
tab, each independent.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
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.

1 participant