Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: bugfix

Block Notes: Stop force-enabling Agents Manager site-wide via the unified experience filter.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
Expand Down Expand Up @@ -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
// -------------------------------------------------------------------------
Comment on lines 961 to 963
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

The PR removes the enable_agents_manager_for_block_notes() filter behavior (and its tests), but there isn’t a replacement regression test asserting Block Notes no longer enables Agents Manager’s unified experience. Consider adding a test that verifies no agents_manager_use_unified_experience filter is registered / apply_filters( 'agents_manager_use_unified_experience', false ) remains false when only Block Notes is enabled, so this behavior doesn’t accidentally reappear.

Copilot uses AI. Check for mistakes.
Expand Down
Loading