Skip to content

AI: Remove Chrome AI built-in API experiment code#46896

Merged
vianasw merged 1 commit intotrunkfrom
remove/chrome-ai-experiment-code
Feb 4, 2026
Merged

AI: Remove Chrome AI built-in API experiment code#46896
vianasw merged 1 commit intotrunkfrom
remove/chrome-ai-experiment-code

Conversation

@vianasw
Copy link
Contributor

@vianasw vianasw commented Feb 2, 2026

Fixes JETPACK-28

Proposed changes:

The Chrome AI A/B test experiment (calypso_jetpack_ai_gemini_api_202503_v2) is complete. This PR removes all related code across the monorepo:

  • Delete the entire chrome-ai/ directory from ai-client (ChromeAIFactory, ChromeAISuggestionsEventSource, availability checker)
  • Remove AI_MODEL_GEMINI_NANO constant and global Window type declarations (LanguageDetector, Translator, Summarizer)
  • Simplify useAiSuggestions hook to always use askQuestion directly instead of conditionally routing through Chrome AI
  • Remove skipRequestCount parameter from onDone/onAllErrors callbacks — consumers now always call increaseRequestsCount()
  • Remove ChromeAiTokens type and mapping from shared-extension-utils
  • Remove Chrome AI token script registration (jetpack-chrome-ai-token) from class.jetpack-gutenberg.php
  • Remove Chrome AI tokens retrieval from class-jetpack-ai-helper.php

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

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

No. This removes tracking/experiment code; no new data is collected.

Testing instructions:

  • Verify that AI Assistant features (block, inline text extension, post excerpt generation) continue to work normally without Chrome AI
  • Confirm the jetpack-chrome-ai-token script is no longer enqueued in the editor
  • Verify no JS console errors related to Chrome AI or Gemini Nano appear

🤖 Generated with Claude Code

The Chrome AI A/B test experiment (calypso_jetpack_ai_gemini_api_202503_v2)
is complete. This removes all related code:

- Delete chrome-ai directory (factory, suggestions, availability)
- Remove AI_MODEL_GEMINI_NANO constant and global Window type declarations
- Simplify useAiSuggestions hook to always use askQuestion
- Remove skipRequestCount parameter from onDone/onAllErrors callbacks
- Remove ChromeAiTokens type and mapping from shared-extension-utils
- Remove Chrome AI token script registration and PHP backend code

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Copilot AI review requested due to automatic review settings February 2, 2026 15:04
@vianasw vianasw added the [Status] Needs Review This PR is ready for review. label Feb 2, 2026
@vianasw vianasw self-assigned this Feb 2, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 2, 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 remove/chrome-ai-experiment-code branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack remove/chrome-ai-experiment-code
bin/jetpack-downloader test jetpack-mu-wpcom-plugin remove/chrome-ai-experiment-code

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
Copy link
Contributor

github-actions bot commented Feb 2, 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: February 3, 2026
    • Code freeze: February 3, 2026

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes all code related to the Chrome AI built-in API experiment (calypso_jetpack_ai_gemini_api_202503_v2) after the A/B test has been completed. The cleanup is comprehensive and spans across multiple packages in the monorepo.

