Repository navigation
Limit comment moderation bulk analysis queue size - #972
Conversation
The plugin bounds AI bulk actions with get_bulk_action_max_items(), which alt text generation and summarization both use. Comment moderation registered a bulk action but queued every selected comment, so a large selection could queue far more analyses than that shared limit allows. Validate the selected comments first so stale IDs cannot consume slots, then apply the limit, and report any comments left out through the existing admin notice.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #972 +/- ##
=============================================
+ Coverage 74.52% 74.57% +0.04%
- Complexity 3124 3132 +8
=============================================
Files 132 132
Lines 12193 12213 +20
=============================================
+ Hits 9087 9108 +21
+ Misses 3106 3105 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
dkotter
left a comment
There was a problem hiding this comment.
Thanks for the PR! Overall this looks good and works as expected just have two things that I think we should add here:
- We strip query args on the client-side (see
clearQueuedAnalysisQueryArg) and we should likely extend that to remove the newwpai_analysis_truncatedquery arg. That query arg could end up being left in the URL otherwise - We should look to update our docs around this experiment to mention this new limit and how to change the limit
`clearQueuedAnalysisQueryArg()` removed only `wpai_analysis_queued`, so `wpai_analysis_truncated` could be left behind in the URL. It now removes both, and the early return checks for either arg so a URL carrying only the truncated arg is cleaned as well. Document the cap in the Comment Moderation experiment docs, covering the default of 100 and the `wpai_bulk_action_max_items` filter with the `comment-moderation` feature id. The Alt Text docs already described the shared filter, so that sentence now mentions Comment Moderation too.
|
Thanks for the review. I pushed a follow-up commit addressing both points.
I added an "Adjusting the Bulk Batch Cap" section to the Comment Moderation docs, including the default limit, the |
Description
The plugin bounds AI bulk actions with
get_bulk_action_max_items(), a filterable, feature-keyed limit that defaults to 100. Alt text generation and summarization both use it. Comment moderation registers a bulk action but does not, so it marks every selected comment as pending regardless of how many were selected.Each pending comment becomes a model call once it is analyzed, which is the same reason the other two bulk actions are bounded.
Changes
get_bulk_action_max_items()to its bulk action.wpai_analysis_truncatedis registered as a removable query arg and scrubbed from the request URI, matching the existing notice args.Testing
npm run test:php -- --filter Comment_ModerationTestpasses with 31 tests and 130 assertions. Three new tests cover the limit, deduplication, and invalid IDs not consuming slots, plus one covering the notice when comments were left out but none were queued.Manual wp-admin verification was performed with a temporary local filter that set the Comment Moderation bulk limit to 2 and satisfied the credential gate. Selecting 5 comments and running the real bulk action queued 2 comments, left 3 untouched, showed a warning notice for the truncated count, and scrubbed the notice query args after load.