From 99c80848d50311da66c783398edce4868f6f1da4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 12 Jun 2026 14:22:03 +0000 Subject: [PATCH 1/7] Initial plan From 1ad2a975e29c92f0cd6d155ae5b24b729d5237fd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 12 Jun 2026 14:25:40 +0000 Subject: [PATCH 2/7] Fix ability run input handling without schema Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- features/ability.feature | 19 +++++++++++++++++++ src/Ability_Command.php | 5 +++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/features/ability.feature b/features/ability.feature index 94a014c..2cf43b3 100644 --- a/features/ability.feature +++ b/features/ability.feature @@ -191,6 +191,19 @@ Feature: Manage abilities registered via the WordPress Abilities API. }, 'permission_callback' => '__return_true', ) ); + + wp_register_ability( 'test-plugin/simple-no-input', array( + 'label' => 'Simple No Input', + 'description' => 'Returns an empty array.', + 'category' => 'test-category', + 'output_schema' => array( + 'type' => 'array', + ), + 'execute_callback' => function() { + return array(); + }, + 'permission_callback' => '__return_true', + ) ); } ); """ @@ -224,6 +237,12 @@ Feature: Manage abilities registered via the WordPress Abilities API. {"sum":30} """ + When I run `wp ability run test-plugin/simple-no-input` + Then STDOUT should be: + """ + [] + """ + When I run `wp ability run test-plugin/get-site-title --format=yaml` Then STDOUT should contain: """ diff --git a/src/Ability_Command.php b/src/Ability_Command.php index 837b61a..c9608a2 100644 --- a/src/Ability_Command.php +++ b/src/Ability_Command.php @@ -593,7 +593,7 @@ private function build_input( $assoc_args ) { * Builds input data from associative arguments with stdin support. * * @param array $assoc_args Associative arguments. - * @return array The input data. + * @return array|null The input data, or null if none provided. */ private function build_input_with_stdin( $assoc_args ) { $input = []; @@ -626,7 +626,8 @@ private function build_input_with_stdin( $assoc_args ) { $input[ $key ] = $value; } - return $input; + // Return null if no input provided (for abilities without input schema). + return empty( $input ) ? null : $input; } /** From 960910d964082ffc8330fcdb4e4eedea7e8b03b8 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 12 Jun 2026 22:21:02 +0200 Subject: [PATCH 3/7] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- features/ability.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/ability.feature b/features/ability.feature index 2cf43b3..4ccaae4 100644 --- a/features/ability.feature +++ b/features/ability.feature @@ -199,7 +199,7 @@ Feature: Manage abilities registered via the WordPress Abilities API. 'output_schema' => array( 'type' => 'array', ), - 'execute_callback' => function() { + 'execute_callback' => function( $input = null ) { return array(); }, 'permission_callback' => '__return_true', From 3b4defaa2fd1caf1c29fb2679adcd04312788877 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 12 Jun 2026 22:21:08 +0200 Subject: [PATCH 4/7] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/Ability_Command.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Ability_Command.php b/src/Ability_Command.php index c9608a2..082df86 100644 --- a/src/Ability_Command.php +++ b/src/Ability_Command.php @@ -626,8 +626,8 @@ private function build_input_with_stdin( $assoc_args ) { $input[ $key ] = $value; } - // Return null if no input provided (for abilities without input schema). - return empty( $input ) ? null : $input; + // Return null only when no input was provided (no --input flag and no field args). + return ( empty( $input ) && null === $json_input ) ? null : $input; } /** From 20bcbc446bf6fadbc5c5b92a2293d68b76071e27 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 12 Jun 2026 20:54:45 +0000 Subject: [PATCH 5/7] Preserve object input semantics for abilities with input schema Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- src/Ability_Command.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Ability_Command.php b/src/Ability_Command.php index 082df86..5653ff3 100644 --- a/src/Ability_Command.php +++ b/src/Ability_Command.php @@ -369,6 +369,9 @@ public function run( $args, $assoc_args ): void { // Build input data (with stdin support). $input = $this->build_input_with_stdin( $assoc_args ); + if ( null === $input && ! empty( $ability->get_input_schema() ) ) { + $input = []; + } // Execute the ability. $result = $ability->execute( $input ); From f20632f1d4be3f6381749255d9a67f075950358b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 12 Jun 2026 20:55:53 +0000 Subject: [PATCH 6/7] Handle missing run input based on input_schema presence Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- src/Ability_Command.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ability_Command.php b/src/Ability_Command.php index 5653ff3..4fa1bea 100644 --- a/src/Ability_Command.php +++ b/src/Ability_Command.php @@ -369,7 +369,7 @@ public function run( $args, $assoc_args ): void { // Build input data (with stdin support). $input = $this->build_input_with_stdin( $assoc_args ); - if ( null === $input && ! empty( $ability->get_input_schema() ) ) { + if ( null === $input && null !== $ability->get_meta_item( 'input_schema', null ) ) { $input = []; } From 18234294fca552d6c4644231439b3a9b1dc85b85 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 13 Jun 2026 10:43:31 +0000 Subject: [PATCH 7/7] Fix input schema detection in ability run Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- src/Ability_Command.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ability_Command.php b/src/Ability_Command.php index 4fa1bea..48fc9a4 100644 --- a/src/Ability_Command.php +++ b/src/Ability_Command.php @@ -369,7 +369,7 @@ public function run( $args, $assoc_args ): void { // Build input data (with stdin support). $input = $this->build_input_with_stdin( $assoc_args ); - if ( null === $input && null !== $ability->get_meta_item( 'input_schema', null ) ) { + if ( null === $input && [] !== $ability->get_input_schema() ) { $input = []; }