fix(voice): preserve interrupted searches and report used sources

Retain and revalidate interrupted searches, resolve abandoned provider calls, recover invalid source reports privately, and expose only declared sources. Improve Persian delivery and provider event replay capacity. Include regression coverage and contract updates.
This commit is contained in:
amirhosein mazaheri
2026-10-13 14:09:20 +03:30
parent 9cc9f0bc01
commit 18e595ac93
21 changed files with 1346 additions and 60 deletions
+12 -2
View File
@@ -136,13 +136,23 @@ def test_native_tool_correlation_canonical_result_and_once_only_continuation(set
answer=responses[0]['functionResponses'][0]
assert answer['id']=='private-google-call' and answer['response']['status']==status
assert answer['response']['sources']==next(iter(runtime.calls.values()))[1]['result']['sources']
assert not any(isinstance(e, dict) and e.get('type') == 'sources' for e in out)
if status == 'ok':
await wire.inbound.put({'toolCall': {'functionCalls': [dict(id='private-report',
name='report_used_sources', args=dict(source_refs=['S1']))]}})
await until(lambda: len([m for m in wire.sent if 'toolResponse' in m]) == 2 or not runtime.usable)
assert runtime.usable, runtime.failure
await wire.inbound.put({'serverContent': {'modelTurn':{'parts':[{'inlineData':{'mimeType':'audio/pcm;rate=24000','data':base64.b64encode(bytes(960)).decode()}}]},'outputTranscription':{'text':'پاسخ'},'turnComplete':True}})
await until(lambda: any(isinstance(e,dict) and e.get('type')=='audio_ended' for e in out) or not runtime.usable)
assert runtime.usable, runtime.failure
assert any(isinstance(e,dict) and e.get('role')=='user' and e['text']=='پرسش' for e in out)
assert any(isinstance(e,dict) and e.get('role')=='assistant' and e['status']=='completed' and e['text']=='پاسخ' for e in out)
source_event=next(e for e in out if isinstance(e,dict) and e.get('type')=='sources')
assert source_event['tool_call_id']!='private-google-call'
events=[e for e in out if isinstance(e,dict) and e.get('type')=='sources']
if status == 'ok':
assert len(events) == 1 and events[0]['tool_call_id'] != 'private-google-call'
assert [s['source_ref'] for s in events[0]['sources']] == ['S1']
else:
assert events == []
finally:
await cleanup(runtime,receive)
assert wire.closed==1