Skip to content

Standardize to using runAbility to call our Abilities#228

Merged
jeffpaul merged 6 commits intoWordPress:developfrom
dkotter:update/run-ability-utility
Mar 3, 2026
Merged

Standardize to using runAbility to call our Abilities#228
jeffpaul merged 6 commits intoWordPress:developfrom
dkotter:update/run-ability-utility

Conversation

@dkotter
Copy link
Collaborator

@dkotter dkotter commented Feb 12, 2026

What?

Move from using apiFetch to using our custom runAbility utility function (introduced here) to call our Abilities in our UI code.

Why?

Ensures our codebase is standardized (no more fractured code that uses apiFetch in some places and runAbility in others.

Also ensures the Abilities JS API is used when available, falling back to using apiFetch otherwise.

How?

  • Updates Title Generation, Excerpt Generation and Content Summarization Abilities to use runAbility and remove the direct use of apiFetch
  • Removes the now unused path JS localized data

Use of AI Tools

Used Cursor (running Composer 1.5) to give a first pass on making this change with final changes, plus review and testing, done by me

Testing Instructions

  1. Add valid AI Credentials
  2. Turn on Title Generation, Excerpt Generation and Content Summary Experiments
  3. Test each individual Experiment and ensure they still work
Open WordPress Playground Preview

@dkotter dkotter self-assigned this Feb 12, 2026
@github-actions
Copy link

github-actions bot commented Feb 12, 2026

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.

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

Co-authored-by: dkotter <dkotter@git.wordpress.org>
Co-authored-by: gziolo <gziolo@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.

@codecov
Copy link

codecov bot commented Feb 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.76%. Comparing base (7777b06) to head (356401f).
⚠️ Report is 38 commits behind head on develop.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #228      +/-   ##
=============================================
+ Coverage      56.69%   56.76%   +0.06%     
  Complexity       505      505              
=============================================
  Files             32       32              
  Lines           2568     2565       -3     
=============================================
  Hits            1456     1456              
+ Misses          1112     1109       -3     
Flag Coverage Δ
unit 56.76% <ø> (+0.06%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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.

@dkotter dkotter added this to the 0.4.0 milestone Feb 12, 2026
@jeffpaul jeffpaul moved this to Needs review in WordPress AI Planning & Roadmap Feb 12, 2026
@jeffpaul jeffpaul modified the milestones: 0.3.1, 0.4.0 Feb 17, 2026
@gziolo
Copy link
Member

gziolo commented Feb 23, 2026

I reviewed code changes, and they look good. I wanted to test with the latest changes on trunk, but it looks like the plugin is incompatible with WP trunk after the WP AI client landed there on Friday.

@gziolo
Copy link
Member

gziolo commented Feb 23, 2026

I tested against the latest stable WP version and there was an error when generating the title:

Screenshot 2026-02-23 at 10 07 30

I can confirm that generating the excerpt and summary works as expected.

@dkotter
Copy link
Collaborator Author

dkotter commented Feb 23, 2026

I wanted to test with the latest changes on trunk, but it looks like the plugin is incompatible with WP trunk after the WP AI client landed there on Friday.

Yeah, have a few PRs open tracking this (#242, #249), though I think there are changes coming upstream we'll need to pull in.

I tested against the latest stable WP version and there was an error when generating the title:

I know there's an issue with OpenAI when running against the latest version of the WP AI Client, as we switch from the Chat Completions API to the Responses API and that no longer supports the n parameter, but that shouldn't impact you on the latest stable version of WP.

I just tested again on WP 6.9.1 and title generation works fine with both OpenAI and Google, I don't have an Anthropic key to test with though. Curious which AI provider you're using?

@gziolo
Copy link
Member

gziolo commented Feb 24, 2026

just tested again on WP 6.9.1 and title generation works fine with both OpenAI and Google, I don't have an Anthropic key to test with though. Curious which AI provider you're using?

I used Antrophic key, so that would have to be fixed independently 👍🏻

@dkotter
Copy link
Collaborator Author

dkotter commented Feb 24, 2026

I used Antrophic key, so that would have to be fixed independently 👍🏻

Curious if you can test on the latest release of this plugin if it works? I would assume you'd get the same error as that shouldn't be something changed in this PR

@gziolo
Copy link
Member

gziolo commented Mar 2, 2026

Curious if you can test on the latest release of this plugin if it works? I would assume you'd get the same error as that shouldn't be something changed in this PR

Yes, the issue isn't tied to this branch. I also see an error when testing with the AI experiments plugin installed on regular website:

Error: Error generating titles: The response is not a valid JSON response.

@jeffpaul jeffpaul merged commit 6a6eafa into WordPress:develop Mar 3, 2026
18 of 24 checks passed
@github-project-automation github-project-automation bot moved this from Needs review to Done in WordPress AI Planning & Roadmap Mar 3, 2026
@jeffpaul
Copy link
Member

jeffpaul commented Mar 3, 2026

I'll open a follow-up issue shortly for the bug noted above.

@jeffpaul
Copy link
Member

jeffpaul commented Mar 3, 2026

Done, see: #264.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants