Skip to content

Keep a finished docs review from resetting to queued on the PR menu - #8827

Merged
theletterf merged 2 commits into
mainfrom
fix/pr-ai-menu-completed-status
Oct 14, 2026
Merged

theletterf merged 2 commits into
mainfrom
fix/pr-ai-menu-completed-status

Conversation

@theletterf

@theletterf theletterf commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Summary

The AI PR menu keeps a finished docs review's status after a push, and it says Status: completed, no findings. when the review posted only its summary comment.

Why

The menus on #8742, #8757, and #8208 all said Status: queued. although the reviews posted. The edit history of each menu comment shows the same sequence. The post-review job writes Status: completed.. Between 6 and 30 minutes later, a push triggers the Post or refresh AI PR menu job through Docs PR AI menu (collect). That job refreshes the menu with no status override and finds no Docs AI check run on the PR head commit, and getStatusText has no fallback to the status already in the comment, so it writes Status: queued.. The issue menu script has that fallback.

PR completed reset to queued
#8742 Oct 8 12:16:02 and 12:46:06 UTC 12:22:18 and 12:56:12
#8757 Oct 9 08:56:00 09:22:05
#8208 Sep 22 14:41:54 and 15:30:24 14:50:54 and 15:57:31

The two reviews that looked like they never ran, #8186 and #8385, did run. A review with no findings posts its "Docs review summary" as a regular PR comment, not as a PR review. The menu stayed on "queued", so nothing showed that the review had finished.

What

A finished status survives a refresh

getStatusText in .github/scripts/docs_pr_ai_menu.cjs keeps the status already in the comment when the box is ticked and the status is neither "not started" nor "queued". An unticked menu still reads "not started", and an explicit override still wins.

The menu shows the outcome of a finished review

getDocsReviewOutcome looks at what github-actions[bot] posted since the box was ticked, using the menu comment's updated_at from the event payload as the start time. A PR review means findings, so the text stays Status: completed.. A "## Docs review summary" issue comment and no review means no findings, so the text becomes Status: completed, no findings.. upsertMenuComment runs this only for a successful completed override, so a failed or cancelled job makes no API calls. If the lookup throws, the menu falls back to Status: completed. with a warning. No change to docs-pr-ai-menu.yml is needed.

Out of scope: A run that leaves nothing visible, for example a noop when no markdown file is eligible, still shows Status: completed.. I cannot tell it apart from a silent failure. #8385 run 1 is such a run. The status also stays "completed" after a later push, even if the new commit has not been reviewed. The check-run lookup on the PR head commit is unchanged.

Verify

Tested with local Node checks, which are not committed. I ran the script from main and from this branch through upsertMenuComment with a mocked GitHub client and a real menu body from #8742.

# no findings: bot posted only the summary comment
  main   Status: completed.
  now    Status: completed, no findings.
# findings: bot submitted a PR review
  now    Status: completed.
# old summary comment from an earlier run only (before the tick)
  now    Status: completed.
# nothing posted (noop or silent run)
  now    Status: completed.
# failed / cancelled review job
  now    Status: needs attention. / Status: cancelled.   (no API calls)
# classification API error
  now    Status: completed.   (warning logged)
# later refresh (push, no override) on a "completed, no findings" menu
  main   Status: queued.
  now    Status: completed, no findings.

The six cases from the previous commit give the same text before and after this commit. I also ran the real getDocsReviewOutcome against live PRs, with the start time set to the tick time from each menu's edit history and the data cut off when the run completed:

Run Result Menu text
#8186, Sep 3 (summary comment only) no findings completed, no findings
#8385 run 1, Sep 18 18:11 (nothing visible) none completed
#8385 run 2, Sep 18 18:38 (summary comment only) no findings completed, no findings
#8742 runs 1 and 2, Oct 8 (PR review) findings completed
#8757, Oct 9 (PR review) findings completed

I read these PRs before I wrote down what each run should return, so this shows that the logic reproduces what I saw. It is not an independent test.

Not tested: the workflows themselves, the github.paginate calls in a real github-script step, and whether context.payload.comment.updated_at equals the tick time in a live issue_comment event. The comparison reads that field and not the review's start time.

Related to elastic/docs-eng-team#1035

Generative AI disclosure

  1. Did you use a generative AI (GenAI) tool to assist in creating this contribution?
  • Yes

Tool(s) and model(s) used: Claude Code (Claude Sonnet 5.5)

🤖 Generated with Claude Code

A refresh after a push passes no status override and finds no check run on the
PR head commit, so the menu fell back to "Status: queued." and replaced the
completed status. The menu now keeps the status already in the comment.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@github-actions

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 marked this pull request as ready for review October 13, 2026 15:55
@theletterf
theletterf requested a review from a team as a code owner October 13, 2026 15:55
@theletterf
theletterf requested a review from technige October 13, 2026 15:55
@theletterf

Copy link
Copy Markdown
Member Author

@bmorelli25 This fixes one of the issues identified by @vishaangelova. Could you approve?

A review with no findings posts its summary as a regular PR comment, not as a
PR review, so the menu gave no sign that the review had run. After a successful
review the menu now checks what the bot posted since the box was ticked and
reads "Status: completed, no findings." when only the summary comment exists.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@theletterf
theletterf added this pull request to the merge queue Oct 14, 2026
Merged via the queue into main with commit 67467f9 Oct 14, 2026
12 checks passed
@theletterf
theletterf deleted the fix/pr-ai-menu-completed-status branch October 14, 2026 09:51
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.

2 participants