-
Notifications
You must be signed in to change notification settings - Fork 843
Hook into new filter to allow toggling unified ai experience. #46237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hook into new filter to allow toggling unified ai experience. #46237
Conversation
|
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! |
Code Coverage SummaryCoverage changed in 1 file.
|
879e976 to
73fc957
Compare
We are moving the enable/disable logic into the agent-manager backend here in jetpack-mu-wpcom. We are using user attribute `a11n_unified_chat` that will be handled on wpcom's via wp-admin.
73fc957 to
9dd7771
Compare
Exposes the `agents_manager_use_unified_experience` filter value via the `agentsManagerData` global, allowing Help Center to check the unified experience flag on wp-admin environments (Atomic, Garden, Simple sites) where the `/me` API is not accessible.
On Atomic sites, the `get_user_attribute` function is not available. This adds a fallback that fetches user attributes via the Jetpack Connection API (`/jetpack-user-attributes` endpoint). Changes: - Add `get_user_attribute()` method that handles both Simple and Atomic - Add `get_user_attribute_via_api()` for Atomic sites (pattern from launchpad) - Update `has_unified_chat_opt_in_enabled()` to use the new method - Add test for Atomic site scenario
On Atomic sites, delegate the unified experience decision to wpcom via /me?fields=unified_ai_chat endpoint instead of trying to fetch raw user attributes via /jetpack-user-attributes (which was failing). This approach: - Uses the same data source as Calypso - Avoids duplicating rollout logic - Follows pattern from help-center persisted-open-state
|
Moving to draft again. This doesn't seem to be enough for Atomic. We can't access Alternatives crossing my mind at the moment:
|
- Read unified_ai_chat from calypso_preferences instead of a11n_unified_chat - On Atomic sites, call /me/preferences via wpcom/v2 (works with Jetpack tokens)
|
Final approach: Using Changes in wpcom have already been applied in 197669-ghe-Automattic/wpcom |
Simple sites use local check, anything else uses jetpack connection to query wpcom.
Clean up error_log statements that were added for debugging the unified experience toggle issue. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add Constants import and clear constants in tearDown - Set IS_WPCOM constant in tests that need Simple site context - Fix get_user_attribute stub to return proper calypso_preferences array - Add test for useUnifiedExperience in inline script output 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
The get_unified_experience_from_wpcom() method makes HTTP calls via Jetpack Connection Client which cannot be easily mocked in unit tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Related to DOTCOM-15279
Proposed changes:
Does this pull request change what data or activity we track or use?
No
Other information:
Testing instructions:
This is a small (but independent) part in a bigger set of changes. To test the full feature see Automattic/wp-calypso#107601.
Release
This can be independently released. Since nothing is yet consuming the
agents_manager_use_unified_experiencehook until Automattic/wp-calypso#107601 and https://github.com/Automattic/big-sky-plugin/pull/5210 are deployed.