fix: abort stops running tool calls and kills bash process group

Race the tool round against abort, check abort before starting tools,
answer pending calls with an aborted result, deny permission prompts on
abort, and kill the bash process group on drop.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
johannesandClaude Sonnet 5.5 committed 2026-11-21 18:58:42 +01:00
1 parent 951b69837a
commit 8f0de9465d
3 files changed
+120 -9

No files matched your search

+8 -1
View File
@@ -135,7 +135,14 @@ pub async fn gate_why(cx: &ToolCtx, req: crate::permit::Request) -> Result<(), S
}
}
let rule = req.rule.clone();
match ask(req).await {
let decision = match cx.state.abort.get().cloned() {
Some(mut rx) => tokio::select! {
d = ask(req) => d,
_ = async { rx.wait_for(|a| *a).await.is_ok() } => Decision::Deny,
},
None => ask(req).await,
};
match decision {
Decision::Once => {}
Decision::Always => allow().add(&rule),
Decision::Edits => allow().allow_edits(),