Opened 7 weeks ago
Closed 7 weeks ago
#65504 closed defect (bug) (fixed)
WP_AI_Client_Ability_Function_Resolver::execute_abilities() answers non-ability function calls with a spurious error
| Reported by: | khokansardar | Owned by: | gziolo |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.1 |
| Component: | Abilities API | Version: | 7.0 |
| Severity: | normal | Keywords: | has-patch has-unit-tests needs-testing |
| Cc: | Focuses: |
Description
WP_AI_Client_Ability_Function_Resolver has two methods that scan a message's function-call parts:
has_ability_calls()guards each part withis_ability_call(), so it only reports parts prefixed withwpab__.execute_abilities()does not guard — it callsexecute_ability()on *every* function-call part.
For any function call that is not an ability (i.e. a tool handled elsewhere, the normal case when a model is given both Abilities and other tools), execute_ability() returns a FunctionResponse with code => 'invalid_ability_call'. Because providers require a response for every function call, that fabricated error response gets attributed to the other tool, and the real tool never runs.
The two methods should agree: execute_abilities() should skip parts where ! is_ability_call().
Steps to reproduce
- Build a
ModelMessagecontaining two function-call parts: onewpab__...ability call and one non-ability call (e.g.some_other_tool). - Call
execute_abilities()on it. - Observe the returned
UserMessagecontains aFunctionResponsefor the non-ability call withcode => 'invalid_ability_call'.
Expected: only the ability call is answered; the non-ability call is left untouched.
Fix
Add the is_ability_call() guard in execute_abilities() so it matches the parts
reported by has_ability_calls(). Includes a regression test covering a mixed ability / non-ability message.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
WP_AI_Client_Ability_Function_Resolver::execute_abilities()ranexecute_ability()on every function-call part in a message. Unlike its siblinghas_ability_calls(), it did not checkis_ability_call()first, so a function call for a tool handled elsewhere (anything not prefixedwpab__) was answered with a fabricatedinvalid_ability_callerror response. Because providers expect one response per function call, that spurious response was attributed to the other tool and the real tool never ran.Add the
is_ability_call()guard soexecute_abilities()processes the same parts thathas_ability_calls()reports, and add a regression test covering a mixed ability / non-ability message.Fixes #65504.
Trac ticket: https://core.trac.wordpress.org/ticket/65504
## Use of AI Tools
N/A