Centralize always_allow logic when authorizing agent2 tools (#35988)

Release Notes:

- N/A

---------

Co-authored-by: Cole Miller <cole@zed.dev>
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Co-authored-by: Agus Zubiaga <agus@zed.dev>
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
This commit is contained in:
Antonio Scandurra 2025-08-11 19:22:19 +02:00 committed by GitHub
parent 56c4992b9a
commit 365b5aa31d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 136 additions and 40 deletions

View file

@ -110,9 +110,9 @@ impl AgentTool for ToolRequiringPermission {
event_stream: ToolCallEventStream,
cx: &mut App,
) -> Task<Result<String>> {
let auth_check = event_stream.authorize("Authorize?".into());
let authorize = event_stream.authorize("Authorize?", cx);
cx.foreground_executor().spawn(async move {
auth_check.await?;
authorize.await?;
Ok("Allowed".to_string())
})
}