diff --git a/app/infrastructure/local_s2s.py b/app/infrastructure/local_s2s.py index e7ff600..35f0ff1 100644 --- a/app/infrastructure/local_s2s.py +++ b/app/infrastructure/local_s2s.py @@ -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: diff --git a/docs/calibration/measured-search-2026-10-11.json b/docs/calibration/measured-search-2026-10-11.json index 4a7e14e..826a7c3 100644 --- a/docs/calibration/measured-search-2026-10-11.json +++ b/docs/calibration/measured-search-2026-10-11.json @@ -8,7 +8,7 @@ "dimensions": 1024, "preprocessing_version": "v1" }, - "distance": 0.65, + "distance": 0.72, "retrieval_policy": "exact-first-cosine-id-50x2-whole-5-12000/nfc-digits-kaf-yeh-lower-whitespace-terminal-period-v2" }, "complete_support": 6, diff --git a/services/local_s2s/history.py b/services/local_s2s/history.py index 976cda7..31248f9 100644 --- a/services/local_s2s/history.py +++ b/services/local_s2s/history.py @@ -171,7 +171,9 @@ def install_retained_history(): if raw.get('type') == 'response.cancel': st = service._state(session_id) if not st.in_response or raw.get('response_id') != st.current_response_id: - error = service.make_error('Cancellation identity mismatch', 's2s_history_failed') + error = service.make_error('Cancellation identity mismatch', 'invalid_request_error') + error.error.code = 'response_cancel_not_active' + error.error.param = None error.error.event_id = raw.get('event_id') await transport.send_events([error]) return