mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Resume unsent TUI input after reconnecting (#49105)
## Why Reconnecting paused all recovered input, including queued messages that had never been sent. Those messages can resume automatically once any uncertain submissions are resolved. ## What changed - Track unsent and unconfirmed messages separately. Reconcile submitted prompts and steers using exact client message IDs from restored history, buffered events, and later receipts. - Remove confirmed submissions from the recovered queue and resume unsent input after replay. Keep uncertain submissions paused without resending them, and show a notice identifying the message whose delivery could not be confirmed. - Preserve pauses for unavailable conversations, pending compact/review requests, and existing input recovery failures. - Simplify reconnect status text and remove blanket disconnect/reconnect transcript notices. ## Testing Update reconnect integration tests and snapshots for automatic queue resumption. Add coverage for matching and unrelated receipts, missing history, late confirmations across navigation, pending compaction, and preservation of image-failure recovery pauses. GitOrigin-RevId: d0b9aa43c4019d472985d12bbce8ba9bbfb9253b
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
use std::collections::VecDeque;
|
||||
|
||||
use super::MessageDelivery;
|
||||
use super::PendingSteer;
|
||||
use super::QueuedUserMessage;
|
||||
use super::UserMessage;
|
||||
@@ -32,6 +33,7 @@ pub(super) struct InputQueueState {
|
||||
pub(super) queued_user_message_history_records: VecDeque<UserMessageHistoryRecord>,
|
||||
/// A user turn has been submitted to core, but `TurnStarted` has not arrived yet.
|
||||
pub(super) user_turn_pending_start: bool,
|
||||
pub(super) pending_user_message_client_id: Option<String>,
|
||||
/// User messages that tried to steer a non-regular turn and must be retried first.
|
||||
pub(super) rejected_steers_queue: VecDeque<UserMessage>,
|
||||
/// The origin of each rejected steer, kept in lockstep with its message.
|
||||
@@ -49,10 +51,17 @@ pub(super) struct InputQueueState {
|
||||
pub(super) suppress_queue_autosend: bool,
|
||||
/// Hold submissions while a usage failure or backend-directed model fallback is resolved.
|
||||
pub(super) rate_limit_recovery_pending: bool,
|
||||
/// Pause for user recovery (for example an image or permission failure), independent of delivery.
|
||||
pub(super) recovered_queue: bool,
|
||||
}
|
||||
|
||||
impl InputQueueState {
|
||||
pub(super) fn has_unconfirmed_messages(&self) -> bool {
|
||||
self.queued_user_messages
|
||||
.iter()
|
||||
.any(|message| matches!(message.delivery, MessageDelivery::Unconfirmed(_)))
|
||||
}
|
||||
|
||||
pub(super) fn has_queued_follow_up_messages(&self) -> bool {
|
||||
!self.rejected_steers_queue.is_empty() || !self.queued_user_messages.is_empty()
|
||||
}
|
||||
@@ -63,6 +72,7 @@ impl InputQueueState {
|
||||
self.queued_user_messages.clear();
|
||||
self.queued_user_message_history_records.clear();
|
||||
self.user_turn_pending_start = false;
|
||||
self.pending_user_message_client_id = None;
|
||||
self.rejected_steers_queue.clear();
|
||||
self.rejected_steer_sources.clear();
|
||||
self.rejected_steer_history_records.clear();
|
||||
|
||||
Reference in New Issue
Block a user