Skip to content

[RSM] AI Agent Access toggle for Jetpack Search dashboard#48362

Open
kat3samsin wants to merge 14 commits intotrunkfrom
add/jetpack-ai-agents-toggle
Open

[RSM] AI Agent Access toggle for Jetpack Search dashboard#48362
kat3samsin wants to merge 14 commits intotrunkfrom
add/jetpack-ai-agents-toggle

Conversation

@kat3samsin
Copy link
Copy Markdown
Contributor

@kat3samsin kat3samsin commented Apr 28, 2026

Fixes RSM

Proposed changes

  • Add an AI Agent Access toggle to the Jetpack Search dashboard.
  • Register the jetpack_ai_agents_enabled option for /wp/v2/settings so site owners can opt in/out.
  • Add jetpack_ai_agents_enabled to the Jetpack Sync options whitelist so the setting can propagate to WordPress.com permission checks.
  • Group the jetpack/search-voice MCP ability under Developer & testing in the Jetpack MCP settings UI.
  • Track successful AI Agent Access toggle changes from the Jetpack Search dashboard.
  • Add unit coverage for the new React control, the PHP option registration/Sync whitelist, the MCP category mapping, and toggle tracking.

Related product discussion/links

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

Yes. This PR adds an explicit site-owner opt-in that controls whether WordPress.com-authenticated AI assistants may answer reader questions using the site's posts and Content Guidelines via the jetpack/search-voice MCP ability.

It also records jetpack_search_ai_agent_access_toggle when the Search dashboard toggle successfully changes state. The event includes enabled, previous_enabled, is_wpcom, and surface: jetpack_search_dashboard. It does not include site content, queries, search results, or guidelines.

On Atomic/WordPress.com-hosted sites, the companion wpcom PR mirrors the local jetpack_ai_agents_enabled option to the ai-agents-enabled blog sticker used by the MCP ability gate. For self-hosted Jetpack sites, the option is added to Jetpack Sync's whitelist so the local toggle and WordPress.com permission gate can stay aligned.

Testing instructions

Automated tests

  • Run pnpm run test-gui -- _inc/client/ai/mcp/test/component.js from projects/plugins/jetpack.
  • Run pnpm run test-js -- src/dashboard/components/ai-agent-access-control/test/index.test.jsx from projects/packages/search.
  • Run PORT_SMTP=1025 pnpm exec jetpack docker phpunit jetpack -- --filter=AI_Assistant_Plugin_Test from the monorepo root.

Steps to test

Follow instructions in WPCOM PR 214186

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 28, 2026

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 or WordPress.com Site Helper), and enable the add/jetpack-ai-agents-toggle branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/jetpack-ai-agents-toggle
bin/jetpack-downloader test jetpack-mu-wpcom-plugin add/jetpack-ai-agents-toggle

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 [Extension] AI Assistant Plugin [Package] Search Contains core Search functionality for Jetpack and Search plugins [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] In Progress [Tests] Includes Tests labels Apr 28, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 28, 2026

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:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: June 2, 2026
    • Code freeze: June 1, 2026

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 Apr 28, 2026
@jp-launch-control
Copy link
Copy Markdown

jp-launch-control Bot commented Apr 28, 2026

Code Coverage Summary

Coverage changed in 6 files. Only the first 5 are listed here.

File Coverage Δ% Δ Uncovered
projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/ai-assistant-plugin.php 22/41 (53.66%) 30.93% 2 ❤️‍🩹
projects/packages/status/src/class-status.php 94/110 (85.45%) 0.16% 1 ❤️‍🩹
projects/packages/search/src/dashboard/class-initial-state.php 74/86 (86.05%) 0.86% 0 💚
projects/packages/search/src/dashboard/components/pages/dashboard-page.jsx 50/59 (84.75%) 1.11% 0 💚
projects/packages/search/src/dashboard/store/selectors/site-data.js 13/18 (72.22%) 3.47% 0 💚

1 file is newly checked for coverage.

File Coverage
projects/packages/search/src/dashboard/components/ai-agent-access-control/index.jsx 38/38 (100.00%) 💚

Full summary · PHP report · JS report

@github-actions github-actions Bot added the Admin Page React-powered dashboard under the Jetpack menu label Apr 30, 2026
@kat3samsin kat3samsin marked this pull request as ready for review May 5, 2026 16:26
@kat3samsin kat3samsin requested a review from iamchughmayank May 5, 2026 16:26
@kat3samsin kat3samsin added [Status] Needs Review This PR is ready for review. and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. [Status] In Progress labels May 5, 2026
@kat3samsin kat3samsin force-pushed the add/jetpack-ai-agents-toggle branch 5 times, most recently from 7f32693 to e4dee7c Compare May 7, 2026 22:03
Comment thread projects/plugins/jetpack/_inc/client/ai/mcp/test/categories.js
@kat3samsin kat3samsin requested a review from iamchughmayank May 8, 2026 18:23
iamchughmayank
iamchughmayank previously approved these changes May 8, 2026
Copy link
Copy Markdown
Contributor

@iamchughmayank iamchughmayank left a comment

Choose a reason for hiding this comment

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

Tested well against wpcom trunk

@kat3samsin kat3samsin force-pushed the add/jetpack-ai-agents-toggle branch 2 times, most recently from cb8240e to 335c3e3 Compare May 8, 2026 21:36
kat3samsin added 3 commits May 8, 2026 19:38
Mirrors the Reader Chat toggle pattern from
github.com//pull/48144. Lets site owners opt in to
allowing WordPress.com-authenticated AI assistants (Claude, ChatGPT, etc.)
to answer reader questions using the blog's posts and Content Guidelines.

The toggle reads/writes `jetpack_ai_agents_enabled` via /wp/v2/settings.
On Atomic/wpcom-hosted sites, an update_option action listener on the
wpcom side mirrors the change to the `ai-agents-enabled` blog sticker so
the wpcom-mcp BlogStickerOptedInMiddleware (in
github.a8c.com/Automattic/wpcom branch add/jetpack-ai-agents-opt-in) can
gate ability access in O(1) sticker checks.

Related PRs:
- wpcom: github.a8c.com/Automattic/wpcom/pull/<TBD> (BlogStickerOptedInMiddleware + sticker mirror)
- wpcom: github.a8c.com/Automattic/wpcom/pull/212419 (the underlying jetpack/search-voice ability)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Admin Page React-powered dashboard under the Jetpack menu [Extension] AI Assistant Plugin [Package] Search Contains core Search functionality for Jetpack and Search plugins [Package] Status [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] Needs Review This PR is ready for review. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants