Expand TUI regression coverage for realtime voice conversations (#43645)

## What changed

- Add app-to-RPC tests for voice startup, shutdown, thread switching, speech delivery, and rejected or stale speech, using a recording app server without audio hardware.
- Cover session retries, typed and voice handoffs, reasoning visibility, and recovery of undelivered answers in focused chat widget test modules.
- Add transcript and buffered replay tests for caption reconciliation, partial transcript preservation, and voice output ownership across thread changes, with rendering snapshots.

GitOrigin-RevId: 8a76523907289f94f257fe97386db7d2e7f33ca5
This commit is contained in:
Benjamin Carlsson authored and copyberry committed 2026-09-08 02:09:29 +00:00
1 parent e7637306bc
commit 6fee98cc85
32 files changed
+5396 -88

No files matched your search

@@ -197,11 +197,56 @@ pub(super) async fn start_recording_remote_app_server(
/// Proxies a real app server while optionally rejecting modern pagination like an older server.
pub(super) async fn start_recording_app_server_with_history(
config: &Config,
history_capabilities: HistoryCapabilities,
blocked_thread_list: Option<(ThreadId, oneshot::Sender<()>, oneshot::Receiver<()>)>,
failed_thread_name: Option<&'static str>,
thread_params_mode: crate::app_server_session::ThreadParamsMode,
loader_overrides: LoaderOverrides,
) -> Result<RecordingAppServer> {
start_recording_app_server_with_realtime_speech(
config,
history_capabilities,
blocked_thread_list,
failed_thread_name,
thread_params_mode,
RealtimeRequestBehavior::Forward,
loader_overrides,
)
.await
}
#[derive(Clone, Copy, PartialEq, Eq)]
pub(super) enum RealtimeRequestBehavior {
Forward,
AcceptStart,
AcceptSpeech,
AcceptSpeechAndStallStop,
}
pub(super) async fn start_recording_realtime_speech_app_server(
config: &Config,
realtime_behavior: RealtimeRequestBehavior,
) -> Result<RecordingAppServer> {
start_recording_app_server_with_realtime_speech(
config,
HistoryCapabilities::Current,
/*blocked_thread_list*/ None,
/*failed_thread_name*/ None,
crate::app_server_session::ThreadParamsMode::Embedded,
realtime_behavior,
LoaderOverrides::default(),
)
.await
}
async fn start_recording_app_server_with_realtime_speech(
config: &Config,
history_capabilities: HistoryCapabilities,
mut blocked_thread_list: Option<(ThreadId, oneshot::Sender<()>, oneshot::Receiver<()>)>,
failed_thread_name: Option<&'static str>,
thread_params_mode: crate::app_server_session::ThreadParamsMode,
realtime_behavior: RealtimeRequestBehavior,
loader_overrides: LoaderOverrides,
) -> Result<RecordingAppServer> {
let state_db =
@@ -256,6 +301,11 @@ pub(super) async fn start_recording_app_server_with_history(
.lock()
.expect("request recorder lock")
.push(request.clone());
if realtime_behavior == RealtimeRequestBehavior::AcceptSpeechAndStallStop
&& request.method == "thread/realtime/stop"
{
continue;
}
let request_id = request.id.clone();
let params = request.params.as_ref();
let requires_pagination = match request.method.as_str() {
@@ -286,7 +336,20 @@ pub(super) async fn start_recording_app_server_with_history(
.is_some_and(|tools| {
tools.iter().any(|tool| tool["type"] == "namespace")
});
let response = if let HistoryCapabilities::ConfigReadUnsupported(code) =
let fake_realtime_response = (realtime_behavior
== RealtimeRequestBehavior::AcceptStart
&& request.method == "thread/realtime/start")
|| (matches!(
realtime_behavior,
RealtimeRequestBehavior::AcceptSpeech
| RealtimeRequestBehavior::AcceptSpeechAndStallStop
) && request.method == "thread/realtime/appendSpeech");
let response = if fake_realtime_response {
JSONRPCMessage::Response(JSONRPCResponse {
id: request_id,
result: serde_json::json!({}),
})
} else if let HistoryCapabilities::ConfigReadUnsupported(code) =
history_capabilities
&& request.method == "config/read"
{