fix(voice): decouple cancellation race handling from model and voice
This commit is contained in:
@@ -195,15 +195,11 @@ class RealtimeAdapter:
|
||||
try:
|
||||
if self.no_active_classifier is not None:
|
||||
return self.no_active_classifier(error) is True
|
||||
# Selected-profile probe: docs/guides/live-context-sync-repair.md.
|
||||
# The runtime separately requires the cancellation intent event_id,
|
||||
# terminal response confirmation, and heard-position truncation.
|
||||
return ((self.model, self.voice) in {
|
||||
("gpt-realtime-mini", "shimmer"),
|
||||
("gpt-realtime-2.1", "shimmer"),
|
||||
("gpt-realtime-2.1", "marin"),
|
||||
}
|
||||
and isinstance(error, dict)
|
||||
# Captured structured OpenAI signature; independent of model/voice.
|
||||
# Runtime still requires the cancellation intent event_id, terminal
|
||||
# response confirmation, and heard-position truncation acknowledgements.
|
||||
# Unknown signatures remain failures; never match provider message text.
|
||||
return (isinstance(error, dict)
|
||||
and error.get("type") == "invalid_request_error"
|
||||
and error.get("code") == "response_cancel_not_active"
|
||||
and error.get("param") is None)
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user