AI: Remove Chrome AI built-in API experiment code#46896
Conversation
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]>
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
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:
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:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
There was a problem hiding this comment.
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
skipRequestCountparameter 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. |
There was a problem hiding this comment.
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.
| Significance: minor | ||
| Type: removed | ||
|
|
||
| Removed Chrome AI built-in API integration code. |
There was a problem hiding this comment.
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.
| Significance: patch | ||
| Type: other | ||
|
|
||
| AI: removed Chrome AI built-in API experiment code. |
There was a problem hiding this comment.
The changelog entry should use an imperative mood. Change "removed" to "Remove" to match the convention specified in the coding guidelines.
Code Coverage SummaryCoverage changed in 7 files. Only the first 5 are listed here.
|
| Connection_Initial_State::render_script( 'jetpack-blocks-editor' ); | ||
|
|
||
| // Register and enqueue the Jetpack Chrome AI token script | ||
| wp_register_script( |
There was a problem hiding this comment.
I think we need another removal PR for these, right?
dhasilva
left a comment
There was a problem hiding this comment.
LGTM. Tests well. As Christian noted, another PR is needed to remove the token script file.
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:chrome-ai/directory fromai-client(ChromeAIFactory, ChromeAISuggestionsEventSource, availability checker)AI_MODEL_GEMINI_NANOconstant and globalWindowtype declarations (LanguageDetector,Translator,Summarizer)useAiSuggestionshook to always useaskQuestiondirectly instead of conditionally routing through Chrome AIskipRequestCountparameter fromonDone/onAllErrorscallbacks — consumers now always callincreaseRequestsCount()ChromeAiTokenstype and mapping fromshared-extension-utilsjetpack-chrome-ai-token) fromclass.jetpack-gutenberg.phpclass-jetpack-ai-helper.phpOther information:
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:
jetpack-chrome-ai-tokenscript is no longer enqueued in the editor🤖 Generated with Claude Code