Skip to content

Conversation

@jcheringer
Copy link
Contributor

@jcheringer jcheringer commented Dec 29, 2025

Part of https://linear.app/a8c/issue/BSKY-1472

Proposed changes:

  • Adjusts the Agents Manager logic to enqueue the files from the standalone agents manager app

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)?

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

No

Testing instructions:

Copilot AI review requested due to automatic review settings December 29, 2025 20:06
@github-actions
Copy link
Contributor

github-actions bot commented Dec 29, 2025

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 (WordPress.com Site Helper), and enable the update/agents-manager-load-app branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack-mu-wpcom-plugin update/agents-manager-load-app

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 Dec 29, 2025

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 a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ 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!

@github-actions github-actions bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Dec 29, 2025
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 enhances the Agents Manager to enqueue scripts and styles from a standalone agents manager application. The implementation dynamically loads different variants (Gutenberg vs wp-admin) based on the current context.

Key Changes:

  • Renames add_inline_script() method to enqueue_scripts() to better reflect its expanded responsibilities
  • Adds dynamic script/style loading from widgets.wp.com with transient caching and variant support
  • Implements block editor detection to determine which variant to load

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 12 comments.

File Description
projects/packages/jetpack-mu-wpcom/src/features/agents-manager/class-agents-manager.php Adds new methods for enqueueing standalone agents manager app assets with caching, variant detection, and asset fetching logic
projects/packages/jetpack-mu-wpcom/changelog/update-agents-manager-load-app Changelog entry documenting the feature addition

@jp-launch-control
Copy link

jp-launch-control bot commented Dec 29, 2025

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/jetpack-mu-wpcom/src/features/agents-manager/class-agents-manager.php 132/252 (52.38%) 5.04% 21 💔

Full summary · PHP report

Coverage check overridden by Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR .

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings December 30, 2025 13:46
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

@jcheringer jcheringer removed the request for review from a team December 30, 2025 13:56
Copilot AI review requested due to automatic review settings December 30, 2025 15:04
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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

Comments suppressed due to low confidence (1)

projects/packages/jetpack-mu-wpcom/src/features/agents-manager/class-agents-manager.php:221

  • The inline script is now added to 'agents-manager' handle, but if enqueue_script() fails to enqueue the script (e.g., when get_assets_json() returns null), the inline script will fail to attach to anything, potentially causing a silent failure. Consider checking whether the script was successfully enqueued before adding the inline script data.
		wp_add_inline_script(
			'agents-manager',
			'const agentsManagerData = ' . wp_json_encode(
				array(
					'agentProviders'       => $agent_providers,
					'useUnifiedExperience' => $use_unified_experience,
				),
				JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP
			) . ';',
			'before'

Copilot AI review requested due to automatic review settings December 31, 2025 14:09
@jom
Copy link
Member

jom commented Jan 6, 2026

Setting up the local dev env. Unrelated to your PR, but to help with testing I think we'll want the should_use_unified_experience function to allow proxied or local dev sites. We might want to borrow this from is_dev_mode in Big Sky.

Copilot AI review requested due to automatic review settings January 7, 2026 11:53
@jcheringer jcheringer review requested due to automatic review settings January 7, 2026 11:56
Copilot AI review requested due to automatic review settings January 7, 2026 18:56
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

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

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI review requested due to automatic review settings January 8, 2026 12:39
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

jom
jom previously approved these changes Jan 8, 2026
Copy link
Member

@jom jom left a comment

Choose a reason for hiding this comment

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

This looks good and seems to work well on WPCOM and WoA.

@jom jom self-requested a review January 8, 2026 21:20
@jom
Copy link
Member

jom commented Jan 8, 2026

Just saw the test failures that seem related.

Copilot AI review requested due to automatic review settings January 9, 2026 13:32
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

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

@jcheringer jcheringer added the Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR label Jan 9, 2026
@jcheringer jcheringer merged commit 51492b1 into trunk Jan 9, 2026
67 checks passed
@jcheringer jcheringer deleted the update/agents-manager-load-app branch January 9, 2026 14:12
@github-actions github-actions bot removed the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR [mu wpcom Feature] Agents Manager [Package] Jetpack mu wpcom WordPress.com Features [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants