Skip to content

Jetpack AI: Add AI feature toggles UI - #50386

Open
ariskataoka wants to merge 44 commits into
trunkfrom
add/jetpack-ai-feature-toggles
Open

Jetpack AI: Add AI feature toggles UI#50386
ariskataoka wants to merge 44 commits into
trunkfrom
add/jetpack-ai-feature-toggles

Conversation

@ariskataoka

@ariskataoka ariskataoka commented Jul 10, 2026

Copy link
Copy Markdown
Member

Fixes related to #FORNO-391

Proposed changes

  • The Jetpack AI admin page now has two tabs: Features (new, default) and MCP Settings (everything that was already there, unchanged).
  • Features lets you toggle each AI feature on/off — Writing Assistant, Image Editor (with Feature Clip nested beneath it), AI SEO — grouped per the design, backed by the feature-settings endpoint from Jetpack AI: Add feature settings controls #50287.
  • Feature Clip is nested under Image Editor with an "Experimental Preview" badge — still experimental, scoped to Image Studio for now (revisit at GA). It depends on the Image Editor (shared bundle): with Image Editor off, the Clip child greys out (keeping its saved value) and its "Try it out" link is withheld. The backend (Jetpack AI: Add feature settings controls #50287) enforces the same dependency.
  • Action links follow the toggle state per the design: "Try it out" when a feature is on, "Learn more" when it's off (SEO shows 'Open SEO Settings' when on, 'Learn more' when off.
  • Also fixes hash deep links (#/features etc.) rendering the wrong view on fresh loads.

A few judgment calls to sanity-check in review: Features is the default landing tab now; the "Mark images as AI-generated" sub-toggle was dropped with a later re-scope (the mockups predate it); Excerpt is bundled under Writing Assistant per the backend contract — no separate row; the "Learn more" links reuse existing Jetpack AI support targets — happy to swap if design has specific destinations.

Screenshots

Features tab — default state (self-hosted, free plan)
01-features-default

More states: master off · Atomic/SEO · host gate · save error

Master switch off — saved values kept but greyed, links hidden

03-master-off

Atomic — SEO enabled with "Open SEO Settings"; AI Search "Requires upgrade" (plan entitled, Search not set up)

04-seo-enabled-search-upgrade

Host gate off (WP_AI_SUPPORT false) — notice only, no upsell

Host gate off (WP_AI_SUPPORT false): only a notice, no toggles, no upsell

AI SEO available but off — row visible with "Learn more"

05-seo-available-off

AI Search available (paid Search) — no badge, toggle usable, "Open Search Settings"

05-seo-available-off

** Image Editor off **

02-image-editor-off

Failed save — dismissible error, view stays usable
07-failed-save

Related product discussion/links

Does this pull request change what data or activity we track or use?

One new Tracks event: jetpack_ai_feature_toggled (feature, enabled). jetpack_mcp_settings_viewed now fires on viewing the MCP tab instead of every page load.

Testing instructions

  • Check out the branch, jetpack build plugins/jetpack, open Jetpack → AI.
  • You should land on the Features tab. Switch a feature off (e.g. Writing Assistant) and confirm it persisted: wp option get jetpack_ai_writing_assistant_enabled should now be empty, and the toggle should still be off after a reload. Switch it back on.
  • Toggle Image Editor off — its link should change from "Try it out" to "Learn more".
  • Check the MCP Settings tab still behaves exactly as before, including Read/Write/Setup.
  • Try #/features, #/mcp, #/read as direct links, plus browser back/forward.
  • Feature Clip nesting: with Image Editor on, confirm Feature Clip renders as an indented child with an "Experimental Preview" badge. Turn Image Editor off (wp option update jetpack_ai_image_editor_enabled 0, reload) — the Clip child greys but keeps its saved value and its "Try it out" link disappears. Restore with wp option delete jetpack_ai_image_editor_enabled.
  • Bonus: set WP_AI_SUPPORT to false in wp-config — the Features tab should show just a notice, no upsell.
  • For more detailed runbook, see One Bin 3c06f-pb

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the add/jetpack-ai-feature-toggles branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/jetpack-ai-feature-toggles

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions Bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] In Progress Admin Page React-powered dashboard under the Jetpack menu labels Jul 10, 2026
@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Jul 10, 2026
@jp-launch-control

This comment was marked as outdated.

@ariskataoka
ariskataoka marked this pull request as ready for review July 10, 2026 07:32
Comment thread projects/plugins/jetpack/_inc/client/ai/features/index.jsx Outdated
Comment thread projects/plugins/jetpack/_inc/client/ai/features/index.jsx Outdated
Comment thread projects/plugins/jetpack/_inc/client/ai/features/index.jsx
@ariskataoka ariskataoka changed the title Add/jetpack ai feature toggles WIP: Add AI feature toggles Jul 13, 2026
@ariskataoka
ariskataoka changed the base branch from add/jetpack-ai-feature-settings to add/jetpack-ai-feature-clip-toggle July 13, 2026 01:05
@ariskataoka
ariskataoka force-pushed the add/jetpack-ai-feature-toggles branch from cfbb4f6 to 720d5ba Compare July 13, 2026 01:12
@ariskataoka
ariskataoka marked this pull request as draft July 13, 2026 10:37
@ariskataoka
ariskataoka force-pushed the add/jetpack-ai-feature-clip-toggle branch from 7bc3d5d to 8686b02 Compare July 14, 2026 01:30
@ariskataoka
ariskataoka force-pushed the add/jetpack-ai-feature-toggles branch from fa7a467 to 5b51ce2 Compare July 14, 2026 01:30
@kat3samsin
kat3samsin force-pushed the add/jetpack-ai-feature-clip-toggle branch from 8686b02 to a22aa0f Compare July 14, 2026 17:37
Base automatically changed from add/jetpack-ai-feature-clip-toggle to add/jetpack-ai-feature-settings July 14, 2026 19:25
@kat3samsin
kat3samsin force-pushed the add/jetpack-ai-feature-settings branch from c523041 to 40b87e8 Compare July 14, 2026 21:14
@ariskataoka
ariskataoka force-pushed the add/jetpack-ai-feature-toggles branch from 778ad63 to 6a1a413 Compare July 14, 2026 22:09
@ariskataoka ariskataoka changed the title WIP: Add AI feature toggles WIP: Add AI feature toggles UI Jul 15, 2026
@ariskataoka
ariskataoka force-pushed the add/jetpack-ai-feature-toggles branch from 8fee8d8 to 33b0500 Compare July 16, 2026 04:47
ariskataoka and others added 14 commits August 4, 2026 15:03
… config

The GUI config overrides transformIgnorePatterns, shadowing the base
config's @wordpress/theme exception that trunk added — so after rebasing
onto current trunk, any suite importing the new design-system chain
failed to parse theme's untranspiled .mjs. Mirror the exception here.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…wer ones

Concurrent toggle saves raced: every POST response is a full settings
snapshot applied in arrival order, so a slow earlier response landing
last reverted a newer save on screen — no spinner, no error, while the
server held the user's choice. Saves now queue behind a ref'd promise:
one request in flight at a time, advancing on settle so a failure can't
block the saves behind it. Serializing beats latest-response-wins,
which still shows stale data when the server processes requests out of
dispatch order. Tests lock in the held-back second POST and the
failure-then-success path.

Also capitalizes the changelog entry per house style (review nit).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The endpoint has always reported is_connected, but the view never consumed
it, so a disconnected or offline site rendered every toggle as live while
no AI feature could load. Per the toggle-contract P2's gate 2, the
connection ask comes first: a warning notice links to My Jetpack's
connection route, saved values stay visible but inert, and the Requires
upgrade badge is suppressed while the plan is unknowable.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…tles

savingKeys is a Set, so with two queued saves for the same key the first
save's cleanup re-enabled the row while the second was still in flight.
Refcount pending saves per key and release a key only when its last save
settles. Also lock gated-toggle inertness: not-connected and master-off
toggles fire no save and no Tracks event.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Docs links (Learn more) open a new tab; wp-admin action links stay
same-tab — the behaviour proposed on the design review thread.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The default Tabs.List box extends ~16px left of the label, so the
active-tab underline overhung the logo/subtitle line. Switch to the
minimal tabs variant plus the jp-admin-page-tabs--minimal wrapper
modifier — the base-styles opt-in pair Protect, Scan, and VideoPress
use — which keeps the box flush with the label and the strip aligned
with the header start (verified 184/184/184 on the live page).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A connected site whose plan lacks Jetpack AI now shows a plan notice with
its saved values disabled, ordered after the connection ask and before
master-off.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A successful feature-settings save shows a dismissible success notice
(single slot, Features tab only). First main.jsx test coverage: host-off,
MCP view tracking, and the save notice.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ariskataoka
ariskataoka force-pushed the add/jetpack-ai-feature-toggles branch from 49d6e16 to 7a9e7b4 Compare August 4, 2026 06:52
@ilonagl

ilonagl commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

This is great, @ariskataoka!

One question: I am testing this on a new JN site, and the first view I get is the upgrade notice, even tho I have the free plan. Just wanted to check if this works well on your side?

Screenshot 2026-08-04 at 12 03 09 Screenshot 2026-08-04 at 12 02 37

@ilonagl

ilonagl commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Re the upgrade path:

It currently leads to https://wordpress.com/plans
Screenshot 2026-08-04 at 12 09 39

And it would be good to reuse the existing one that we have from the My Jetpack path:

Screen.Recording.2026-08-04.at.12.10.47.mov

Would that be possible? Or do we have any technical nuances here?

@ilonagl

ilonagl commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

@ariskataoka I just caught up with the recommendations from the DS team. The advise is to switch feedback components from notice to snackbar. 🙏

@ilonagl

ilonagl commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

cc @grbicsanja for awareness

@ilonagl

ilonagl commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

We can update the copy for writing assistant: "Draft, rewrite, translate, and adjust tone for your content right in the block editor."

@ariskataoka ariskataoka added this to the 16.2 milestone Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants