fix(voice): decouple cancellation race handling from model and voice

This commit is contained in:
amirhosein mazaheri
2026-10-14 12:04:08 +03:30
parent 15558fd850
commit 1f7c2bd195
8 changed files with 134 additions and 23 deletions
+1 -1
View File
@@ -120,7 +120,7 @@ NUMERIC_FIELDS = frozenset({
"received_elapsed_ms", "terminal_completed", "terminal_cancelled", "terminal_limited",
"terminal_failed", "terminal_incomplete", "terminal_tool_calls", "terminal_output_items",
"authority_ms", "emit_ms", "queued_controls",
"cancellation_type_match", "cancellation_code_match", "cancellation_param_match", "cancellation_profile_2_1_shimmer",
"cancellation_type_match", "cancellation_code_match", "cancellation_param_match", "cancellation_correlated",
"transport_limit_bytes", "transport_limit_messages", "occupancy_count", "limit_count", "occupancy_bytes", "limit_bytes", "transport_bytes", "transport_messages",
"speech_bytes", "elapsed_ms", "deadline_remaining_ms", "sent_bytes", "played_ms", "pending_commands",
"pending_responses", "pending_audio", "pending_tasks", "abort_succeeded", "input_bytes", "http_status",
+1 -3
View File
@@ -1752,9 +1752,7 @@ class VoiceRuntime:
cancellation_type_match=int(error.get("type") == "invalid_request_error"),
cancellation_code_match=int(error.get("code") == "response_cancel_not_active"),
cancellation_param_match=int(error.get("param") is None),
cancellation_profile_2_1_shimmer=int(
getattr(self.adapter, "model", None) == "gpt-realtime-2.1"
and getattr(self.adapter, "voice", None) == "shimmer"))
cancellation_correlated=1)
self.sync_failed("CANCELLATION_PROVIDER_ERROR", turn=matches[0].turn, phase="provider_handle", event_type=kind)
elif cleanup:
self.sync_failed("TRUNCATION_PROVIDER_ERROR", turn=cleanup.response.turn, phase="provider_handle", event_type=kind, audio=cleanup)