mirror of
https://github.com/openai/codex.git
synced 2026-11-18 22:20:48 +00:00
## Why MCP statusline resources were read only once, leaving the footer stale when thread state or the display mode changed. ## What changed - Read the selected provider again one second after each successful read, capturing fresh statusline state for every request. - Enforce a one-second resource read deadline and stop polling with an error footer on timeouts, RPC errors, or invalid content. - Cancel outstanding reads when the reader is retired, including thread switches and parking a voice session, and disable provider reads in voice-only mode. ## Testing Add paused-time tests for polling cadence, fresh state, empty content, failure handling, deadlines, and cancellation. Extend the stdio provider integration test to verify that switching out of raw mode updates the provider footer. GitOrigin-RevId: 159f17ad9291923e438117d919c875051c9d9426
62 lines
2.2 KiB
Rust
62 lines
2.2 KiB
Rust
//! Transfers live voice ownership into a reconstructed view without replaying the call.
|
|
|
|
use super::*;
|
|
|
|
impl ChatWidget {
|
|
pub(crate) fn add_realtime_error(&mut self, message: String) {
|
|
if self.app_event_tx.voice_only.load(Ordering::Relaxed)
|
|
&& let Some(thread_id) = self.thread_id()
|
|
{
|
|
self.app_event_tx.send(AppEvent::BackgroundVoiceError {
|
|
thread_id,
|
|
message: message.chars().take(/*n*/ 4096).collect(),
|
|
});
|
|
} else {
|
|
self.add_error_message(message);
|
|
}
|
|
}
|
|
|
|
pub(crate) fn park_voice(&mut self) {
|
|
self.app_event_tx.voice_only.store(true, Ordering::Relaxed);
|
|
self.statusline_read = None;
|
|
self.set_queue_autosend_suppressed(/*suppressed*/ true);
|
|
self.stop_rate_limit_poller();
|
|
}
|
|
|
|
pub(crate) fn prepare_background_voice_replay(
|
|
&mut self,
|
|
owner: &Self,
|
|
) -> impl Iterator<Item = &str> {
|
|
self.realtime_conversation.pending_speech = owner
|
|
.realtime_conversation
|
|
.pending_speech
|
|
.iter()
|
|
.filter(|pending| !pending.captioned)
|
|
.cloned()
|
|
.collect();
|
|
self.realtime_conversation
|
|
.pending_speech
|
|
.iter()
|
|
.filter_map(|pending| match &pending.item {
|
|
codex_app_server_protocol::ThreadItemPayload::AgentMessage { text, .. } => {
|
|
Some(text.as_str())
|
|
}
|
|
_ => None,
|
|
})
|
|
}
|
|
|
|
pub(crate) fn resume_background_voice(&mut self, owner: &mut ChatWidget) {
|
|
let replay = std::mem::replace(
|
|
&mut self.realtime_conversation,
|
|
std::mem::take(&mut owner.realtime_conversation),
|
|
);
|
|
// The reconstructed transcript has already restored historical captions.
|
|
// Keep its pending insertions, while preserving the live call's partials,
|
|
// delivery acknowledgments, and input generations.
|
|
self.realtime_conversation.pending_history_cells = replay.pending_history_cells;
|
|
self.update_realtime_footer();
|
|
self.refresh_terminal_title();
|
|
self.refresh_thread_usage_after_turn();
|
|
}
|
|
}
|