Skip to content

Commit b5bdd8a

Browse files
authored
fix: avoid runtime-branded agent descriptions (#2174)
1 parent 130ec90 commit b5bdd8a

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

inc/Engine/Agents/PersistedAgentProjector.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ private static function description_from_row( array $row, array $config ): strin
107107
}
108108
}
109109

110-
$label = self::label_from_row( $row );
111-
return '' !== $label ? sprintf( 'Data Machine agent: %s.', $label ) : __( 'Data Machine persisted agent.', 'data-machine' );
110+
return '';
112111
}
113112

114113
/**

tests/agents-api-persisted-agent-registry-smoke.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ function datamachine_persisted_agent_registry_reset(): void {
7979
'description' => 'Maintains WooCommerce knowledge.',
8080
),
8181
),
82+
array(
83+
'agent_id' => 103,
84+
'agent_slug' => 'roadie',
85+
'agent_name' => 'Roadie',
86+
'owner_id' => 9,
87+
'agent_config' => array(),
88+
),
8289
)
8390
);
8491

@@ -90,12 +97,14 @@ static function () use ( $repository ): void {
9097
);
9198
do_action( 'init' );
9299

93-
$agents = wp_get_agents();
94-
$agent = wp_get_agent( 'wordpress-com-wiki' );
95-
agents_api_smoke_assert_equals( array( 'wordpress-com-wiki', 'woocommerce-wiki' ), array_keys( $agents ), 'persisted rows are visible through wp_get_agents()', $failures, $passes );
100+
$agents = wp_get_agents();
101+
$agent = wp_get_agent( 'wordpress-com-wiki' );
102+
$roadie_agent = wp_get_agent( 'roadie' );
103+
agents_api_smoke_assert_equals( array( 'wordpress-com-wiki', 'woocommerce-wiki', 'roadie' ), array_keys( $agents ), 'persisted rows are visible through wp_get_agents()', $failures, $passes );
96104
agents_api_smoke_assert_equals( true, $agent instanceof WP_Agent, 'persisted row resolves through wp_get_agent()', $failures, $passes );
97105
agents_api_smoke_assert_equals( 'WordPress.com Wiki', $agent ? $agent->get_label() : '', 'row agent_name becomes label', $failures, $passes );
98106
agents_api_smoke_assert_equals( 'Maintains the WordPress.com wiki brain.', $agent ? $agent->get_description() : '', 'wiki brain description is surfaced', $failures, $passes );
107+
agents_api_smoke_assert_equals( '', $roadie_agent ? $roadie_agent->get_description() : 'missing', 'missing config description stays empty instead of synthesizing a runtime-branded fallback', $failures, $passes );
99108
agents_api_smoke_assert_equals( 7, $agent && is_callable( $agent->get_owner_resolver() ) ? call_user_func( $agent->get_owner_resolver() ) : 0, 'owner_resolver returns persisted owner_id', $failures, $passes );
100109
agents_api_smoke_assert_equals( 'gpt-5.5', $agent ? $agent->get_default_config()['default_model'] ?? '' : '', 'agent_config becomes default_config', $failures, $passes );
101110
agents_api_smoke_assert_equals( 'wordpress-com-wiki', $agent ? $agent->get_meta()['source_package'] ?? '' : '', 'bundle slug is exposed as source package', $failures, $passes );
@@ -113,7 +122,7 @@ static function () use ( $repository ): void {
113122
do_action( 'init' );
114123

115124
$agents = wp_get_agents();
116-
agents_api_smoke_assert_equals( array( 'wordpress-com-wiki', 'woocommerce-wiki' ), array_keys( $agents ), 'projection skips duplicate slugs without dropping other rows', $failures, $passes );
125+
agents_api_smoke_assert_equals( array( 'wordpress-com-wiki', 'woocommerce-wiki', 'roadie' ), array_keys( $agents ), 'projection skips duplicate slugs without dropping other rows', $failures, $passes );
117126
agents_api_smoke_assert_equals( 'Declarative Definition', $agents['wordpress-com-wiki']->get_label(), 'first registered definition wins', $failures, $passes );
118127
agents_api_smoke_assert_equals( array(), $GLOBALS['__agents_api_smoke_wrong'], 'duplicate skip avoids doing-it-wrong notices', $failures, $passes );
119128

0 commit comments

Comments
 (0)