mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Clear pending TUI questions when accepting a new prompt (#44328)
## Why Unanswered questions from the previous prompt remain visible after a new follow-up. Clear them when the user moves on to new work. ## What changed - Clear pending questions when a model prompt is submitted or queued, and when a review starts. Clear again on queued prompt delivery to remove questions that arrived while waiting. - Retain seen question IDs so replay cannot restore cleared questions. - Track question answers separately from prompts through queues, retries, thread restoration, and reconnects so delivering an answer preserves other pending questions. - Preserve questions for local commands and rejected submissions. ## Testing Add regression tests for immediate and queued follow-ups, replay suppression, slash prompts, reviews, rejected input, and answer preservation across delivery and recovery. Add a snapshot of the composer after questions are cleared. GitOrigin-RevId: 76353c6ee098c1505678ac43b1dc6391ea9fa738
This commit is contained in:
@@ -9,6 +9,7 @@ use super::PendingSteer;
|
||||
use super::QueuedUserMessage;
|
||||
use super::UserMessage;
|
||||
use super::UserMessageHistoryRecord;
|
||||
use super::UserMessageSource;
|
||||
use super::user_message_preview_text;
|
||||
|
||||
#[derive(Debug, Default, PartialEq, Eq)]
|
||||
@@ -31,6 +32,8 @@ pub(super) struct InputQueueState {
|
||||
pub(super) user_turn_pending_start: bool,
|
||||
/// 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.
|
||||
pub(super) rejected_steer_sources: VecDeque<UserMessageSource>,
|
||||
/// History records for rejected steers. Slash commands such as `/goal` can
|
||||
/// render history that differs from the text submitted to core, so this stays
|
||||
/// in lockstep with `rejected_steers_queue`, with missing entries treated as
|
||||
@@ -58,6 +61,7 @@ impl InputQueueState {
|
||||
self.queued_user_message_history_records.clear();
|
||||
self.user_turn_pending_start = false;
|
||||
self.rejected_steers_queue.clear();
|
||||
self.rejected_steer_sources.clear();
|
||||
self.rejected_steer_history_records.clear();
|
||||
self.pending_steers.clear();
|
||||
self.submit_pending_steers_after_interrupt = false;
|
||||
@@ -119,6 +123,7 @@ mod tests {
|
||||
client_id: "test-submission".to_string(),
|
||||
user_message: UserMessage::from("pending"),
|
||||
history_record: UserMessageHistoryRecord::UserMessageText,
|
||||
source: UserMessageSource::Prompt,
|
||||
compare_key: crate::chatwidget::user_messages::PendingSteerCompareKey {
|
||||
message: "pending".to_string(),
|
||||
image_count: 0,
|
||||
|
||||
Reference in New Issue
Block a user