mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Track voice session lifecycle metrics in the TUI (#43934)
## What changed - Record voice session starts, connections, failures, endings, and active duration under `codex.voice.session.*`. - Deduplicate failure accounting and distinguish errors during startup retry cleanup from errors during a requested stop. - Record failures on rejected voice operations and disconnects, and clear the owned session when a stop request is rejected. ## Testing Add regression tests for failure accounting during retry cleanup and session cleanup after rejected stop requests, including replay-only threads. GitOrigin-RevId: d67cab5ff1e8fc85ce7a3d61a1763d38a5d537f0
This commit is contained in:
1 parent
5e3f0ee94b
commit
fba22e9a2a
7 files changed
+140
-7
No files matched your search
@@ -62,3 +62,39 @@ async fn rejected_voice_start_does_not_leave_local_capture_active() -> Result<()
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn rejected_voice_stop_clears_the_owned_session() -> Result<()> {
|
||||
for replay_only in [false, true] {
|
||||
let (mut app, _events, _ops) = make_test_app_with_channels().await;
|
||||
let (mut app_server, requests, proxy) =
|
||||
start_recording_remote_app_server(&app.config).await?;
|
||||
let thread_id = ThreadId::new();
|
||||
app.chat_widget
|
||||
.handle_thread_session_quiet(test_thread_session(
|
||||
thread_id,
|
||||
app.config.cwd.to_path_buf(),
|
||||
));
|
||||
crate::chatwidget::activate_voice_for_thread(&mut app.chat_widget, thread_id);
|
||||
if replay_only {
|
||||
app.app_server_target = AppServerTarget::Remote {
|
||||
endpoint: crate::resolve_remote_addr("ws://127.0.0.1:9")?,
|
||||
};
|
||||
app.active_thread_id = Some(thread_id);
|
||||
app.ensure_thread_channel(thread_id).mark_replay_only();
|
||||
}
|
||||
let mut tui = crate::tui::test_support::make_test_tui()?;
|
||||
Box::pin(app.handle_event(
|
||||
&mut tui,
|
||||
&mut app_server,
|
||||
AppEvent::CodexOp(Op::RealtimeConversationStop { thread_id }),
|
||||
))
|
||||
.await?;
|
||||
|
||||
assert!(!app.chat_widget.may_receive_realtime_transcripts());
|
||||
assert!(recorded_params(&requests, "thread/realtime/stop").is_empty());
|
||||
app_server.shutdown().await?;
|
||||
proxy.await??;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
Reference in new issue
Block a user