diff --git a/projects/plugins/jetpack/changelog/fix-skip-premature-am-enable-block-notes b/projects/plugins/jetpack/changelog/fix-skip-premature-am-enable-block-notes new file mode 100644 index 000000000000..3b46ef84d69a --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-skip-premature-am-enable-block-notes @@ -0,0 +1,4 @@ +Significance: patch +Type: bugfix + +Block Notes: Stop force-enabling Agents Manager site-wide via the unified experience filter. diff --git a/projects/plugins/jetpack/extensions/plugins/block-notes/block-notes.php b/projects/plugins/jetpack/extensions/plugins/block-notes/block-notes.php index f0951113ae56..a8261a2a8019 100644 --- a/projects/plugins/jetpack/extensions/plugins/block-notes/block-notes.php +++ b/projects/plugins/jetpack/extensions/plugins/block-notes/block-notes.php @@ -288,25 +288,6 @@ function enqueue_block_notes() { } add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\enqueue_block_notes' ); -/** - * Enable the agents manager unified experience on self-hosted sites - * when Block Notes is enabled. - * - * This ensures the agents manager loads and can host the headless agent - * even when the unified chat experience is not otherwise enabled. - * - * @param bool $use_unified_experience Current value of the filter. - * @return bool - */ -function enable_agents_manager_for_block_notes( $use_unified_experience ) { - if ( $use_unified_experience ) { - return true; - } - - return is_block_notes_enabled(); -} -add_filter( 'agents_manager_use_unified_experience', __NAMESPACE__ . '\enable_agents_manager_for_block_notes' ); - /** * Register the Block Notes headless agent provider with the agents manager. * diff --git a/projects/plugins/jetpack/tests/php/extensions/plugins/block-notes/Block_Notes_Test.php b/projects/plugins/jetpack/tests/php/extensions/plugins/block-notes/Block_Notes_Test.php index a58bb123b577..89fa968ca854 100644 --- a/projects/plugins/jetpack/tests/php/extensions/plugins/block-notes/Block_Notes_Test.php +++ b/projects/plugins/jetpack/tests/php/extensions/plugins/block-notes/Block_Notes_Test.php @@ -51,7 +51,6 @@ public function set_up() { */ public function tear_down() { delete_transient( BlockNotes\ASSET_TRANSIENT ); - remove_all_filters( 'agents_manager_use_unified_experience' ); remove_all_filters( 'agents_manager_agent_providers' ); remove_all_filters( 'pre_http_request' ); remove_all_filters( 'jetpack_ai_enabled' ); @@ -959,52 +958,6 @@ public function test_get_asset_data_from_remote_returns_false_on_non_json_conten $this->assertFalse( $result ); } - // ------------------------------------------------------------------------- - // enable_agents_manager_for_block_notes() tests - // ------------------------------------------------------------------------- - - /** - * Test that enable_agents_manager_for_block_notes returns true - * when AI features are available. - */ - public function test_enable_agents_manager_returns_true_when_block_notes_enabled() { - $result = BlockNotes\enable_agents_manager_for_block_notes( false ); - - $this->assertTrue( $result ); - } - - /** - * Test that enable_agents_manager_for_block_notes returns false - * when AI features are disabled and input is false. - */ - public function test_enable_agents_manager_returns_false_when_block_notes_disabled() { - $this->disable_ai_features(); - - $result = BlockNotes\enable_agents_manager_for_block_notes( false ); - - $this->assertFalse( $result ); - } - - /** - * Test that enable_agents_manager_for_block_notes does not override - * when agents_manager_use_unified_experience is already true. - */ - public function test_enable_agents_manager_preserves_existing_true() { - $result = BlockNotes\enable_agents_manager_for_block_notes( true ); - - $this->assertTrue( $result ); - } - - /** - * Test that enable_agents_manager_for_block_notes preserves true - * when input is already true and block notes is also enabled. - */ - public function test_enable_agents_manager_no_double_registration() { - $result = BlockNotes\enable_agents_manager_for_block_notes( true ); - - $this->assertTrue( $result ); - } - // ------------------------------------------------------------------------- // register_headless_agent_provider() tests // -------------------------------------------------------------------------