Keep interrupted prompts in conversation history (#33198)

## What changed

- Leave an output-free interrupted prompt in the transcript and open a blank
  composer for the user's next instruction.
- Use the normal interruption notice for both `Esc` and `Ctrl-C` interrupts.
- Track safety-buffering prompts separately so failed retries can still restore
  the prompt, including after switching between threads.

## Testing

- Cover output-free `Esc` and `Ctrl-C` interrupts, failed safety-buffer retries,
  and restoration of safety-buffer state from thread snapshots.

GitOrigin-RevId: 30b368d00dfdb981d06d4c95ce3f252389b7917c
This commit is contained in:
Felipe Coury authored and copyberry committed 2026-07-15 01:07:29 +00:00
1 parent 4df8027a97
commit 70a0b1eef8
29 files changed
+186 -269

No files matched your search

@@ -8,12 +8,10 @@ use codex_utils_path_uri::LegacyAppPathString;
impl ChatWidget {
pub(super) fn on_patch_apply_begin(&mut self, changes: HashMap<PathBuf, FileChange>) {
self.record_visible_turn_activity();
self.add_to_history(history_cell::new_patch_event(changes, &self.config.cwd));
}
pub(super) fn on_view_image_tool_call(&mut self, path: LegacyAppPathString) {
self.record_visible_turn_activity();
self.flush_answer_stream_with_separator();
self.add_to_history(history_cell::new_view_image_tool_call(
path,
@@ -23,7 +21,6 @@ impl ChatWidget {
}
pub(super) fn on_image_generation_begin(&mut self) {
self.record_visible_turn_activity();
self.flush_answer_stream_with_separator();
if self.bottom_pane.is_task_running() {
self.bottom_pane.ensure_status_indicator();
@@ -72,7 +69,6 @@ impl ChatWidget {
}
pub(super) fn on_web_search_begin(&mut self, call_id: String) {
self.record_visible_turn_activity();
self.flush_answer_stream_with_separator();
self.flush_active_cell();
self.transcript.active_cell = Some(Box::new(history_cell::new_active_web_search_call(
@@ -119,7 +115,6 @@ impl ChatWidget {
}
pub(super) fn on_collab_agent_tool_call(&mut self, item: ThreadItem) {
self.record_visible_turn_activity();
let ThreadItem::CollabAgentToolCall {
id, tool, status, ..
} = &item
@@ -151,7 +146,6 @@ impl ChatWidget {
}
pub(super) fn on_sub_agent_activity(&mut self, item: ThreadItem) {
self.record_visible_turn_activity();
if let Some(cell) = multi_agents::sub_agent_activity_history_cell(&item) {
self.on_collab_event(cell);
}
@@ -171,7 +165,6 @@ impl ChatWidget {
}
pub(crate) fn handle_mcp_tool_call_started_now(&mut self, item: ThreadItem) {
self.record_visible_turn_activity();
let ThreadItem::McpToolCall {
id,
server,