Skip to content

Experiment: Add Generate block labels experiment - #1175

Merged
dkotter merged 28 commits into
WordPress:developfrom
Infinite-Null:experiment/generate-ai-block-labels-list-view
Oct 21, 2026
Merged

dkotter merged 28 commits into
WordPress:developfrom
Infinite-Null:experiment/generate-ai-block-labels-list-view

Conversation

@Infinite-Null

@Infinite-Null Infinite-Null commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What?

Closes #951

Introduces a new experiment, "Label Generation", which uses AI to generate concise, descriptive labels for container blocks in the WordPress Block Editor.

Why?

Long and highly structured posts or pages often contain dozens of container blocks that appear as generic, repetitive items in List View. This makes page skimming and navigation cumbersome.

Generating purposeful block labels (such as "Customer Testimonials" or "Pricing & Plans") without modifying the visible content streamlines document navigation for content creators and editorial teams.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Sonnet 4.6
Used for: Validating bug, suggesting a fix.

Testing Instructions

Prerequisites

  1. Ensure you have an active AI connector configured with a text generation model (e.g. Google or OpenAI).
  2. Go to AI > Experiments and enable the Label Generation experiment.

Test Block List View Generation:

  1. Create or edit a post/page and add multiple container blocks with content (e.g., several Group blocks containing paragraphs or headings).
  2. Open the List View in the editor toolbar.
  3. In the List View sidebar header, click the "Generate block labels" button.
  4. Verify that each container block's label updates in List View to reflect its content (e.g., "Group" changes to a descriptive summary).

Test Block Rename Modal:

  1. Select a block (e.g., a Group block with text content).
  2. Open the block options menu (three dots) and select Rename.
  3. In the Rename modal, click the "Generate label" button.
  4. Verify the label input field is populated with a generated label.
  5. Click Save and verify the label appears in List View.

Screenshots or screencast

List View

Screen.Recording.2026-10-14.at.12.12.15.PM.mov

Rename Block

Screen.Recording.2026-10-15.at.3.03.06.PM.mov

Changelog Entry

Added - "Label Generation" experiment to generate concise block labels in List View and the block Rename modal.

Props

Props @yogeshbhutkar for the initial code and exploration on this experiment.

Open WordPress Playground Preview

@codecov

codecov Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.28058% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 84.18%. Comparing base (c8dde71) to head (57fad84).

Files with missing lines Patch % Lines
..._Container_Label_Generation/system-instruction.php 50.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #1175      +/-   ##
=============================================
+ Coverage      84.03%   84.18%   +0.15%     
- Complexity      3666     3689      +23     
=============================================
  Files            144      147       +3     
  Lines          13846    13985     +139     
=============================================
+ Hits           11635    11773     +138     
- Misses          2211     2212       +1     
Flag Coverage Δ
unit 84.18% <99.28%> (+0.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Infinite-Null
Infinite-Null marked this pull request as ready for review October 20, 2026 13:29
@Infinite-Null
Infinite-Null requested a review from a team October 20, 2026 13:29
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

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 props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @georgestephanis.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: georgestephanis.

Co-authored-by: Infinite-Null <ankitkumarshah@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>
Co-authored-by: yogeshbhutkar <yogeshbhutkar@git.wordpress.org>
Co-authored-by: jeffpaul <jeffpaul@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@Infinite-Null

Copy link
Copy Markdown
Contributor Author

Hi @dkotter, @jeffpaul, and @yogeshbhutkar! I’ve completed the implementation for this PR. The PR is now ready for review. I’d really appreciate it if you could take a look when you get a chance. Thanks!

@dkotter dkotter left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a handful of comments but let me know if you have questions on any of those.

Beyond those things, also a few other things I've noticed:

  • Should add the experiment documentation here, matching our other experiments
  • If a post has no container blocks, the button shows but when clicked it does nothing. Would be great to have better error handling here, either don't show the button, show it as disabled or give an error when clicked and nothing needs processing
  • If I switch from the List view to the Outline view and then back, the button never reattaches

Comment thread includes/Abilities/Label_Generation/Label_Generation.php Outdated
Comment thread includes/Abilities/Label_Generation/Label_Generation.php Outdated
Comment thread includes/Abilities/Label_Generation/Label_Generation.php Outdated
Comment thread includes/Abilities/Label_Generation/Label_Generation.php Outdated
Comment thread includes/Abilities/Label_Generation/Label_Generation.php Outdated
Comment thread src/experiments/label-generation/components/LabelGenerationListViewHeader.tsx Outdated
Comment thread src/experiments/label-generation/hooks/useLabelGeneration.ts Outdated
Comment thread includes/Abilities/Label_Generation/system-instruction.php Outdated
Comment thread includes/Abilities/Label_Generation/Label_Generation.php Outdated
@Infinite-Null

Infinite-Null commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Left a handful of comments but let me know if you have questions on any of those.

Beyond those things, also a few other things I've noticed:

  • Should add the experiment documentation here, matching our other experiments
  • If a post has no container blocks, the button shows but when clicked it does nothing. Would be great to have better error handling here, either don't show the button, show it as disabled or give an error when clicked and nothing needs processing
  • If I switch from the List view to the Outline view and then back, the button never reattaches

Hi @dkotter, thank you for the feedback! I’ve addressed the comments and fixed the issues you pointed out. I also missed adding the experiment documentation initially 😅, which has now been added.

The updates are pushed, and the PR is ready for another review. I’d really appreciate it if you could take another look when you get a chance. Thank you!

@Infinite-Null
Infinite-Null requested a review from dkotter October 21, 2026 08:39
@dkotter dkotter added this to the 1.5.0 milestone Oct 21, 2026

@dkotter dkotter left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed a handful of additional fixes for things I saw in my last review but this looks good to go now.

A potential follow up would be to consider generating labels based on the entire document instead of the content within a container. For instance, a container label like Hero Section is probably more useful than a label that describes the content within that section, and I think right now the results we get lean towards the latter.

@dkotter
dkotter merged commit e53e66c into WordPress:develop Oct 21, 2026
36 checks passed
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.

New Experiment: Generate AI block labels in List View

2 participants