fix(voice): handle response.cancel no-active race on local S2S provider
- implement LocalS2SAdapter.is_no_active to recognize cancellation of completed or inactive responses - normalize local S2S history handler cancellation error to standard response_cancel_not_active contract - align calibration distance for measured BGE-M3 search threshold
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"""Pinned local engine GA transport; no invented native input/history receipts."""
|
||||
"""Pinned local engine GA transport; no invented native input/history receipts."""
|
||||
from app.infrastructure.realtime import RealtimeAdapter
|
||||
from app.modules.voice.provider import ProviderProtocolError
|
||||
from app.modules.voice.local_s2s import setup_session, effective_identity
|
||||
@@ -49,7 +49,18 @@ class LocalS2SAdapter(RealtimeAdapter):
|
||||
return False
|
||||
|
||||
def is_no_active(self, error):
|
||||
return False
|
||||
try:
|
||||
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)
|
||||
or (error.get("type") == "s2s_history_failed"
|
||||
and error.get("message") == "Cancellation identity mismatch"
|
||||
and error.get("param") is None)
|
||||
))
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def history_repair_request(self, repair):
|
||||
if not self.config.local_s2s_retain_interrupted_answers or not self._confirmed:
|
||||
|
||||
Reference in New Issue
Block a user