Skip to content

Boost: Add an "Ask your agent" button to the speed score card behind a feature flag - #55586

Draft
LiamSarsfield wants to merge 5 commits into
trunkfrom
fm/boost-915-ask-agent-build-1130
Draft

LiamSarsfield wants to merge 5 commits into
trunkfrom
fm/boost-915-ask-agent-build-1130

Conversation

@LiamSarsfield

@LiamSarsfield LiamSarsfield commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Fixes BOOST-915

Proposed changes

  • Adds an "Ask your agent" button that copies a prompt with the scores.

Why are these changes being made?

Owners see scores, not next steps.

How it reaches users

Off by default behind the boost-ask-your-agent feature flag.

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

Flag on only: Tracks events jetpack_boost_ask_agent_preview_opened and jetpack_boost_ask_agent_prompt_copied (surface: speed_score_card).

Testing instructions

Checked at 1440 and 390 wide and by keyboard on two Jurassic Ninja sites (Boost with Jetpack, Boost only). On an Atomic site at 1440 wide, the button shows and step 5 works (Copy prompt not pressed). Not checked yet: VoiceOver, due before the flag is turned on for users.

  1. Open Jetpack → Boost.
    The button is absent.
  2. Run wp companion feature-flag enable boost-ask-your-agent, reload.
    The button appears.
  3. Click it, then "Copy prompt".
    The prompt is copied.
  4. Click "Run speed test".
    Hidden until new scores arrive.
  5. Tab to it, Enter, Escape.
    Focus returns.

Screenshots

Jurassic Ninja site with Boost and Jetpack, Jetpack → Boost. Before is a build without this change; after is this branch.

Before (trunk) After, flag off After, flag on
1440 Score card on trunk at 1440 Score card with the flag off at 1440 Score card with the Ask your agent button at 1440
Before (trunk) After, flag on
390 Score card on trunk at 390 Score card with the Ask your agent button at 390

Dialog, flag on:

1440 390 Clipboard blocked
Ask your agent dialog at 1440 Ask your agent dialog at 390 Dialog after the browser blocked copying

…a feature flag

The button sits in the "Your site speed" card header when the
boost-ask-your-agent flag is on and the card holds a settled, current
score. It opens a dialog previewing a prompt built from the measured page
and its mobile and desktop scores, with a Copy button that falls back to
selecting the text when the browser blocks clipboard access. Opening the
preview and copying the prompt each record one Tracks event.

The flag is registered off by default and handed to the dashboard through
the jetpack_boost_js_constants filter.
Build the "Ask your agent" prompt when its dialog opens and keep it until
the dialog opens again. A without-Boost score that finishes measuring in
between cannot change text the site owner has already copied or selected;
the next open shows it. A copy that finishes after the dialog closes has no
effect. When the button disappears while it or its dialog has focus, focus
moves to the "Your site speed" heading instead of the page body.

Adds a dashboard test that the button shows only with the flag on.
@LiamSarsfield
LiamSarsfield requested a review from a team as a code owner November 30, 2026 13:34
@LiamSarsfield
LiamSarsfield marked this pull request as draft November 30, 2026 13:34
@LiamSarsfield LiamSarsfield changed the title feat(boost): add feature-gated Ask your agent prompt preview Boost: Add an "Ask your agent" button to the speed score card behind a feature flag Nov 30, 2026
@LiamSarsfield
LiamSarsfield removed the request for review from a team November 30, 2026 13:35
@github-actions github-actions Bot added [Plugin] Boost A feature to speed up the site and improve performance. [Tests] Includes Tests labels Nov 30, 2026
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

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!


Boost plugin:

No scheduled milestone found for this plugin.

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

@github-actions github-actions Bot added [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 Nov 30, 2026
@jp-launch-control

jp-launch-control Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 3 files.

File Coverage Δ% Δ Uncovered
projects/plugins/boost/_inc/overview/overview.tsx 95/95 (100.00%) 0.00% 0 💚
projects/plugins/boost/_inc/overview/score-cards.tsx 32/32 (100.00%) 0.00% 0 💚
projects/plugins/boost/app/class-jetpack-boost.php 148/193 (76.68%) 1.96% 0 💚

3 files are newly checked for coverage.

File Coverage
projects/plugins/boost/_inc/overview/lib/agent-prompt.ts 16/17 (94.12%) 💚
projects/plugins/boost/_inc/overview/ask-agent-dialog.tsx 43/43 (100.00%) 💚
projects/plugins/boost/app/assets/src/js/lib/utils/copy-text.ts 16/16 (100.00%) 💚

Full summary · PHP report · JS report

…config.resolve.alias and added $lib using pluginRoot, matching the settings fixture. Syntax and diff whitespace checks passed. Webpack verification was blocked by pnpm 11.5.2; the repository requires ^12.22.0. Both CI checks remain unverified
- Record the copied event for a copy that succeeds after the dialog
  closed or was removed by a refresh, without changing the screen; a
  removal now counts as a close.
- Announce a blocked copy to screen readers.
- Always remove the fallback copy field, even when copying throws.
- Reset the feature flag registry and filter after each flag test, and
  check that the constructor registers the flag.
- Tidy comments and small code in the dialog and prompt builder.
The dialog can focus the prompt field on open before the click, so
waiting for focus could pass before the blocked copy settled.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

E2E Tests [Plugin] Boost A feature to speed up the site and improve performance. [Status] In Progress [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant