Skip to content

Conversation

@aaronfc
Copy link
Contributor

@aaronfc aaronfc commented Dec 10, 2025

Part of DOTCOM-15279

Proposed Changes

  • Consumes /me/preferences endpoint for unified_ai_chat property for wpcom. Atomic/Garden relies on agentsManagerData inline JS that is generated by jetpack-mu-wpcom consuming /me/preferences too.

    Environment How flag is retrieved
    Calypso app (wordpress.com) /me/preferences
    Simple site wp-admin agentsManagerData.useUnifiedExperience
    Atomic site wp-admin agentsManagerData.useUnifiedExperience -> /me/preferences
    Garden/CIAB wp-admin agentsManagerData.useUnifiedExperience -> /me/preferences

Why are these changes being made?

  • We want to stop relying on flags=unified-agent query parameter for testing.
  • We need automatticians to be able to opt-in to the unified experience (via 197669-ghe-Automattic/wpcom).
  • Shortly in the future, we will use this same flag to do the progressive rollout to real users.

Testing Instructions

This depends on the following PRs. Make sure you have them in place if they haven't been released yet (details below):

Requirements:

Testing calypso:

⚠️ You must have enabled Unified Chat option as described above in your WPCOM profile.

Testing simple site:

  • Checkout big-sky-plugin to 5210-gh-Automattic/big-sky-plugin and run WPCOM_USERNAME={YOURUSERNAME} npm run build:wpcom. (Not needed if PR has been already merged and deployed).
  • Go to /wp-admin/ in a sandboxed simple site.
  • Confirm you see the unified ai experience.

Testing atomic site:

  • We need help-center app in place:
    • Make sure widgets.wp.com is pointing to your sandbox.
    • cd apps/help-center
    • Run yarn dev --sync.
    • Issues? If you are an Automattician check PCYsg-OT6-p2
  • We also need agents-manager (jetpack-mu-wpcom) in place:
    • ⚠️ Stop sandboxing wordpress.com if you are still doing. Or you won't be able to access your dev blog's hosting-config page required in next step.
    • Automattician, you need a woa dev blog for this. To get one follow steps in PCYsg-Osp-p2 ("First time setup" section).
    • ⚠️ You need to select the "Transfer to WP Cloud dev pool" checkbox. So you can point your Atomic to your sandbox for public-api.wordpress.com. 197669-ghe-Automattic/wpcom RELEASED
image
  • SSH into your and add both constants to your htdocs/wp-config.php file.
define( 'JETPACK_AUTOLOAD_DEV', true ); // Enabled jetpack autoloading
//define( 'JETPACK__SANDBOX_DOMAIN', '$YOUR_SANDBOX_HOSTNAME' ); // Point to your sandbox USE YOUR SANDBOX – NOT NEEDED AFTER 197669-ghe-Automattic/wpcom HAS BEEN RELEASED
  • Then, follow "Testing a PR on WoW": Install jetpack-beta plugin. Then go to /wp-admin/admin.php?page=jetpack-beta&plugin=wpcomsh and activate the feature branch add/agents-manager-unified-experience-toggle-logic.
  • We finally need big-sky-plugin updated too (minor: to avoid duplicate experience)
  • Confirm that you see the unified chat experience in /wp-admin and basically everywhere around your atomic site.

Testing garden site:

  • Get your site garden site ready. Automattician? Follow p9lV3a-7yV-p2
    • While doing so, make sure big-sky-plugin and agents-manager are using: 5210-gh-Automattic/big-sky-plugin and Hook into new filter to allow toggling unified ai experience. jetpack#46237
    • Also, confirm your sandbox contains calypso's help center app (yarn dev --sync) and 197669-ghe-Automattic/wpcom RELEASED⚠️ you must be sandboxing both public-api.wordpress.com and widgets.wp.com.
  • Navigate to your ciab site (using jurassic tube) and:
    • Navigate to /wp-admin/ and confirm it displays the unified chat experience.
    • Navigate to /wp-admin/plugins.php and confirm it displays the unified chat experience.

Screenshots

Simple site (wp-admin)

image

Simple site (post editor)

image

WoA (wp-admin)

image

CIAB (wp-admin + next-admin)

No screenshots.

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you tested accessibility for your changes? Ensure the feature remains usable with various user agents (e.g., browsers), interfaces (e.g., keyboard navigation), and assistive technologies (e.g., screen readers) (PCYsg-S3g-p2).
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
    • For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

Consumes `/me` endpoint for `unified_ai_chat` field for wpcom.
Atomic/Garden will need other checks.
@matticbot
Copy link
Contributor

matticbot commented Dec 10, 2025

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • help-center

To test WordPress.com changes, run install-plugin.sh $pluginSlug change/unified-ai-chat-logic-from-server on your sandbox.

@matticbot
Copy link
Contributor

matticbot commented Dec 10, 2025

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Async-loaded Components (~213 bytes added 📈 [gzipped])

name                               parsed_size           gzip_size
async-load-help-center-app              +436 B  (+0.0%)     +213 B  (+0.0%)
async-load-automattic-help-center       +436 B  (+0.0%)     +213 B  (+0.0%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

Retrieve the unified experience flag using a hybrid approach:

1. Check `agentsManagerData.useUnifiedExperience` inline script first
   (available on wp-admin via Jetpack's Agents Manager)
2. Fall back to `/me?fields=unified_ai_chat` endpoint for Calypso app

This is needed because Calypso app has access to the `/me` endpoint
on wpcom, but wp-admin environments (Atomic, Garden, Simple sites)
do not have access to wpcom APIs directly. The inline script provides
the flag server-side for these environments.

Changes:
- Add `getUseUnifiedExperienceFromInlineData()` helper to agents-manager
- Export helper from agents-manager package
- Update `useUnifiedAiChat` hook to use hybrid approach
  - Fetch unified_ai_chat from /me/preferences instead of /me endpoint
  - Read from calypso_preferences.unified_ai_chat in response
@aaronfc aaronfc marked this pull request as ready for review December 12, 2025 09:33
@aaronfc aaronfc requested a review from a team as a code owner December 12, 2025 09:33
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Dec 12, 2025
@aaronfc aaronfc requested a review from a team December 12, 2025 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants