Abilities: observe wp_ability_invoked for entry-point telemetry#239
Open
ibrahimhajjaj wants to merge 1 commit into
Open
Abilities: observe wp_ability_invoked for entry-point telemetry#239ibrahimhajjaj wants to merge 1 commit into
ibrahimhajjaj wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adopts
wp_ability_invokedon the lifecycle bridge, re-emitting it as the substrate actionagents_api_ability_invoked. Part of #94 (next lifecycle hook after thewp_pre_execute_ability/wp_ability_execute_resultslices already on the bridge).wp_ability_invokedfires at the top ofWP_Ability::execute()for every call, before any processing, regardless of outcome. That covers the gap the existing observers leave:agents_api_ability_executed(fromwp_ability_execute_result) only fires on the registered callback's success path, so invocations that fail input validation, fail the permission check, or get short-circuited bywp_pre_execute_abilitynever surface to a substrate observer. An entry-point observer lets consumers record every attempt, not just the ones that produced a result.Changes
src/Abilities/class-wp-agent-ability-lifecycle-bridge.php: newACTION_ABILITY_INVOKEDconst,observe_invoked()handler, and thewp_ability_invokedregistration inregister(). The observer re-emits the action and returns nothing (it is an action, not a filter), so it cannot alter execution.tests/ability-lifecycle-bridge-smoke.php: cases for the invoked observer carrying raw input + the ability instance, and firing for calls that never reach a result.Testing
php tests/ability-lifecycle-bridge-smoke.php— 18 assertions, all pass.composer test— full suite green.