From 2df00510e787e18e2b298199ae6d4559201698d7 Mon Sep 17 00:00:00 2001 From: andreaonofrei01 Date: Tue, 21 Apr 2026 14:28:08 +0200 Subject: [PATCH] fix(conversations): dedupe deferred-responses block in run_async The Speakeasy regen in #484 re-emitted the deferred-response handling block on top of the existing one inside the sdk-class-body custom region, leaving two identical copies in run_async. The second copy unconditionally reset pending_tool_confirmations to None, silently dropping the server-side HITL confirmations computed by the first. Removes the duplicate block so HITL confirmations are preserved. --- src/mistralai/client/conversations.py | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/mistralai/client/conversations.py b/src/mistralai/client/conversations.py index f770ae92..ed2e0fce 100644 --- a/src/mistralai/client/conversations.py +++ b/src/mistralai/client/conversations.py @@ -97,25 +97,6 @@ async def run_async( from mistralai.extra.run.context import _validate_run # pylint: disable=import-outside-toplevel from mistralai.extra.run.tools import get_function_calls # pylint: disable=import-outside-toplevel - # Check if inputs contain deferred responses - process them - pending_tool_confirmations = None - if inputs and isinstance(inputs, list): - deferred_inputs = typing.cast( - List[DeferredToolCallResponse], - [i for i in inputs if _is_deferred_response(i)], - ) - other_inputs = typing.cast( - List[InputEntries], [i for i in inputs if not _is_deferred_response(i)] - ) - if deferred_inputs: - ( - processed, - pending_tool_confirmations, - ) = await _process_deferred_responses(run_ctx, deferred_inputs) - inputs = other_inputs + processed - if not pending_tool_confirmations: - pending_tool_confirmations = None - # Check if inputs contain deferred responses - process them pending_tool_confirmations = None if inputs and isinstance(inputs, list):