Guard interrupted flag for late responses

This commit is contained in:
Charles Cunningham
2026-01-31 20:44:31 -08:00
parent 8e5ca2d1f2
commit 84bbabd29b

View File

@@ -1663,10 +1663,6 @@ impl Session {
_call_id: Option<String>,
response: RequestUserInputResponse,
) {
if response.interrupted {
// An interrupted request_user_input should end the turn without a follow-up request.
self.mark_request_user_input_interrupted().await;
}
let entry = {
let mut active = self.active_turn.lock().await;
match active.as_mut() {
@@ -1680,6 +1676,11 @@ impl Session {
match entry {
Some(tx_response) => {
if response.interrupted {
// An interrupted request_user_input should end the turn without a follow-up
// request; only mark the active turn when the response is still pending.
self.mark_request_user_input_interrupted().await;
}
tx_response.send(response).ok();
}
None => {