Changes:

  • Delete the entire chrome-ai/ directory with factory, suggestions, availability checker, and type declarations
  • Remove skipRequestCount parameter from AI suggestion callbacks, simplifying the API
  • Remove Chrome AI token script registration and retrieval from backend PHP files

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
projects/js-packages/ai-client/src/chrome-ai/suggestions.ts Deleted Chrome AI suggestions event source implementation
projects/js-packages/ai-client/src/chrome-ai/index.ts Deleted Chrome AI module exports
projects/js-packages/ai-client/src/chrome-ai/get-availability.ts Deleted Chrome AI availability checker and ExPlat integration
projects/js-packages/ai-client/src/chrome-ai/factory.ts Deleted Chrome AI factory that routed translation/summarization requests
projects/js-packages/ai-client/src/types.ts Remove AI_MODEL_GEMINI_NANO constant and global Window type declarations for Chrome AI APIs
projects/js-packages/ai-client/src/index.ts Remove Chrome AI exports from package entry point
projects/js-packages/ai-client/src/hooks/use-ai-suggestions/index.ts Simplify hook to always use askQuestion, remove conditional Chrome AI routing and skipRequestCount parameter
projects/plugins/jetpack/extensions/plugins/ai-content-lens/extend/ai-post-excerpt/index.tsx Update callback signatures to remove skipRequestCount parameter
projects/plugins/jetpack/extensions/blocks/ai-assistant/hooks/use-ai-assistant/index.js Update onDone callback to remove skipRequestCount parameter
projects/plugins/jetpack/extensions/blocks/ai-assistant/extensions/text-blocks/with-ai-text-extension.tsx Update onDone callback to remove skipRequestCount parameter
projects/plugins/jetpack/extensions/blocks/ai-assistant/edit.js Update onSuggestionDone callback to remove skipRequestCount parameter
projects/plugins/jetpack/class.jetpack-gutenberg.php Remove Chrome AI token script registration
projects/plugins/jetpack/_inc/lib/class-jetpack-ai-helper.php Remove Chrome AI tokens retrieval from AI assistance feature
projects/js-packages/shared-extension-utils/src/store/wordpress-com/types.ts Remove ChromeAiTokens type definition
projects/js-packages/shared-extension-utils/src/store/wordpress-com/actions.ts Remove chromeAiTokens mapping
projects/plugins/jetpack/changelog/remove-chrome-ai-experiment-code Add changelog entry for Jetpack plugin
projects/js-packages/shared-extension-utils/changelog/remove-chrome-ai-experiment-code Add changelog entry for shared-extension-utils package
projects/js-packages/ai-client/changelog/remove-chrome-ai-experiment-code Add changelog entry for ai-client package

Significance: patch
Type: removed

Removed Chrome AI tokens type and mapping.
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

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

The changelog entry should start with a capital letter and use an imperative mood. Change "Removed" to "Remove" to match the convention specified in the coding guidelines.

Copilot generated this review using guidance from repository custom instructions.
Significance: minor
Type: removed

Removed Chrome AI built-in API integration code.
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

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

The changelog entry should start with a capital letter and use an imperative mood. Change "Removed" to "Remove" to match the convention specified in the coding guidelines.

Copilot generated this review using guidance from repository custom instructions.
Significance: patch
Type: other

AI: removed Chrome AI built-in API experiment code.
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

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

The changelog entry should use an imperative mood. Change "removed" to "Remove" to match the convention specified in the coding guidelines.

Copilot generated this review using guidance from repository custom instructions.
@jp-launch-control
Copy link

jp-launch-control bot commented Feb 2, 2026

Code Coverage Summary

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

File Coverage Δ% Δ Uncovered
projects/js-packages/ai-client/src/types.ts 0/20 (0.00%) 0.00% -1 💚
projects/plugins/jetpack/extensions/blocks/ai-assistant/edit.js 0/138 (0.00%) 0.00% -1 💚
projects/plugins/jetpack/extensions/blocks/ai-assistant/extensions/text-blocks/with-ai-text-extension.tsx 0/181 (0.00%) 0.00% -1 💚
projects/plugins/jetpack/extensions/plugins/ai-content-lens/extend/ai-post-excerpt/index.tsx 0/71 (0.00%) 0.00% -2 💚
projects/js-packages/ai-client/src/hooks/use-ai-suggestions/index.ts 0/91 (0.00%) 0.00% -5 💚

Full summary · PHP report · JS report

@simison simison requested review from CGastrell and dhasilva February 2, 2026 16:05
@vianasw vianasw requested a review from a team February 2, 2026 16:20
Connection_Initial_State::render_script( 'jetpack-blocks-editor' );

// Register and enqueue the Jetpack Chrome AI token script
wp_register_script(
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need another removal PR for these, right?

Copy link
Contributor

@dhasilva dhasilva left a comment

Choose a reason for hiding this comment

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

LGTM. Tests well. As Christian noted, another PR is needed to remove the token script file.

@vianasw vianasw merged commit ea946a2 into trunk Feb 4, 2026
198 of 209 checks passed
@vianasw vianasw deleted the remove/chrome-ai-experiment-code branch February 4, 2026 16:01
@github-actions github-actions bot removed the [Status] Needs Review This PR is ready for review. label Feb 4, 2026
@github-actions github-actions bot added this to the jetpack/15.6 milestone Feb 4, 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.

3 participants