[wp-trac] [WordPress Trac] #64483: Core Abilities getting error when execution

WordPress Trac noreply at wordpress.org
Mon Jan 19 10:39:47 UTC 2026


#64483: Core Abilities getting error when execution
-------------------------------------------------+-------------------------
 Reporter:  arkenon                              |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  General                              |     Version:  6.9
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing needs-unit-  |     Focuses:
  tests                                          |
-------------------------------------------------+-------------------------

Comment (by hbhalodia):

 Thanks @arkenon @solankisoftware @keshav6750, I got the issue what happens
 is, when there is a call from AI Assitant, to this function,

 {{{#!php
 $function_response_message = Ability_Function_Resolver::execute_abilities(
 $message );
 }}}

 It goes, to `Ability_Function_Resolver`, `execute_abilities` function, in
 that, the individual ability would be executed here -
 https://github.com/WordPress/wp-ai-
 client/blob/dacb6e8b73ff3097c41a256dfe26fb3d0cea9f48/includes/Builders/Helpers/Ability_Function_Resolver.php#L57,

 Which further takes us to this 2 lines, https://github.com/WordPress/wp-
 ai-
 client/blob/dacb6e8b73ff3097c41a256dfe26fb3d0cea9f48/includes/Builders/Helpers/Ability_Function_Resolver.php#L91-L92,
 The `args` which is added as a parameter is coming as an empty array, and
 is added to `execute` function.

 Now if we check for `execute` function, it has `normalize_input` and
 `validate_input`. `normalize_input` just checks for the `input` is `null`
 or not, if null or input_schema is empty, it returns null, but in our case
 it is empty array, coming as input, so it checks only first condition that
 input is not null, hence it return with empty array instead of null.

 Now, coming to `validate_input`, it takes the value returned from the
 `normalize_input` function, and it checks for, empty $input_schema and it
 checks for null as an input, since our input is not null, but our input
 schema is empty, hence instead of return true, it returns the wp_error.

 The solution of this is to check for empty input as well, either in
 normalize_input function or in validate_input function. Below are the two
 solutions which we can think of to implement.

 ## Changes to normalize_input -- https://github.com/WordPress/wordpress-
 develop/blob/cfa06b16d210995793f0cee826169e0a986ad28f/src/wp-includes
 /abilities-api/class-wp-ability.php#L444-L455,

 {{{#!php
 if ( null !== $input && ! empty( $input ) ) {
         return $input;
 }
 }}}

 ## Changes to validate_input -- https://github.com/WordPress/wordpress-
 develop/blob/cfa06b16d210995793f0cee826169e0a986ad28f/src/wp-includes
 /abilities-api/class-wp-ability.php#L465-L496,

 {{{#!php
 if ( null === $input || empty( $input )) {
         return true;
 }

 }}}

 Cc: @justlevine for some inputs here.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64483#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list