Skip to content

rc-docs-sync: defer to open documentation PRs instead of duplicating - #399

Merged
enricobattocchi merged 1 commit into
mainfrom
rc-docs-sync-defer-to-open-prs
May 11, 2026
Merged

rc-docs-sync: defer to open documentation PRs instead of duplicating#399
enricobattocchi merged 1 commit into
mainfrom
rc-docs-sync-defer-to-open-prs

Conversation

@enricobattocchi

Copy link
Copy Markdown
Member

Summary

PR #391 was opened on 2026-04-28 to document the wp yoast auth CLI namespace from Yoast/wordpress-seo#23130. That upstream feature merged today (2026-05-11). When 27.7-RC1 is cut, the sync workflow would see the new WP_CLI::add_command(...) calls, invoke the agent, and the agent would open a competing PR for docs/features/wp-cli/auth.md — duplicating #391's work and creating a merge race.

This PR teaches the workflow + agent to defer to pre-documentation PRs rather than duplicate them.

What changed

  1. Workflow — new Fetch recent open documentation PRs in this repo step (runs when any_content == 'true'). Uses gh pr list with is:open is:pr -label:rc-doc-sync updated:>=<30 days ago>, keeps only PRs touching docs/** or sidebars.js, and writes the result to $BUNDLE_DIR/open-doc-prs.json.

  2. Agent prompt (run.md) — new Step 1.7 — Defer to open documentation PRs between Step 1.6 and Step 2. The agent reads open-doc-prs.json; for any PR plan whose files overlap a listed PR (excluding sidebars.js-only overlap, which is normal cross-cut), or whose area is mentioned in the listed PR's title/body, the agent:

    • Does NOT open a new PR for that plan.
    • Comments on the existing PR with this RC's source evidence (file:line + symbol names + run URL).
    • Notes the deferral in the run summary under a new Overlapped with open PRs section.

Plus minor: Context available in this run now lists open-doc-prs.json, and Step 4 mentions the new run-summary section.

Validation

What was NOT validated: the agent's Step 1.7 reasoning itself (can't run the agent locally without spending budget). Will get its real-world test on 27.7-RC1.

Risk and mitigation

  • False-positive overlap (an unrelated PR happens to touch the same file): the deferred plan posts a comment on the existing PR — the human can ignore it. Worst case: a maintainer realises the overlap was bogus and opens a follow-up PR. Mild annoyance, not a blocker.
  • sidebars.js-only overlap: the prompt explicitly tells the agent to not treat this as overlap (sidebars.js is co-edited by almost every doc PR). Eventual merge order resolves the navigation entries.
  • Stale open PR slips through: the workflow filters to updated >= 30 days ago, so an abandoned-but-not-closed PR drops out naturally.

Test plan

🤖 Generated with Claude Code

PR #391 was opened on 2026-04-28 to document the wp yoast auth CLI namespace
(Yoast/wordpress-seo#23130). The upstream feature merged today; when 27.7-RC1
is cut, the sync workflow would otherwise see register-rest-route /
WP_CLI::add_command calls, invoke the agent, and open a duplicate PR for
docs/features/wp-cli/auth.md — directly competing with #391.

Two changes solve this generally:

1. Workflow: new "Fetch recent open documentation PRs in this repo" step
   that runs when any_content==true. Uses `gh pr list` with a search filter
   (open, not labeled rc-doc-sync, updated within 30 days), keeps only PRs
   that touch docs/** or sidebars.js, and writes the result to
   $BUNDLE_DIR/open-doc-prs.json. Verified locally against the current
   repo state: returns 3 PRs including #391 with the expected files list.

2. Agent prompt (run.md): new Step 1.7 — Defer to open documentation PRs.
   Between Step 1.6 (internal-surface discrimination) and Step 2 (authoring),
   the agent reads open-doc-prs.json. For any PR plan whose files overlap a
   listed PR (excluding sidebars.js-only overlap, which is normal cross-cut),
   or whose area is mentioned by the listed PR's title/body, the agent
   comments on the existing PR with source-evidence + RC tag + run URL,
   instead of opening a duplicate. Deferrals are listed under a new
   "Overlapped with open PRs" section in the run summary (Step 4).

The "Context available in this run" section is updated to mention the new
file, and Step 4's run-summary structure now includes the new heading.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@enricobattocchi
enricobattocchi merged commit 6ff9526 into main May 11, 2026
1 check was pending
@enricobattocchi
enricobattocchi deleted the rc-docs-sync-defer-to-open-prs branch May 11, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant